This is an automated email from the ASF dual-hosted git repository.
samt pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new db94321d71 Support downgrading after CMS is initialized
db94321d71 is described below
commit db94321d71b4e79860f2e381cff558ec436e247f
Author: Sam Tunnicliffe <[email protected]>
AuthorDate: Fri Dec 13 09:12:09 2024 +0000
Support downgrading after CMS is initialized
Patch by Sam Tunnicliffe; reviewed by Marcus Eriksson for
CASSANDRA-20145
---
CHANGES.txt | 2 ++
.../org/apache/cassandra/gms/GossipDigestSynVerbHandler.java | 3 ++-
.../org/apache/cassandra/tcm/compatibility/GossipHelper.java | 10 +++++++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index 842d8b0d94..f50d0b2f39 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
5.1
+ * Support downgrading after CMS is initialized (CASSANDRA-20145)
+ * Deprecate IEndpointSnitch (CASSANDRA-19488)
* Check presence of a snapshot in a case-insensitive manner on macOS platform
to prevent hardlinking failures (CASSANDRA-20146)
* Enable JMX server configuration to be in cassandra.yaml (CASSANDRA-11695)
* Parallelized UCS compactions (CASSANDRA-18802)
diff --git a/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java
b/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java
index 50cba9f90f..93a8252a98 100644
--- a/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java
+++ b/src/java/org/apache/cassandra/gms/GossipDigestSynVerbHandler.java
@@ -64,7 +64,8 @@ public class GossipDigestSynVerbHandler extends
GossipVerbHandler<GossipDigestSy
return;
}
- if (gDigestMessage.metadataId !=
ClusterMetadata.current().metadataIdentifier)
+ if (gDigestMessage.metadataId !=
ClusterMetadata.EMPTY_METADATA_IDENTIFIER
+ && gDigestMessage.metadataId !=
ClusterMetadata.current().metadataIdentifier)
{
logger.warn("Cluster metadata identifier mismatch from {} {}!={}",
from, gDigestMessage.metadataId, ClusterMetadata.current().metadataIdentifier);
return;
diff --git a/src/java/org/apache/cassandra/tcm/compatibility/GossipHelper.java
b/src/java/org/apache/cassandra/tcm/compatibility/GossipHelper.java
index 8f4861cc17..31a20d0bd0 100644
--- a/src/java/org/apache/cassandra/tcm/compatibility/GossipHelper.java
+++ b/src/java/org/apache/cassandra/tcm/compatibility/GossipHelper.java
@@ -51,6 +51,8 @@ import org.apache.cassandra.gms.TokenSerializer;
import org.apache.cassandra.gms.VersionedValue;
import org.apache.cassandra.locator.InetAddressAndPort;
import org.apache.cassandra.schema.DistributedSchema;
+import org.apache.cassandra.schema.Keyspaces;
+import org.apache.cassandra.schema.SchemaConstants;
import org.apache.cassandra.schema.SchemaKeyspace;
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.tcm.ClusterMetadata;
@@ -275,9 +277,15 @@ public class GossipHelper
public static ClusterMetadata emptyWithSchemaFromSystemTables(Set<String>
allKnownDatacenters)
{
+ // If this instance was previously upgraded then subsequently
downgraded, the metadata keyspace may have been
+ // added to system_schema tables. If so, don't include it in the
initial schema as this will cause it to be
+ // incorrectly configured with the global partitioner. It will be
created afresh from
+ // DistributedMetadataLogKeyspace.initialMetadata.
+ Keyspaces keyspaces = SchemaKeyspace.fetchNonSystemKeyspaces()
+ .filter(k ->
!k.name.equals(SchemaConstants.METADATA_KEYSPACE_NAME));
return new ClusterMetadata(Epoch.UPGRADE_STARTUP,
DatabaseDescriptor.getPartitioner(),
-
DistributedSchema.fromSystemTables(SchemaKeyspace.fetchNonSystemKeyspaces(),
allKnownDatacenters),
+
DistributedSchema.fromSystemTables(keyspaces, allKnownDatacenters),
Directory.EMPTY,
new
TokenMap(DatabaseDescriptor.getPartitioner()),
DataPlacements.empty(),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]