Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASSANDRA-20394 – Restore SSTableHeaderFix for use with StandaloneScrubber for offline upgrade compatibility #3945

Open
wants to merge 3 commits into
base: cassandra-5.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .build/build-rat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<!-- test data -->
<exclude name="pylib/cqlshlib/test/test_authproviderhandling_config/*"/>
<exclude name="test/**/cassandra*.conf"/>
<exclude name="test/**/.keep"/>
<exclude name="test/**/*.csv"/>
<exclude name="test/**/*.txt"/>
<exclude name="test/data/**/*.adler32"/>
Expand Down
12 changes: 12 additions & 0 deletions src/java/org/apache/cassandra/db/SerializationHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,18 @@ public static class Component extends MetadataComponent
private final Map<ByteBuffer, AbstractType<?>> regularColumns;
private final EncodingStats stats;

/**
* <em>Only</em> exposed for {@link org.apache.cassandra.io.sstable.SSTableHeaderFix}.
*/
public static Component buildComponentForTools(AbstractType<?> keyType,
List<AbstractType<?>> clusteringTypes,
Map<ByteBuffer, AbstractType<?>> staticColumns,
Map<ByteBuffer, AbstractType<?>> regularColumns,
EncodingStats stats)
{
return new Component(keyType, clusteringTypes, staticColumns, regularColumns, stats);
}

private Component(AbstractType<?> keyType,
List<AbstractType<?>> clusteringTypes,
Map<ByteBuffer, AbstractType<?>> staticColumns,
Expand Down
14 changes: 14 additions & 0 deletions src/java/org/apache/cassandra/service/StartupChecks.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import org.apache.cassandra.schema.Schema;
import org.apache.cassandra.schema.SchemaConstants;
import org.apache.cassandra.schema.TableMetadata;
import org.apache.cassandra.utils.CassandraVersion;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.JavaUtils;
import org.apache.cassandra.utils.NativeLibrary;
Expand Down Expand Up @@ -133,6 +134,7 @@ public enum StartupCheckType
// always want the system keyspace check run last, as this actually loads the schema for that
// keyspace. All other checks should not require any schema initialization.
private final List<StartupCheck> DEFAULT_TESTS = ImmutableList.of(checkKernelBug1057843,
checkPreviousVersion,
checkJemalloc,
checkLz4Native,
checkValidLaunchDate,
Expand Down Expand Up @@ -249,6 +251,18 @@ public void execute(StartupChecksOptions startupChecksOptions) throws StartupExc
}
};

public static final StartupCheck checkPreviousVersion = new StartupCheck()
{
@Override
public void execute(StartupChecksOptions options) throws StartupException
{
String previousVersionString = FBUtilities.getPreviousReleaseVersionString();
if (null != previousVersionString && new CassandraVersion(previousVersionString).major <= 3)
throw new StartupException(StartupException.ERR_WRONG_DISK_STATE,
String.format("Only upgrades from >=4.0 are supported, found %s", previousVersionString));
}
};

public static final StartupCheck checkJemalloc = new StartupCheck()
{
@Override
Expand Down
Loading