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/10/20 00:03:24 UTC
[GitHub] [cassandra] sarankk opened a new pull request, #1931: CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC
sarankk opened a new pull request, #1931:
URL: https://github.com/apache/cassandra/pull/1931
During expansion by DC, when we issue nodetool/rebuild from new dc to rebuild data from other DCs. If src-dc is not passed explicitly, then C* tries to rebuild the data from the same (new) dc.
We don’t exclude other nodes in the same DC. Only down sources and the local node itself are excluded.
```
// We're filtering out local node and down sources
addSourceFilter(new RangeStreamer.FailureDetectorSourceFilter(failureDetector));
addSourceFilter(new RangeStreamer.ExcludeLocalNodeFilter());
```
We should fix nodetool/rebuild to exclude the local DC (from where we’re executing the command) while issuing nodetool/rebuild without passing src dc
--
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
[GitHub] [cassandra] yifan-c commented on a diff in pull request #1931: CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC
Posted by GitBox <gi...@apache.org>.
yifan-c commented on code in PR #1931:
URL: https://github.com/apache/cassandra/pull/1931#discussion_r1012244553
##########
src/java/org/apache/cassandra/service/StorageServiceMBean.java:
##########
@@ -769,9 +769,22 @@ default int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion,
* @param keyspace Name of the keyspace which to rebuild or null to rebuild all keyspaces.
* @param tokens Range of tokens to rebuild or null to rebuild all token ranges. In the format of:
* "(start_token_1,end_token_1],(start_token_2,end_token_2],...(start_token_n,end_token_n]"
+ * @param specificSources list of sources that can be used for rebuilding. Mostly other nodes in the cluster.
Review Comment:
nit: `list of sources that can be used for rebuilding. Must be other nodes in the cluster. The format of the string is comma separated values.`
##########
src/java/org/apache/cassandra/service/StorageServiceMBean.java:
##########
@@ -769,9 +769,22 @@ default int upgradeSSTables(String keyspaceName, boolean excludeCurrentVersion,
* @param keyspace Name of the keyspace which to rebuild or null to rebuild all keyspaces.
* @param tokens Range of tokens to rebuild or null to rebuild all token ranges. In the format of:
* "(start_token_1,end_token_1],(start_token_2,end_token_2],...(start_token_n,end_token_n]"
+ * @param specificSources list of sources that can be used for rebuilding. Mostly other nodes in the cluster.
*/
public void rebuild(String sourceDc, String keyspace, String tokens, String specificSources);
+ /**
+ * Same as {@link #rebuild(String)}, but only for specified keyspace and ranges. It excludes local data center nodes
+ *
+ * @param sourceDc Name of DC from which to select sources for streaming or null to pick any node
+ * @param keyspace Name of the keyspace which to rebuild or null to rebuild all keyspaces.
+ * @param tokens Range of tokens to rebuild or null to rebuild all token ranges. In the format of:
+ * "(start_token_1,end_token_1],(start_token_2,end_token_2],...(start_token_n,end_token_n]"
+ * @param specificSources list of sources that can be used for rebuilding. Mostly other nodes in the cluster.
+ * @param excludeLocalDatacenterNodes Flag to indicate whether local data center nodes should be excluded as a source for streaming.
Review Comment:
nit: `... be excluded as sources for streaming.`
--
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
[GitHub] [cassandra] frankgh commented on a diff in pull request #1931: CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC
Posted by GitBox <gi...@apache.org>.
frankgh commented on code in PR #1931:
URL: https://github.com/apache/cassandra/pull/1931#discussion_r1000035900
##########
src/java/org/apache/cassandra/service/StorageService.java:
##########
@@ -1290,7 +1295,18 @@ public void rebuild(String sourceDc, String keyspace, String tokens, String spec
throw new IllegalStateException("Node is still rebuilding. Check nodetool netstats.");
}
+<<<<<<< Updated upstream
Review Comment:
looks like there are some merge issues
--
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
[GitHub] [cassandra] yifan-c commented on a diff in pull request #1931: CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC
Posted by GitBox <gi...@apache.org>.
yifan-c commented on code in PR #1931:
URL: https://github.com/apache/cassandra/pull/1931#discussion_r1015813829
##########
test/unit/org/apache/cassandra/service/StorageServiceTest.java:
##########
@@ -298,12 +298,21 @@ public void testBatchSizeWarnThresholdInKiB()
storageService.setBatchSizeWarnThresholdInKiB(2 * 1024 * 1024);
fail("Should have received an IllegalArgumentException batch_size_warn_threshold = 2GiB");
}
- catch (IllegalArgumentException ignored) { }
+ catch (IllegalArgumentException ignored)
+ {
+ }
Assert.assertEquals(1024, storageService.getBatchSizeWarnThresholdInKiB());
}
finally
{
storageService.setBatchSizeWarnThresholdInKiB(previousBatchSizeWarnThreshold);
}
}
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testLocalDatacenterNodesExcludedDuringRebuild()
+ {
+ StorageService service = StorageService.instance;
+ service.rebuild(DatabaseDescriptor.getLocalDataCenter(), "StorageServiceTest", null, null, true);
+ }
Review Comment:
Prefer to use
```
@Rule
ExpectedException expectedException = ExpectedException.none();
```
This way, you can assert the exception type and the exception message too.
--
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
[GitHub] [cassandra] sarankk commented on a diff in pull request #1931: CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC
Posted by GitBox <gi...@apache.org>.
sarankk commented on code in PR #1931:
URL: https://github.com/apache/cassandra/pull/1931#discussion_r1002201242
##########
src/java/org/apache/cassandra/service/StorageService.java:
##########
@@ -1290,7 +1295,18 @@ public void rebuild(String sourceDc, String keyspace, String tokens, String spec
throw new IllegalStateException("Node is still rebuilding. Check nodetool netstats.");
}
+<<<<<<< Updated upstream
Review Comment:
oh will remove those
--
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
[GitHub] [cassandra] frankgh commented on a diff in pull request #1931: CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC
Posted by GitBox <gi...@apache.org>.
frankgh commented on code in PR #1931:
URL: https://github.com/apache/cassandra/pull/1931#discussion_r1015819494
##########
test/unit/org/apache/cassandra/service/StorageServiceTest.java:
##########
@@ -298,12 +298,21 @@ public void testBatchSizeWarnThresholdInKiB()
storageService.setBatchSizeWarnThresholdInKiB(2 * 1024 * 1024);
fail("Should have received an IllegalArgumentException batch_size_warn_threshold = 2GiB");
}
- catch (IllegalArgumentException ignored) { }
+ catch (IllegalArgumentException ignored)
+ {
+ }
Assert.assertEquals(1024, storageService.getBatchSizeWarnThresholdInKiB());
}
finally
{
storageService.setBatchSizeWarnThresholdInKiB(previousBatchSizeWarnThreshold);
}
}
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testLocalDatacenterNodesExcludedDuringRebuild()
+ {
+ StorageService service = StorageService.instance;
+ service.rebuild(DatabaseDescriptor.getLocalDataCenter(), "StorageServiceTest", null, null, true);
+ }
Review Comment:
or we can use `org.assertj.core.api.Assertions.assertThrows(IllegalArgumentException.class, () -> service.rebuild(DatabaseDescriptor.getLocalDataCenter(), "StorageServiceTest", null, null, true));`
:)
--
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
[GitHub] [cassandra] yifan-c commented on a diff in pull request #1931: CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC
Posted by GitBox <gi...@apache.org>.
yifan-c commented on code in PR #1931:
URL: https://github.com/apache/cassandra/pull/1931#discussion_r1015913522
##########
test/unit/org/apache/cassandra/service/StorageServiceTest.java:
##########
@@ -298,12 +298,21 @@ public void testBatchSizeWarnThresholdInKiB()
storageService.setBatchSizeWarnThresholdInKiB(2 * 1024 * 1024);
fail("Should have received an IllegalArgumentException batch_size_warn_threshold = 2GiB");
}
- catch (IllegalArgumentException ignored) { }
+ catch (IllegalArgumentException ignored)
+ {
+ }
Assert.assertEquals(1024, storageService.getBatchSizeWarnThresholdInKiB());
}
finally
{
storageService.setBatchSizeWarnThresholdInKiB(previousBatchSizeWarnThreshold);
}
}
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testLocalDatacenterNodesExcludedDuringRebuild()
+ {
+ StorageService service = StorageService.instance;
+ service.rebuild(DatabaseDescriptor.getLocalDataCenter(), "StorageServiceTest", null, null, true);
+ }
Review Comment:
Right, but the point is to assert the exception message too. `AssertJ` api can also do it.
--
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
Re: [PR] CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC [cassandra]
Posted by "sarankk (via GitHub)" <gi...@apache.org>.
sarankk closed pull request #1931: CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC
URL: https://github.com/apache/cassandra/pull/1931
--
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
[GitHub] [cassandra] frankgh commented on a diff in pull request #1931: CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC
Posted by GitBox <gi...@apache.org>.
frankgh commented on code in PR #1931:
URL: https://github.com/apache/cassandra/pull/1931#discussion_r1015945260
##########
test/unit/org/apache/cassandra/service/StorageServiceTest.java:
##########
@@ -298,12 +298,21 @@ public void testBatchSizeWarnThresholdInKiB()
storageService.setBatchSizeWarnThresholdInKiB(2 * 1024 * 1024);
fail("Should have received an IllegalArgumentException batch_size_warn_threshold = 2GiB");
}
- catch (IllegalArgumentException ignored) { }
+ catch (IllegalArgumentException ignored)
+ {
+ }
Assert.assertEquals(1024, storageService.getBatchSizeWarnThresholdInKiB());
}
finally
{
storageService.setBatchSizeWarnThresholdInKiB(previousBatchSizeWarnThreshold);
}
}
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testLocalDatacenterNodesExcludedDuringRebuild()
+ {
+ StorageService service = StorageService.instance;
+ service.rebuild(DatabaseDescriptor.getLocalDataCenter(), "StorageServiceTest", null, null, true);
+ }
Review Comment:
My vote is for `assertj` . I think we've started seeing more tests in the Cassandra codebase moving to `assertj` which is great!
--
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
[GitHub] [cassandra] frankgh commented on a diff in pull request #1931: CASSANDRA-17870 nodetool/rebuild: Add flag to exclude nodes from local DC
Posted by GitBox <gi...@apache.org>.
frankgh commented on code in PR #1931:
URL: https://github.com/apache/cassandra/pull/1931#discussion_r1017213425
##########
test/unit/org/apache/cassandra/service/StorageServiceTest.java:
##########
@@ -298,12 +298,21 @@ public void testBatchSizeWarnThresholdInKiB()
storageService.setBatchSizeWarnThresholdInKiB(2 * 1024 * 1024);
fail("Should have received an IllegalArgumentException batch_size_warn_threshold = 2GiB");
}
- catch (IllegalArgumentException ignored) { }
+ catch (IllegalArgumentException ignored)
+ {
+ }
Assert.assertEquals(1024, storageService.getBatchSizeWarnThresholdInKiB());
}
finally
{
storageService.setBatchSizeWarnThresholdInKiB(previousBatchSizeWarnThreshold);
}
}
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testLocalDatacenterNodesExcludedDuringRebuild()
+ {
+ StorageService service = StorageService.instance;
+ service.rebuild(DatabaseDescriptor.getLocalDataCenter(), "StorageServiceTest", null, null, true);
+ }
Review Comment:
I believe we don't have assertThrows in the classpath :(
--
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