Skip to content

Instantly share code, notes, and snippets.

@jeffjirsa
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save jeffjirsa/87e2b95113e3366bc00b to your computer and use it in GitHub Desktop.

Select an option

Save jeffjirsa/87e2b95113e3366bc00b to your computer and use it in GitHub Desktop.
Testing CASSANDRA-9181 with 3.0
#!/usr/bin/python
import cql
import time
host = "localhost"
port = 9160
con = cql.connect(host, port, cql_version='3.0.0')
cursor = con.cursor()
query = """create keyspace IF NOT EXISTS test2 WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};"""
print cursor.execute(query)
query = """USE test2; """
print cursor.execute(query)
query = """create table IF NOT EXISTS text_table(p text, i text, value int, primary key(p, i)); """
print cursor.execute(query)
query = """create index IF NOT EXISTS failure on text_table(value);"""
print cursor.execute(query)
for i in range(0, 5000):
query = """INSERT INTO text_table (p, i, value) VALUES('1', :i, null); """
params = {'i': str(i), 'inc': i}
r = cursor.execute(query, params)
if r is False or i % 10 == 0:
print(i)
time.sleep(1/10)
cqlsh> TRACING on
Now Tracing is enabled
cqlsh> select * from test2.text_table where p='1634' and value=1634;
p | i | value
---+---+-------
(0 rows)
Tracing session: 7501aac0-e552-11e4-bed7-8ff7b1eb6f10
activity | timestamp | source | source_elapsed
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------+-----------+----------------
Execute CQL3 query | 2015-04-17 15:38:24.113000 | 127.0.0.1 | 0
Parsing select * from test2.text_table where p='1634' and value=1634; [SharedPool-Worker-1] | 2015-04-17 15:38:24.114000 | 127.0.0.1 | 2231
Preparing statement [SharedPool-Worker-1] | 2015-04-17 15:38:24.116000 | 127.0.0.1 | 3856
Computing ranges to query [SharedPool-Worker-1] | 2015-04-17 15:38:24.121000 | 127.0.0.1 | 8787
Candidate index mean cardinalities are CompositesIndexOnRegular{columnDefs=[ColumnDefinition{name=value, type=org.apache.cassandra.db.marshal.Int32Type, kind=REGULAR, componentIndex=1, indexName=failure, indexType=COMPOSITES}]}:0. Scanning with text_table.failure. [SharedPool-Worker-1] | 2015-04-17 15:38:24.121000 | 127.0.0.1 | 9252
Submitting range requests on 1 ranges with a concurrency of 1 (0.0 rows per range expected) [SharedPool-Worker-1] | 2015-04-17 15:38:24.121000 | 127.0.0.1 | 9447
Enqueuing request to /127.0.0.3 [SharedPool-Worker-1] | 2015-04-17 15:38:24.121000 | 127.0.0.1 | 9699
Submitted 1 concurrent range requests covering 1 ranges [SharedPool-Worker-1] | 2015-04-17 15:38:24.122000 | 127.0.0.1 | 9947
Sending message to /127.0.0.3 [WRITE-/127.0.0.3] | 2015-04-17 15:38:24.122000 | 127.0.0.1 | 10071
Message received from /127.0.0.1 [Thread-2] | 2015-04-17 15:38:24.124000 | 127.0.0.3 | 400
Executing indexed scan for [1634, 1634] [SharedPool-Worker-1] | 2015-04-17 15:38:24.128000 | 127.0.0.3 | 4044
Candidate index mean cardinalities are CompositesIndexOnRegular{columnDefs=[ColumnDefinition{name=value, type=org.apache.cassandra.db.marshal.Int32Type, kind=REGULAR, componentIndex=1, indexName=failure, indexType=COMPOSITES}]}:0. Scanning with text_table.failure. [SharedPool-Worker-1] | 2015-04-17 15:38:24.129000 | 127.0.0.3 | 4568
Candidate index mean cardinalities are CompositesIndexOnRegular{columnDefs=[ColumnDefinition{name=value, type=org.apache.cassandra.db.marshal.Int32Type, kind=REGULAR, componentIndex=1, indexName=failure, indexType=COMPOSITES}]}:0. Scanning with text_table.failure. [SharedPool-Worker-1] | 2015-04-17 15:38:24.129000 | 127.0.0.3 | 4842
Executing single-partition query on text_table.failure [SharedPool-Worker-1] | 2015-04-17 15:38:24.130000 | 127.0.0.3 | 5754
Acquiring sstable references [SharedPool-Worker-1] | 2015-04-17 15:38:24.130000 | 127.0.0.3 | 5904
Merging memtable tombstones [SharedPool-Worker-1] | 2015-04-17 15:38:24.130000 | 127.0.0.3 | 6067
Skipped 0/0 non-slice-intersecting sstables, included 0 due to tombstones [SharedPool-Worker-1] | 2015-04-17 15:38:24.130000 | 127.0.0.3 | 6254
Scanned 0 rows and matched 0 [SharedPool-Worker-1] | 2015-04-17 15:38:24.131000 | 127.0.0.3 | 6471
Enqueuing response to /127.0.0.1 [SharedPool-Worker-1] | 2015-04-17 15:38:24.131000 | 127.0.0.3 | 6633
Sending message to /127.0.0.1 [WRITE-/127.0.0.1] | 2015-04-17 15:38:24.131000 | 127.0.0.3 | 7029
Message received from /127.0.0.3 [Thread-3] | 2015-04-17 15:38:24.132000 | 127.0.0.1 | 19826
Processing response from /127.0.0.3 [SharedPool-Worker-2] | 2015-04-17 15:38:24.132000 | 127.0.0.1 | 20316
Request complete | 2015-04-17 15:38:24.133724 | 127.0.0.1 | 20724
cqlsh> cqlsh> select * from test2.text_table where value=1635;
p | i | value
---+---+-------
(0 rows)
Tracing session: a6f153f0-e552-11e4-bed7-8ff7b1eb6f10
activity | timestamp | source | source_elapsed
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------+-----------+----------------
Execute CQL3 query | 2015-04-17 15:39:47.887000 | 127.0.0.1 | 0
Parsing select * from test2.text_table where value=1635; [SharedPool-Worker-1] | 2015-04-17 15:39:47.887000 | 127.0.0.1 | 196
Preparing statement [SharedPool-Worker-1] | 2015-04-17 15:39:47.887000 | 127.0.0.1 | 413
Computing ranges to query [SharedPool-Worker-1] | 2015-04-17 15:39:47.888000 | 127.0.0.1 | 900
Candidate index mean cardinalities are CompositesIndexOnRegular{columnDefs=[ColumnDefinition{name=value, type=org.apache.cassandra.db.marshal.Int32Type, kind=REGULAR, componentIndex=1, indexName=failure, indexType=COMPOSITES}]}:0. Scanning with text_table.failure. [SharedPool-Worker-1] | 2015-04-17 15:39:47.888000 | 127.0.0.1 | 1224
Submitting range requests on 3 ranges with a concurrency of 1 (0.0 rows per range expected) [SharedPool-Worker-1] | 2015-04-17 15:39:47.888000 | 127.0.0.1 | 1377
Enqueuing request to /127.0.0.2 [SharedPool-Worker-1] | 2015-04-17 15:39:47.888000 | 127.0.0.1 | 1664
Submitted 1 concurrent range requests covering 1 ranges [SharedPool-Worker-1] | 2015-04-17 15:39:47.889000 | 127.0.0.1 | 1872
Sending message to /127.0.0.2 [WRITE-/127.0.0.2] | 2015-04-17 15:39:47.889000 | 127.0.0.1 | 2022
Message received from /127.0.0.1 [Thread-2] | 2015-04-17 15:39:47.893000 | 127.0.0.2 | 651
Executing indexed scan for (min(-9223372036854775808), max(-3074457345618258603)] [SharedPool-Worker-1] | 2015-04-17 15:39:47.897000 | 127.0.0.2 | 4627
Candidate index mean cardinalities are CompositesIndexOnRegular{columnDefs=[ColumnDefinition{name=value, type=org.apache.cassandra.db.marshal.Int32Type, kind=REGULAR, componentIndex=1, indexName=failure, indexType=COMPOSITES}]}:0. Scanning with text_table.failure. [SharedPool-Worker-1] | 2015-04-17 15:39:47.897000 | 127.0.0.2 | 5087
Candidate index mean cardinalities are CompositesIndexOnRegular{columnDefs=[ColumnDefinition{name=value, type=org.apache.cassandra.db.marshal.Int32Type, kind=REGULAR, componentIndex=1, indexName=failure, indexType=COMPOSITES}]}:0. Scanning with text_table.failure. [SharedPool-Worker-1] | 2015-04-17 15:39:47.898000 | 127.0.0.2 | 5372
Executing single-partition query on text_table.failure [SharedPool-Worker-1] | 2015-04-17 15:39:47.899000 | 127.0.0.2 | 6165
Acquiring sstable references [SharedPool-Worker-1] | 2015-04-17 15:39:47.899000 | 127.0.0.2 | 6310
Merging memtable tombstones [SharedPool-Worker-1] | 2015-04-17 15:39:47.899000 | 127.0.0.2 | 6490
Skipped 0/0 non-slice-intersecting sstables, included 0 due to tombstones [SharedPool-Worker-1] | 2015-04-17 15:39:47.899000 | 127.0.0.2 | 6672
Scanned 0 rows and matched 0 [SharedPool-Worker-1] | 2015-04-17 15:39:47.899000 | 127.0.0.2 | 6932
Enqueuing response to /127.0.0.1 [SharedPool-Worker-1] | 2015-04-17 15:39:47.899000 | 127.0.0.2 | 7104
Sending message to /127.0.0.1 [WRITE-/127.0.0.1] | 2015-04-17 15:39:47.900000 | 127.0.0.2 | 7510
Message received from /127.0.0.2 [Thread-4] | 2015-04-17 15:39:47.900000 | 127.0.0.1 | 13650
Processing response from /127.0.0.2 [SharedPool-Worker-3] | 2015-04-17 15:39:47.901000 | 127.0.0.1 | 13933
Enqueuing request to /127.0.0.3 [SharedPool-Worker-1] | 2015-04-17 15:39:47.901000 | 127.0.0.1 | 14371
Submitted 2 concurrent range requests covering 2 ranges [SharedPool-Worker-1] | 2015-04-17 15:39:47.901000 | 127.0.0.1 | 14674
Message received from /127.0.0.1 [Thread-2] | 2015-04-17 15:39:47.902000 | 127.0.0.3 | 48
Sending message to /127.0.0.3 [WRITE-/127.0.0.3] | 2015-04-17 15:39:47.902000 | 127.0.0.1 | 14930
Executing indexed scan for (max(-3074457345618258603), max(3074457345618258602)] [SharedPool-Worker-1] | 2015-04-17 15:39:47.903000 | 127.0.0.3 | 589
Candidate index mean cardinalities are CompositesIndexOnRegular{columnDefs=[ColumnDefinition{name=value, type=org.apache.cassandra.db.marshal.Int32Type, kind=REGULAR, componentIndex=1, indexName=failure, indexType=COMPOSITES}]}:0. Scanning with text_table.failure. [SharedPool-Worker-1] | 2015-04-17 15:39:47.903000 | 127.0.0.3 | 882
Candidate index mean cardinalities are CompositesIndexOnRegular{columnDefs=[ColumnDefinition{name=value, type=org.apache.cassandra.db.marshal.Int32Type, kind=REGULAR, componentIndex=1, indexName=failure, indexType=COMPOSITES}]}:0. Scanning with text_table.failure. [SharedPool-Worker-1] | 2015-04-17 15:39:47.904000 | 127.0.0.3 | 1168
Executing indexed scan for (max(3074457345618258602), min(-9223372036854775808)) [SharedPool-Worker-4] | 2015-04-17 15:39:47.904000 | 127.0.0.1 | 17488
Executing single-partition query on text_table.failure [SharedPool-Worker-1] | 2015-04-17 15:39:47.904000 | 127.0.0.3 | 1386
Acquiring sstable references [SharedPool-Worker-1] | 2015-04-17 15:39:47.904000 | 127.0.0.3 | 1544
Merging memtable tombstones [SharedPool-Worker-1] | 2015-04-17 15:39:47.904000 | 127.0.0.3 | 1726
Skipped 0/0 non-slice-intersecting sstables, included 0 due to tombstones [SharedPool-Worker-1] | 2015-04-17 15:39:47.904000 | 127.0.0.3 | 1931
Scanned 0 rows and matched 0 [SharedPool-Worker-1] | 2015-04-17 15:39:47.905000 | 127.0.0.3 | 2177
Candidate index mean cardinalities are CompositesIndexOnRegular{columnDefs=[ColumnDefinition{name=value, type=org.apache.cassandra.db.marshal.Int32Type, kind=REGULAR, componentIndex=1, indexName=failure, indexType=COMPOSITES}]}:0. Scanning with text_table.failure. [SharedPool-Worker-4] | 2015-04-17 15:39:47.905000 | 127.0.0.1 | 17803
Enqueuing response to /127.0.0.1 [SharedPool-Worker-1] | 2015-04-17 15:39:47.905000 | 127.0.0.3 | 2372
Candidate index mean cardinalities are CompositesIndexOnRegular{columnDefs=[ColumnDefinition{name=value, type=org.apache.cassandra.db.marshal.Int32Type, kind=REGULAR, componentIndex=1, indexName=failure, indexType=COMPOSITES}]}:0. Scanning with text_table.failure. [SharedPool-Worker-4] | 2015-04-17 15:39:47.905000 | 127.0.0.1 | 18066
Sending message to /127.0.0.1 [WRITE-/127.0.0.1] | 2015-04-17 15:39:47.905000 | 127.0.0.3 | 2780
Message received from /127.0.0.3 [Thread-3] | 2015-04-17 15:39:47.906000 | 127.0.0.1 | 19015
Processing response from /127.0.0.3 [SharedPool-Worker-6] | 2015-04-17 15:39:47.906000 | 127.0.0.1 | 19268
Executing single-partition query on text_table.failure [SharedPool-Worker-4] | 2015-04-17 15:39:47.908000 | 127.0.0.1 | 21200
Acquiring sstable references [SharedPool-Worker-4] | 2015-04-17 15:39:47.908000 | 127.0.0.1 | 21335
Merging memtable tombstones [SharedPool-Worker-4] | 2015-04-17 15:39:47.908000 | 127.0.0.1 | 21449
Skipped 0/0 non-slice-intersecting sstables, included 0 due to tombstones [SharedPool-Worker-4] | 2015-04-17 15:39:47.908000 | 127.0.0.1 | 21593
Scanned 0 rows and matched 0 [SharedPool-Worker-4] | 2015-04-17 15:39:47.909000 | 127.0.0.1 | 21802
Request complete | 2015-04-17 15:39:47.909261 | 127.0.0.1 | 22261
cqlsh>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment