You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Chris Splinter (JIRA)" <ji...@apache.org> on 2016/09/28 23:48:20 UTC

[jira] [Created] (CASSANDRA-12729) Cassandra-Stress: Use single seed in UUID generation

Chris Splinter created CASSANDRA-12729:
------------------------------------------

             Summary: Cassandra-Stress: Use single seed in UUID generation
                 Key: CASSANDRA-12729
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12729
             Project: Cassandra
          Issue Type: Bug
          Components: Tools
            Reporter: Chris Splinter
            Priority: Minor


While testing the [new sequence distribution|https://issues.apache.org/jira/browse/CASSANDRA-12490] 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.
{code}
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
{code}

The following debug output showed that we were over-incrementing the seed
{code}
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
{code}

This patch fixes this issue by calling {{identityDistribution.next()}} once [instead of twice|https://github.com/apache/cassandra/blob/trunk/tools/stress/src/org/apache/cassandra/stress/generate/values/UUIDs.java/#L37] when generating UUID's



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)