David Capwell created CASSANDRA-20461:
-----------------------------------------

             Summary: SAI PK index involved in query which produced duplicate 
rows
                 Key: CASSANDRA-20461
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20461
             Project: Apache Cassandra
          Issue Type: Bug
          Components: Feature/SAI
            Reporter: David Capwell


This was found in 
org.apache.cassandra.distributed.test.cql3.SingleNodeTableWalkTest (single 
node, not multi node).

{code}
accord.utils.Property$PropertyError: Property error detected:
Seed = -257286112445818522
Examples = 1
Pure = true
Error: Unexpected results for query: SELECT * FROM ks1.tbl WHERE pk1 = false 
PER PARTITION LIMIT 84 ALLOW FILTERING
Steps: 400
Values:
        State: 
                Setup:
                CREATE KEYSPACE IF NOT EXISTS ks1 WITH replication = {'class': 
'SimpleStrategy', 'replication_factor': 1};
                CREATE TABLE ks1.tbl (
                    pk0 float,
                    pk1 boolean,
                    ck0 smallint,
                    ck1 text,
                    s0 ascii static,
                    v0 ascii,
                    v1 blob,
                    v2 frozen<tuple<frozen<tuple<float>>, int>>,
                    v3 frozen<tuple<tinyint, time, frozen<tuple<time, 
timestamp>>>>,
                    PRIMARY KEY ((pk0, pk1), ck0, ck1)
                ) WITH CLUSTERING ORDER BY (ck0 ASC, ck1 DESC)
                    AND additional_write_policy = '99p'
                    AND allow_auto_snapshot = true
                    AND bloom_filter_fp_chance = 0.01
                    AND caching = {'keys': 'NONE', 'rows_per_partition': 'ALL'}
                    AND cdc = false
                    AND comment = ''
                    AND compaction = {'base_shard_count': '1', 'class': 
'org.apache.cassandra.db.compaction.UnifiedCompactionStrategy', 
'min_sstable_size': '11815420B', 'only_purge_repaired_tombstones': 'false', 
'overlap_inclusion_method': 'TRANSITIVE', 'provide_overlapping_tombstones': 
'NONE', 'sstable_growth': '22%', 'target_sstable_size': '25780163B', 
'tombstone_threshold': '0.65081584', 'unchecked_tombstone_compaction': 'false'}
                    AND compression = {'enabled': 'false'}
                    AND memtable = 'default'
                    AND crc_check_chance = 1.0
                    AND default_time_to_live = 0
                    AND extensions = {}
                    AND gc_grace_seconds = 864000
                    AND incremental_backups = true
                    AND max_index_interval = 2048
                    AND memtable_flush_period_in_ms = 0
                    AND min_index_interval = 128
                    AND read_repair = 'BLOCKING'
                    AND speculative_retry = '99p';
                CREATE CUSTOM INDEX tbl_pk0 ON ks1.tbl(pk0) USING 
'StorageAttachedIndex';
                CREATE INDEX tbl_pk1 ON ks1.tbl(pk1) USING 'SAI';
                CREATE INDEX tbl_ck0 ON ks1.tbl(ck0) USING 'SAI';
                CREATE INDEX tbl_ck1 ON ks1.tbl(ck1) USING 'SAI';
                CREATE CUSTOM INDEX tbl_s0 ON ks1.tbl(s0) USING 
'StorageAttachedIndex';
                CREATE INDEX tbl_v0 ON ks1.tbl(v0) USING 'SAI';
                CREATE INDEX tbl_v2 ON ks1.tbl(v2) USING 'SAI';
                CREATE INDEX tbl_v3 ON ks1.tbl(v3) USING 'SAI';
{code}

{code}
History:
…
                343: SELECT * FROM ks1.tbl WHERE pk1 = false PER PARTITION 
LIMIT 84 ALLOW FILTERING -- pk1 boolean, indexed with SAI, on node1, fetch size 
10
{code}

This query failed during model validation

{code}
Caused by: java.lang.AssertionError: 
Incorrect value for row 2 column pk0: expected -6.4265106E-25 but was -18197.346
Incorrect value for row 2 column ck0: expected -32216 but was 12783
Incorrect value for row 2 column ck1: expected '杖虌繛ﮌ蘓✷谷' but was '䞃㛸ᰓꪕ彤瘀毈พ'
Incorrect value for row 2 column s0: expected 'XX8|QgQ^Ex' but was ',r|'
Incorrect value for row 2 column v0: expected 'FQz+j"b' but was null
Incorrect value for row 2 column v1: expected 0x but was 0x9a0f4583baf5365e
Incorrect value for row 2 column v2: expected null but was ((4.3819063E27), 
-1218940635)
Incorrect value for row 2 column v3: expected (90, '21:14:53.660718225', 
('13:45:05.656384085', '1997-08-22T21:36:53.522Z')) but was null
Incorrect value for row 3 column ck0: expected -11034 but was -32216
Incorrect value for row 3 column ck1: expected 'Ⳬ➸䤷᠄䱚뽷ء턷吪' but was '杖虌繛ﮌ蘓✷谷'
Incorrect value for row 3 column v0: expected '?=To1&' but was 'FQz+j"b'
Incorrect value for row 3 column v1: expected 0xf537 but was 0x
Incorrect value for row 3 column v2: expected ((-3.6912426E34), 783863128) but 
was null
Incorrect value for row 3 column v3: expected (-83, '13:42:34.221483836', 
('01:22:27.498356541', '2054-12-27T13:20:16.079Z')) but was (90, 
'21:14:53.660718225', ('13:45:05.656384085', '1997-08-22T21:36:53.522Z'))
Incorrect value for row 4 column ck0: expected -507 but was -11034
Incorrect value for row 4 column ck1: expected '魖錪࿉㘊' but was 'Ⳬ➸䤷᠄䱚뽷ء턷吪'
Incorrect value for row 4 column v0: expected '?M1D     ek9v 1K|:' but was 
'?=To1&'
Incorrect value for row 4 column v1: expected 0x845cf215b020174f65 but was 
0xf537
Incorrect value for row 4 column v2: expected ((-4.3247504E7), 1338577440) but 
was ((-3.6912426E34), 783863128)
Incorrect value for row 4 column v3: expected (34, '07:04:32.973826138', 
('22:43:20.309072090', '1982-04-13T05:42:47.689Z')) but was (-83, 
'13:42:34.221483836', ('01:22:27.498356541', '2054-12-27T13:20:16.079Z'))
Incorrect value for row 5 column ck0: expected 3235 but was -507
Incorrect value for row 5 column ck1: expected '잀ၿ⦍櫫ᛌ䟍?傇?ﺩ' but was '魖錪࿉㘊'
Incorrect value for row 5 column v0: expected '[L@' but was '?M1D       ek9v 
1K|:'
Incorrect value for row 5 column v1: expected 0x5189382e but was 
0x845cf215b020174f65
Incorrect value for row 5 column v2: expected ((2.4761327E-26), 2035532930) but 
was ((-4.3247504E7), 1338577440)
Incorrect value for row 5 column v3: expected (-25, '14:11:55.243248868', 
('03:39:01.545149118', '2053-04-18T20:12:46.089Z')) but was (34, 
'07:04:32.973826138', ('22:43:20.309072090', '1982-04-13T05:42:47.689Z'))
Incorrect value for row 6 column ck0: expected 20533 but was 3235
Incorrect value for row 6 column ck1: expected '童列羻ಌ⦭㊒ꇑ⠘' but was '잀ၿ⦍櫫ᛌ䟍?傇?ﺩ'
Incorrect value for row 6 column v0: expected null but was '[L@'
Incorrect value for row 6 column v1: expected 0x but was 0x5189382e
Incorrect value for row 6 column v2: expected ((-54660.39), 1918465942) but was 
((2.4761327E-26), 2035532930)
Incorrect value for row 6 column v3: expected (-34, '15:36:35.735704213', 
('08:18:57.550362904', '1985-01-31T10:28:25.843Z')) but was (-25, 
'14:11:55.243248868', ('03:39:01.545149118', '2053-04-18T20:12:46.089Z'))
Expected:
pk0            | pk1   | ck0    | ck1          | s0             | v0            
     | v1                   | v2                            | v3                
                                                             
-18197.346     | false | -26180 | '囇✼䮑毛'       | ',r|'         | 'VKa'       
     | 0xdf99da86b00c       | ((2.22318746E9), 552148989)   | (19, 
'15:02:36.037352007', ('11:21:35.106492676', '1981-08-11T14:56:49.353Z')) 
-18197.346     | false | 12783  | '䞃㛸ᰓꪕ彤瘀毈พ'   | ',r|'         | null          
     | 0x9a0f4583baf5365e   | ((4.3819063E27), -1218940635) | null              
                                                             
-6.4265106E-25 | false | -32216 | '杖虌繛ﮌ蘓✷谷'    | 'XX8|QgQ^Ex' | 'FQz+j"b'   
    | 0x                   | null                          | (90, 
'21:14:53.660718225', ('13:45:05.656384085', '1997-08-22T21:36:53.522Z')) 
-6.4265106E-25 | false | -11034 | 'Ⳬ➸䤷᠄䱚뽷ء턷吪' | 'XX8|QgQ^Ex' | '?=To1&'      
     | 0xf537               | ((-3.6912426E34), 783863128)  | (-83, 
'13:42:34.221483836', ('01:22:27.498356541', '2054-12-27T13:20:16.079Z'))
-6.4265106E-25 | false | -507   | '魖錪࿉㘊'       | 'XX8|QgQ^Ex' | '?M1D ek9v 
1K|:' | 0x845cf215b020174f65 | ((-4.3247504E7), 1338577440)  | (34, 
'07:04:32.973826138', ('22:43:20.309072090', '1982-04-13T05:42:47.689Z')) 
-6.4265106E-25 | false | 3235   | '잀ၿ⦍櫫ᛌ䟍?傇?ﺩ' | 'XX8|QgQ^Ex' | '[L@'         
     | 0x5189382e           | ((2.4761327E-26), 2035532930) | (-25, 
'14:11:55.243248868', ('03:39:01.545149118', '2053-04-18T20:12:46.089Z'))
-6.4265106E-25 | false | 20533  | '童列羻ಌ⦭㊒ꇑ⠘'   | 'XX8|QgQ^Ex' | null          
     | 0x                   | ((-54660.39), 1918465942)     | (-34, 
'15:36:35.735704213', ('08:18:57.550362904', '1985-01-31T10:28:25.843Z'))

Actual:
pk0            | pk1   | ck0    | ck1          | s0             | v0            
     | v1                   | v2                            | v3                
                                                             
-18197.346     | false | -26180 | '囇✼䮑毛'       | ',r|'         | 'VKa'       
     | 0xdf99da86b00c       | ((2.22318746E9), 552148989)   | (19, 
'15:02:36.037352007', ('11:21:35.106492676', '1981-08-11T14:56:49.353Z')) 
-18197.346     | false | 12783  | '䞃㛸ᰓꪕ彤瘀毈พ'   | ',r|'         | null          
     | 0x9a0f4583baf5365e   | ((4.3819063E27), -1218940635) | null              
                                                             
-18197.346     | false | 12783  | '䞃㛸ᰓꪕ彤瘀毈พ'   | ',r|'         | null          
     | 0x9a0f4583baf5365e   | ((4.3819063E27), -1218940635) | null              
                                                             
-6.4265106E-25 | false | -32216 | '杖虌繛ﮌ蘓✷谷'    | 'XX8|QgQ^Ex' | 'FQz+j"b'   
    | 0x                   | null                          | (90, 
'21:14:53.660718225', ('13:45:05.656384085', '1997-08-22T21:36:53.522Z')) 
-6.4265106E-25 | false | -11034 | 'Ⳬ➸䤷᠄䱚뽷ء턷吪' | 'XX8|QgQ^Ex' | '?=To1&'      
     | 0xf537               | ((-3.6912426E34), 783863128)  | (-83, 
'13:42:34.221483836', ('01:22:27.498356541', '2054-12-27T13:20:16.079Z'))
-6.4265106E-25 | false | -507   | '魖錪࿉㘊'       | 'XX8|QgQ^Ex' | '?M1D ek9v 
1K|:' | 0x845cf215b020174f65 | ((-4.3247504E7), 1338577440)  | (34, 
'07:04:32.973826138', ('22:43:20.309072090', '1982-04-13T05:42:47.689Z')) 
-6.4265106E-25 | false | 3235   | '잀ၿ⦍櫫ᛌ䟍?傇?ﺩ' | 'XX8|QgQ^Ex' | '[L@'         
     | 0x5189382e           | ((2.4761327E-26), 2035532930) | (-25, 
'14:11:55.243248868', ('03:39:01.545149118', '2053-04-18T20:12:46.089Z'))
-6.4265106E-25 | false | 20533  | '童列羻ಌ⦭㊒ꇑ⠘'   | 'XX8|QgQ^Ex' | null          
     | 0x                   | ((-54660.39), 1918465942)     | (-34, 
'15:36:35.735704213', ('08:18:57.550362904', '1985-01-31T10:28:25.843Z'))

        at 
org.apache.cassandra.harry.model.ASTSingleTableModel.validateOrder(ASTSingleTableModel.java:585)
{code}

The root cause is in the Actual output; it had a duplicate row!

{code}
pk0            | pk1   | ck0    | ck1          | s0             | v0            
     | v1                   | v2                            | v3                
                                                             
...
-18197.346     | false | 12783  | '䞃㛸ᰓꪕ彤瘀毈พ'   | ',r|'         | null           
    | 0x9a0f4583baf5365e   | ((4.3819063E27), -1218940635) | null               
                                                            
-18197.346     | false | 12783  | '䞃㛸ᰓꪕ彤瘀毈พ'   | ',r|'         | null           
    | 0x9a0f4583baf5365e   | ((4.3819063E27), -1218940635) | null               
                                                            
...
{code}

The repo can be found here

https://github.com/apache/cassandra/pull/3995
SHA: f97844465683cdd64d3370a6d4ea8ca8c0563b7f
Test: org.apache.cassandra.distributed.test.cql3.SingleNodeTableWalkTest
Seed: -257286112445818522



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to