Skip to content

CASSANDRA-21333: Write zero delta when localDeletionTime overflows an int - #5144

Open
cheeeee wants to merge 1 commit into
apache:trunkfrom
cheeeee:CASSANDRA-21333-v2-trunk
Open

CASSANDRA-21333: Write zero delta when localDeletionTime overflows an int#5144
cheeeee wants to merge 1 commit into
apache:trunkfrom
cheeeee:CASSANDRA-21333-v2-trunk

Conversation

@cheeeee

@cheeeee cheeeee commented Sep 10, 2026

Copy link
Copy Markdown

Status: changes requested — not ready to merge

The published zero-delta encoding and timestamp-only LIVE detection can conflate valid minimum-timestamp tombstones with LIVE. A format-preserving correction is in preparation.

Verification correction

Earlier descriptions overstated correctness and/or test coverage. Those claims are withdrawn. AI-assisted source review has been performed; this is not maintainer approval. Previously mixed build artifacts are not accepted as verification evidence. Corrective changes and clean, targeted verification are in progress; the published head has not yet been replaced.

Published head under review: 02593004aa9d497243304ca30d9b7eec540daa64.

…1333)

When a row has multiple complex columns but only a subset are updated,
the untouched columns carry DeletionTime.LIVE as their complex deletion.
DeletionTime.LIVE has localDeletionTime=Long.MAX_VALUE, which causes
SerializationHeader.writeDeletionTime to overflow the 32-bit delta
encoding (Long.MAX_VALUE - minLocalDeletionTime doesn't fit in an int).
This produced corrupted localDeletionTimes in sstables that trigger
exceptions during compaction when corrupted_tombstone_strategy is set
to exception.

This patch:
1. SerializationHeader: when dt.isLive(), write a zero delta
   (writeLocalDeletionTime(stats.minLocalDeletionTime)) and compute serialized
   size accordingly.
2. Read-side compatibility: in readDeletionTime (both allocating and reusable
   variants), recognize LIVE by markedAt == Long.MIN_VALUE and return
   DeletionTime.LIVE / reuse.resetLive(), cleanly handling both fixed sstables
   and legacy broken sstables.
3. Unit tests in SerializationHeaderTest verifying round-trip and backward
   compatibility.

Fixes: CASSANDRA-21333
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant