Details
-
Bug
-
Status: Resolved
-
Low
-
Resolution: Fixed
-
None
-
Low
Description
While testing the new sequence distribution for the user module of cassandra-stress I noticed that half of the expected rows (848 / 1696) were produced when using a single uuid primary key.
table: player_info_by_uuid table_definition: | CREATE TABLE player_info_by_uuid ( player_uuid uuid, player_full_name text, team_name text, weight double, height double, position text, PRIMARY KEY (player_uuid) ) columnspec: - name: player_uuid size: fixed(32) # no. of chars of UUID population: seq(1..1696) # 53 active players per team, 32 teams = 1696 players insert: partitions: fixed(1) # 1 partition per batch batchtype: UNLOGGED # use unlogged batches select: fixed(1)/1 # no chance of skipping a row when generating inserts
The following debug output showed that we were over-incrementing the seed
SeedManager.next.index: 341824 SeriesGenerator.Seed.next: 0 SeriesGenerator.Seed.start: 1 SeriesGenerator.Seed.totalCount: 20 SeriesGenerator.Seed.next % totalCount: 0 SeriesGenerator.Seed.start + (next % totalCount): 1 PartitionOperation.ready.seed: org.apache.cassandra.stress.generate.Seed@1 DistributionSequence.nextWithWrap.next: 0 DistributionSequence.nextWithWrap.start: 1 DistributionSequence.nextWithWrap.totalCount: 20 DistributionSequence.nextWithWrap.next % totalCount: 0 DistributionSequence.nextWithWrap.start + (next % totalCount): 1 DistributionSequence.nextWithWrap.next: 1 DistributionSequence.nextWithWrap.start: 1 DistributionSequence.nextWithWrap.totalCount: 20 DistributionSequence.nextWithWrap.next % totalCount: 1 DistributionSequence.nextWithWrap.start + (next % totalCount): 2 Generated uuid: 00000000-0000-0001-0000-000000000002
This patch fixes this issue by calling identityDistribution.next() once instead of twice when generating UUID's