Skip to content

Commit

Permalink
SQUASH – delete SSTableHeaderFix altogether, BigFormat.earliest_suppo…
Browse files Browse the repository at this point in the history
…rted_version applies to both online and offline
  • Loading branch information
michaelsembwever committed Dec 6, 2024
1 parent c19e65f commit 406d782
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 1,963 deletions.
918 changes: 0 additions & 918 deletions src/java/org/apache/cassandra/io/sstable/SSTableHeaderFix.java

This file was deleted.

61 changes: 0 additions & 61 deletions src/java/org/apache/cassandra/tools/StandaloneScrubber.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.apache.cassandra.db.lifecycle.LifecycleTransaction;
import org.apache.cassandra.io.sstable.Component;
import org.apache.cassandra.io.sstable.Descriptor;
import org.apache.cassandra.io.sstable.SSTableHeaderFix;
import org.apache.cassandra.io.sstable.format.SSTableReader;
import org.apache.cassandra.io.util.File;
import org.apache.cassandra.schema.Schema;
Expand Down Expand Up @@ -129,66 +128,6 @@ public static void main(String args[])
}
System.out.println(String.format("Pre-scrub sstables snapshotted into snapshot %s", snapshotName));

if (options.headerFixMode != Options.HeaderFixMode.OFF)
{
// Run the frozen-UDT checks _before_ the sstables are opened

List<String> logOutput = new ArrayList<>();

SSTableHeaderFix.Builder headerFixBuilder = SSTableHeaderFix.builder()
.logToList(logOutput)
.schemaCallback(() -> Schema.instance::getTableMetadata);
if (options.headerFixMode == Options.HeaderFixMode.VALIDATE)
headerFixBuilder = headerFixBuilder.dryRun();

for (Pair<Descriptor, Set<Component>> p : listResult)
headerFixBuilder.withPath(p.left.fileFor(Component.DATA).toPath());

SSTableHeaderFix headerFix = headerFixBuilder.build();
try
{
headerFix.execute();
}
catch (Exception e)
{
JVMStabilityInspector.inspectThrowable(e);
if (options.debug)
e.printStackTrace(System.err);
}

if (headerFix.hasChanges() || headerFix.hasError())
logOutput.forEach(System.out::println);

if (headerFix.hasError())
{
System.err.println("Errors in serialization-header detected, aborting.");
System.exit(1);
}

switch (options.headerFixMode)
{
case VALIDATE_ONLY:
case FIX_ONLY:
System.out.printf("Not continuing with scrub, since '--%s %s' was specified.%n",
HEADERFIX_OPTION,
options.headerFixMode.asCommandLineOption());
System.exit(0);
case VALIDATE:
if (headerFix.hasChanges())
{
System.err.printf("Unfixed, but fixable errors in serialization-header detected, aborting. " +
"Use a non-validating mode ('-e %s' or '-e %s') for --%s%n",
Options.HeaderFixMode.FIX.asCommandLineOption(),
Options.HeaderFixMode.FIX_ONLY.asCommandLineOption(),
HEADERFIX_OPTION);
System.exit(2);
}
break;
case FIX:
break;
}
}

List<SSTableReader> sstables = new ArrayList<>();

// Open sstables
Expand Down
Loading

0 comments on commit 406d782

Please sign in to comment.