You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2022/08/26 16:27:39 UTC
[GitHub] [cassandra] jacek-lewandowski commented on a diff in pull request #1804: CASSANDRA-17819: Fix resetting the schema
jacek-lewandowski commented on code in PR #1804:
URL: https://github.com/apache/cassandra/pull/1804#discussion_r956211168
##########
test/distributed/org/apache/cassandra/distributed/test/SchemaTest.java:
##########
@@ -95,21 +98,37 @@ private void selectSilent(Cluster cluster, String name)
@Test
public void schemaReset() throws Throwable
{
+ CassandraRelevantProperties.MIGRATION_DELAY.setLong(10000);
+ CassandraRelevantProperties.SCHEMA_PULL_INTERVAL.setLong(10000);
try (Cluster cluster = init(Cluster.build(2).withConfig(cfg -> cfg.with(Feature.GOSSIP, Feature.NETWORK)).start()))
{
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk INT PRIMARY KEY, v TEXT)");
assertTrue(cluster.get(1).callOnInstance(() -> Schema.instance.getTableMetadata(KEYSPACE, "tbl") != null));
assertTrue(cluster.get(2).callOnInstance(() -> Schema.instance.getTableMetadata(KEYSPACE, "tbl") != null));
+ // now we have a table tbl in the schema of both nodes
+
cluster.get(2).shutdown().get();
- // when schema is removed and there is no other node to fetch it from, node 1 should be left with clean schema
- cluster.get(1).runOnInstance(() -> Schema.instance.resetLocalSchema());
+ // when there is no node to fetch the schema from, reset local schema should immediately fail
Review Comment:
AFAIU it worked in the way that if we don't get a schema from some other node, we will be left in an inconsistent state, where we have `Keyspace` instances for keyspaces which are missing in the local schema. We would have to restart the node in such case. Also if some keyspaces were modified on the other node in the meantime, say a table was dropped - that table will not be dropped on the node were we called reset because from that node's view point, nothing has been dropped, and the stale data files will be left.
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org