Skip to content

Commit 0c2d619

Browse files
authored
CNDB-14847 CC5 Restore SSTableFormat.requireComponents method (#1890)
### What is the issue Fixes CNDB-14847, restoring `SSTableFormat.requiredComponents` method ### What does this PR fix and why was it fixed Restores `SSTableFormat.requiredComponents` method to provide a list of expected components used in CNDB.
1 parent e20c42b commit 0c2d619

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

src/java/org/apache/cassandra/io/sstable/SSTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ public synchronized void reloadComponentsFromTOC(Tracker tracker)
397397
try
398398
{
399399
Set<Component> tocComponents = TOCComponent.loadTOC(descriptor);
400-
Set<Component> requiredComponents = descriptor.getFormat().primaryComponents();
400+
Set<Component> requiredComponents = descriptor.getFormat().requiredComponents();
401401
if (!tocComponents.containsAll(requiredComponents))
402402
{
403403
logger.error("Cannot reload components from read TOC file for {}; the TOC does not contain all the required components for the sstable type and is like corrupted (components in TOC: {}, required by sstable format: {})",

src/java/org/apache/cassandra/io/sstable/format/SSTableFormat.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public interface SSTableFormat<R extends SSTableReader, W extends SSTableWriter>
6060
Set<Component> allComponents();
6161

6262

63+
Set<Component> requiredComponents();
64+
6365
Set<Component> primaryComponents();
6466

6567
/**

src/java/org/apache/cassandra/io/sstable/format/big/BigFormat.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ public static class Types extends SSTableFormat.Components.Types
9797
FILTER,
9898
STATS);
9999

100+
// Used by CNDB, preserved from CC 4.0
101+
private static final Set<Component> REQUIRED_COMPONENTS = ImmutableSet.of(DATA,
102+
PRIMARY_INDEX,
103+
STATS);
104+
100105
private static final Set<Component> PRIMARY_COMPONENTS = ImmutableSet.of(DATA,
101106
PRIMARY_INDEX);
102107

@@ -171,6 +176,12 @@ public Set<Component> allComponents()
171176
return Components.ALL_COMPONENTS;
172177
}
173178

179+
@Override
180+
public Set<Component> requiredComponents()
181+
{
182+
return Components.REQUIRED_COMPONENTS;
183+
}
184+
174185
@Override
175186
public Set<Component> primaryComponents()
176187
{

src/java/org/apache/cassandra/io/sstable/format/bti/BtiFormat.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ public static class Types extends AbstractSSTableFormat.Components.Types
8282

8383
public final static Component ROW_INDEX = Types.ROW_INDEX.getSingleton();
8484

85+
// Used by CNDB, preserved from CC 4.0
86+
private static final Set<Component> REQUIRED_COMPONENTS = ImmutableSet.of(DATA,
87+
PARTITION_INDEX,
88+
ROW_INDEX,
89+
STATS);
90+
8591
private final static Set<Component> PRIMARY_COMPONENTS = ImmutableSet.of(DATA,
8692
PARTITION_INDEX);
8793

@@ -158,6 +164,12 @@ public BtiTableReaderFactory getReaderFactory()
158164
return readerFactory;
159165
}
160166

167+
@Override
168+
public Set<Component> requiredComponents()
169+
{
170+
return Components.REQUIRED_COMPONENTS;
171+
}
172+
161173
@Override
162174
public Set<Component> primaryComponents()
163175
{

0 commit comments

Comments
 (0)