[ 
https://issues.apache.org/jira/browse/CASSANDRA-21516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18096303#comment-18096303
 ] 

Caleb Rackliffe commented on CASSANDRA-21516:
---------------------------------------------

CI for the [5.0 patch|https://github.com/apache/cassandra/pull/4938] looks 
clean (modulo a couple unrelated flakes).

> SAI Component Checksum Validation Should be Segment-Aware
> ---------------------------------------------------------
>
>                 Key: CASSANDRA-21516
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21516
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: Feature/SAI
>            Reporter: Caleb Rackliffe
>            Assignee: Caleb Rackliffe
>            Priority: Normal
>             Fix For: 6.x, 7.x, 5.x
>
>         Attachments: ci_summary.html, result_details.tar.gz
>
>
> SAI index components are buffered in memory and then flushed to disk in 
> segments during index builds and compactions. Each segment writes its own 
> checksum. However, the underlying checksum validation logic assumes single 
> segments, a major oversight. This is fairly easy to reproduce. Throw the 
> following test in {{SegmentFlushTest}}:
> {noformat}
> @Test
> public void multiSegmentBalancedTreeFailsPerIndexValidation() throws 
> IOException
> {
>     Path tmpDir = Files.createTempDirectory("SegmentFlushTest");
>     IndexDescriptor indexDescriptor = IndexDescriptor.create(new 
> Descriptor(new File(tmpDir.toFile()), "ks", "cf", new 
> SequenceBasedSSTableId(1)), Murmur3Partitioner.instance, 
> SAITester.EMPTY_COMPARATOR);
>     ColumnMetadata column = ColumnMetadata.regularColumn("sai", "internal", 
> "ts", TimestampType.instance);
>     StorageAttachedIndex index = SAITester.createMockIndex(column);
>     SSTableIndexWriter writer = new SSTableIndexWriter(indexDescriptor, 
> index, V1OnDiskFormat.SEGMENT_BUILD_MEMORY_LIMITER, () -> true);
>     List<DecoratedKey> keys = Arrays.asList(dk("1"), dk("2"));
>     Collections.sort(keys);
>     writer.addRow(SAITester.TEST_FACTORY.create(keys.get(0)), 
> createRow(column, TimestampType.instance.decompose(new Date(1_000L))), 0L);
>     writer.addRow(SAITester.TEST_FACTORY.create(keys.get(1)), 
> createRow(column, TimestampType.instance.decompose(new Date(2_000L))), 
> SegmentBuilder.LAST_VALID_SEGMENT_ROW_ID + 1);
>     writer.complete(Stopwatch.createStarted());
>     // TODO: Should not throw, but does...
>     indexDescriptor.validatePerIndexComponents(index.termType(), 
> index.identifier(), IndexValidation.CHECKSUM, true, true);
> }
> {noformat}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to