mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 18:10:39 +00:00
As the test test_streams_closed_read confirmed, when a stream shard is closed, GetRecords should not return a NextShardIterator at all. Before this patch we wrongly returned an empty string for it. Before this patch, several Alternator Stream tests (in test_streams.py) failed when running against a multi-node Scylla cluster. The reason is as follows: As a multi-node cluster boots and more and more nodes enter the cluster, the cluster changes its mind about the token ownership, and therefore the list of stream shards changes. By the time we have the full cluster, a bunch of shards were created and closed without any data yet. All the tests will see these closed shards, and need to understand them. The fetch_more() utility function correctly assumed that a closed shard does not return a NextShardIterator, and got confused by the empty string we used to return. Now that closed shards can return responses without NextShardIterator, we also needed to fix in this patch a couple of tests which wrongly assumed this can't happen. These tests did not fail on DynamoDB because unlike in Scylla, DynamoDB does not have any closed shards in normal tests which do not specifically cause them (only test_streams_closed_read). We also need to fix test_streams_closed_read to get rid of an unnecessary assumption: It currently assumes that when we read the very last item in a closed shard is read, the end-of-shard is immediately signaled (i.e., NextShardIterator is not returned). Although DynamoDB does in fact do this, it is also perfectly legal for Alternator's implementation to return the last item with a new NextShardIterator - and only when the client reads from that iterator, we finally return the signal the end of the shard. Fixes #7237. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Message-Id: <20200922082529.511199-1-nyh@scylladb.com>