Skip to content

Commit 571a13b

Browse files
committed
do not serialize dropped columns to sstable header
1 parent 3885395 commit 571a13b

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

src/java/org/apache/cassandra/db/SerializationHeader.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,21 @@ public static SerializationHeader make(TableMetadata metadata, Collection<SSTabl
112112
EncodingStats.Collector stats = new EncodingStats.Collector();
113113
RegularAndStaticColumns.Builder columns = RegularAndStaticColumns.builder();
114114
// We need to order the SSTables by descending generation to be sure that we use latest column metadata.
115-
for (SSTableReader sstable : orderByDescendingGeneration(sstables))
115+
116+
Collection<SSTableReader> ssTableReaders = orderByDescendingGeneration(sstables);
117+
118+
for (SSTableReader sstable : ssTableReaders)
116119
{
117120
stats.updateTimestamp(sstable.getMinTimestamp());
118121
stats.updateLocalDeletionTime(sstable.getMinLocalDeletionTime());
119122
stats.updateTTL(sstable.getMinTTL());
120-
columns.addAll(sstable.header.columns());
123+
for (ColumnMetadata column : sstable.header.columns())
124+
{
125+
if (metadata.getDroppedColumn(column.name.bytes) == null)
126+
columns.add(column);
127+
}
121128
}
129+
122130
return new SerializationHeader(true, metadata, columns.build(), stats.get());
123131
}
124132

src/java/org/apache/cassandra/db/compaction/CursorCompactor.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,16 @@ private boolean mergeCells(int cellMergeLimit, DeletionTime activeDeletion, Live
636636
ReusableLivenessInfo cellLiveness = cellCursor.cellLiveness;
637637
DataOutputBuffer tempCellBuffer = null;
638638

639+
if (metadata().getDroppedColumn(cellCursor.cellColumn.name.bytes) != null)
640+
{
641+
for (int i = 0; i < cellMergeLimit; i++)
642+
{
643+
if (sstableCursors[i].state() == CELL_VALUE_START)
644+
sstableCursors[i].skipCellValue();
645+
}
646+
return isRowDropped;
647+
}
648+
639649
if (cellCursor.cellColumn.isComplex())
640650
throw new UnsupportedOperationException("TODO: Not ready for complex cells.");
641651
if (cellCursor.cellColumn.isCounterColumn())

0 commit comments

Comments
 (0)