beobal commented on code in PR #3287:
URL: https://github.com/apache/cassandra/pull/3287#discussion_r1589426767
##########
src/java/org/apache/cassandra/schema/DistributedSchema.java:
##########
@@ -114,16 +114,29 @@ public KeyspaceMetadata getKeyspaceMetadata(String
keyspace)
public static DistributedSchema fromSystemTables(Keyspaces keyspaces,
Set<String> knownDatacenters)
{
if
(!keyspaces.containsKeyspace(SchemaConstants.METADATA_KEYSPACE_NAME))
- keyspaces =
keyspaces.withAddedOrReplaced(Keyspaces.of(DistributedMetadataLogKeyspace.initialMetadata(knownDatacenters),
-
TraceKeyspace.metadata(),
-
SystemDistributedKeyspace.metadata(),
-
AuthKeyspace.metadata()));
+ {
+ Keyspaces kss =
Keyspaces.of(DistributedMetadataLogKeyspace.initialMetadata(knownDatacenters),
+ TraceKeyspace.metadata(),
+ SystemDistributedKeyspace.metadata(),
+ AuthKeyspace.metadata());
+ for (KeyspaceMetadata ksm : keyspaces) // on disk keyspaces
+ kss = kss.withAddedOrUpdated(kss.get(ksm.name)
+ .map(k -> merged(k, ksm))
+ .orElse(ksm));
+ keyspaces = kss;
+ }
return new DistributedSchema(keyspaces, Epoch.UPGRADE_GOSSIP);
}
- public void initializeKeyspaceInstances(DistributedSchema prev)
+ private static KeyspaceMetadata merged(KeyspaceMetadata ksm1,
KeyspaceMetadata ksm2)
Review Comment:
nit: would it make sense to name these `newKs/oldKs` or similar? Not a big
deal really as there's only the one usage of the method for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]