-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Replace internal usages of 'master' term in 'server/src/internalClusterTest' directory #2521
Changes from 1 commit
66deace
370fa9a
1701c53
f69155f
8cb690c
fd5ad03
d41b1ed
f5fde30
05ef18c
9fbc35f
6b4773f
02af408
87d07e5
22d2c3e
2176adf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,9 +204,9 @@ public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception | |
String value = "none"; | ||
while (shutdown.get() == false) { | ||
value = "none".equals(value) ? "all" : "none"; | ||
final String nonMasterNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames())); | ||
final String nonClusterManagerNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames())); | ||
assertAcked( | ||
client(nonMasterNode).admin() | ||
client(nonClusterManagerNode).admin() | ||
.cluster() | ||
.prepareUpdateSettings() | ||
.setPersistentSettings(Settings.builder().put(CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), value)) | ||
|
@@ -235,8 +235,8 @@ public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception | |
} | ||
|
||
assertBusy(() -> { | ||
final String nonMasterNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames())); | ||
final String claimedMasterName = internalCluster().getMasterName(nonMasterNode); | ||
final String nonClusterManagerNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames())); | ||
final String claimedMasterName = internalCluster().getMasterName(nonClusterManagerNode); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed the variable name. 😄 |
||
assertThat(claimedMasterName, not(equalTo(masterName))); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -309,11 +309,11 @@ public void testThreeNodesNoMasterBlock() throws Exception { | |
assertHitCount(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(), 100); | ||
} | ||
|
||
List<String> nonMasterNodes = new ArrayList<>( | ||
List<String> nonClusterManagerNodes = new ArrayList<>( | ||
Sets.difference(Sets.newHashSet(internalCluster().getNodeNames()), Collections.singleton(internalCluster().getMasterName())) | ||
); | ||
Settings nonMasterDataPathSettings1 = internalCluster().dataPathSettings(nonMasterNodes.get(0)); | ||
Settings nonMasterDataPathSettings2 = internalCluster().dataPathSettings(nonMasterNodes.get(1)); | ||
Settings nonMasterDataPathSettings1 = internalCluster().dataPathSettings(nonClusterManagerNodes.get(0)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Variable name change for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed the variable name. 👍 |
||
Settings nonMasterDataPathSettings2 = internalCluster().dataPathSettings(nonClusterManagerNodes.get(1)); | ||
internalCluster().stopRandomNonMasterNode(); | ||
internalCluster().stopRandomNonMasterNode(); | ||
|
||
|
@@ -393,7 +393,7 @@ public void onFailure(String source, Exception e) { | |
// otherwise persistent setting (which is a part of accepted state on old master) will be propagated to other nodes | ||
logger.debug("--> wait for master to be elected in major partition"); | ||
assertBusy(() -> { | ||
DiscoveryNode masterNode = internalCluster().client(randomFrom(otherNodes)) | ||
DiscoveryNode clusterManagerNode = internalCluster().client(randomFrom(otherNodes)) | ||
.admin() | ||
.cluster() | ||
.prepareState() | ||
|
@@ -402,8 +402,8 @@ public void onFailure(String source, Exception e) { | |
.getState() | ||
.nodes() | ||
.getMasterNode(); | ||
assertThat(masterNode, notNullValue()); | ||
assertThat(masterNode.getName(), not(equalTo(master))); | ||
assertThat(clusterManagerNode, notNullValue()); | ||
assertThat(clusterManagerNode.getName(), not(equalTo(master))); | ||
}); | ||
|
||
partition.stopDisrupting(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -479,20 +479,20 @@ public boolean clearData(String nodeName) { | |
|
||
public void testNoInitialBootstrapAfterDetach() throws Exception { | ||
internalCluster().setBootstrapMasterNodeIndex(0); | ||
String masterNode = internalCluster().startMasterOnlyNode(); | ||
Settings masterNodeDataPathSettings = internalCluster().dataPathSettings(masterNode); | ||
String clusterManagerNode = internalCluster().startMasterOnlyNode(); | ||
Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); | ||
internalCluster().stopCurrentMasterNode(); | ||
|
||
final Environment environment = TestEnvironment.newEnvironment( | ||
Settings.builder().put(internalCluster().getDefaultSettings()).put(masterNodeDataPathSettings).build() | ||
Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManagerNodeDataPathSettings).build() | ||
); | ||
detachCluster(environment); | ||
|
||
String node = internalCluster().startMasterOnlyNode( | ||
Settings.builder() | ||
// give the cluster 2 seconds to elect the master (it should not) | ||
.put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "2s") | ||
.put(masterNodeDataPathSettings) | ||
.put(clusterManagerNodeDataPathSettings) | ||
.build() | ||
); | ||
|
||
|
@@ -504,8 +504,8 @@ public void testNoInitialBootstrapAfterDetach() throws Exception { | |
|
||
public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata() throws Exception { | ||
internalCluster().setBootstrapMasterNodeIndex(0); | ||
String masterNode = internalCluster().startMasterOnlyNode(); | ||
Settings masterNodeDataPathSettings = internalCluster().dataPathSettings(masterNode); | ||
String clusterManagerNode = internalCluster().startMasterOnlyNode(); | ||
Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); | ||
ClusterUpdateSettingsRequest req = new ClusterUpdateSettingsRequest().persistentSettings( | ||
Settings.builder().put(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey(), "1234kb") | ||
); | ||
|
@@ -514,17 +514,17 @@ public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata( | |
ClusterState state = internalCluster().client().admin().cluster().prepareState().execute().actionGet().getState(); | ||
assertThat(state.metadata().persistentSettings().get(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey()), equalTo("1234kb")); | ||
|
||
ensureReadOnlyBlock(false, masterNode); | ||
ensureReadOnlyBlock(false, clusterManagerNode); | ||
|
||
internalCluster().stopCurrentMasterNode(); | ||
|
||
final Environment environment = TestEnvironment.newEnvironment( | ||
Settings.builder().put(internalCluster().getDefaultSettings()).put(masterNodeDataPathSettings).build() | ||
Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManagerNodeDataPathSettings).build() | ||
); | ||
detachCluster(environment); | ||
unsafeBootstrap(environment); // read-only block will remain same as one before bootstrap, in this case it is false | ||
|
||
String masterNode2 = internalCluster().startMasterOnlyNode(masterNodeDataPathSettings); | ||
String masterNode2 = internalCluster().startMasterOnlyNode(clusterManagerNodeDataPathSettings); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed the variable name. 👍 |
||
ensureGreen(); | ||
ensureReadOnlyBlock(false, masterNode2); | ||
|
||
|
@@ -534,8 +534,8 @@ public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata( | |
|
||
public void testUnsafeBootstrapWithApplyClusterReadOnlyBlockAsFalse() throws Exception { | ||
internalCluster().setBootstrapMasterNodeIndex(0); | ||
String masterNode = internalCluster().startMasterOnlyNode(); | ||
Settings masterNodeDataPathSettings = internalCluster().dataPathSettings(masterNode); | ||
String clusterManagerNode = internalCluster().startMasterOnlyNode(); | ||
Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); | ||
ClusterUpdateSettingsRequest req = new ClusterUpdateSettingsRequest().persistentSettings( | ||
Settings.builder().put(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey(), "1234kb") | ||
); | ||
|
@@ -544,18 +544,18 @@ public void testUnsafeBootstrapWithApplyClusterReadOnlyBlockAsFalse() throws Exc | |
ClusterState state = internalCluster().client().admin().cluster().prepareState().execute().actionGet().getState(); | ||
assertThat(state.metadata().persistentSettings().get(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey()), equalTo("1234kb")); | ||
|
||
ensureReadOnlyBlock(false, masterNode); | ||
ensureReadOnlyBlock(false, clusterManagerNode); | ||
|
||
internalCluster().stopCurrentMasterNode(); | ||
|
||
final Environment environment = TestEnvironment.newEnvironment( | ||
Settings.builder().put(internalCluster().getDefaultSettings()).put(masterNodeDataPathSettings).build() | ||
Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManagerNodeDataPathSettings).build() | ||
); | ||
unsafeBootstrap(environment, false, false); | ||
|
||
String masterNode2 = internalCluster().startMasterOnlyNode(masterNodeDataPathSettings); | ||
String clusterManagerNode2 = internalCluster().startMasterOnlyNode(clusterManagerNodeDataPathSettings); | ||
ensureGreen(); | ||
ensureReadOnlyBlock(false, masterNode2); | ||
ensureReadOnlyBlock(false, clusterManagerNode2); | ||
|
||
state = internalCluster().client().admin().cluster().prepareState().execute().actionGet().getState(); | ||
assertThat(state.metadata().settings().get(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey()), equalTo("1234kb")); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the variable
masterName
need to change as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @VachaShah, thank you so much for your review! You are so careful 👍😁! Yes.. it needs to be changed. I will search for the "master" word completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally I did another scan. The variable name
masterName
has been changed. 👍