-
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
Add read_only block argument to opensearch-node unsafe-bootstrap command #599
Add read_only block argument to opensearch-node unsafe-bootstrap command #599
Conversation
…p command Signed-off-by: Harmish Lakhani <harmish.lakhani@gmail.com>
✅ Gradle Wrapper Validation success f9ccaab |
✅ DCO Check Passed f9ccaab |
Signed-off-by: Harmish Lakhani <harmish.lakhani@gmail.com>
✅ DCO Check Passed 46e5796 |
✅ Gradle Wrapper Validation success 46e5796 |
✅ Gradle Precommit success 46e5796 |
start gradle check |
@harmishlakhani can you take a look at the gradle check? |
❌ DCO Check Failed e7cb4001039b8a80516ea612e693182777709950 |
✅ Gradle Wrapper Validation success e7cb4001039b8a80516ea612e693182777709950 |
✅ Gradle Precommit success e7cb4001039b8a80516ea612e693182777709950 |
…ad_only_block Signed-off-by: Harmish Lakhani <harmish.lakhani@gmail.com>
…unsafe_bootstrap_read_only_block Signed-off-by: Harmish Lakhani <harmish.lakhani@gmail.com>
e7cb400
to
6e77034
Compare
✅ DCO Check Passed 6e77034 |
✅ Gradle Wrapper Validation success 6e77034 |
✅ Gradle Precommit success 6e77034 |
start gradle check |
|
||
private void removeBlock() { | ||
if (isInternalCluster()) { | ||
Settings settings = Settings.builder().putNull(Metadata.SETTING_READ_ONLY_SETTING.getKey()).build() ; |
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.
[minor]: extra space before ";"
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.
Noted, fix will come in next commit.
@@ -235,20 +261,24 @@ public void test3MasterNodes2Failed() throws Exception { | |||
|
|||
logger.info("--> start 1st master-eligible node"); | |||
masterNodes.add(internalCluster().startMasterOnlyNode(Settings.builder() | |||
.put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "0s") | |||
.build())); // node ordinal 0 | |||
.put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "0s") |
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.
you have updated the indentation at multiple places?
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.
IntelliJ automatically updated indentation. Do we have to import any specific rules for IntelliJ for code formatting or defaults are suffice ?
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.
@saratvemulapalli can you help with this? Do we have specific code formatter?
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.
Just use ./gradlew spotlessApply
it will format all of the code with the rules the project has defined.
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.
@saratvemulapalli Thanks, I have checked with that and build is passing successfully without any changes.
So I guess all formatting is according to project rules only. See my comment for build output.
@@ -321,9 +356,10 @@ public void test3MasterNodes2Failed() throws Exception { | |||
detachCluster(environmentMaster3, false); | |||
|
|||
logger.info("--> start 2nd and 3rd master-eligible nodes and ensure 4 nodes stable cluster"); | |||
internalCluster().startMasterOnlyNode(master2DataPathSettings); |
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.
Earlier, it was providing the data path explicitly, why did we remove it?
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.
Not able to recall why I removed it but yes I will add it back.
@@ -122,7 +134,9 @@ protected void processNodePaths(Terminal terminal, Path[] dataPaths, int nodeLoc | |||
Settings persistentSettings = Settings.builder() | |||
.put(metadata.persistentSettings()) | |||
.put(UNSAFE_BOOTSTRAP.getKey(), true) | |||
.put(Metadata.SETTING_READ_ONLY_SETTING.getKey(), applyClusterReadOnlyBlock) |
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.
if there is a cluster block already present in the cluster and user doesnt pass set it explicitly, then it will get removed unintentionally. It should add this block only if it is true.
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.
Ohh nice catch, let me fix it.
…s existing settings Signed-off-by: Harmish Lakhani <harmish.lakhani@gmail.com>
✅ DCO Check Passed 1363ac4 |
✅ Gradle Wrapper Validation success 1363ac4 |
✅ Gradle Precommit success 1363ac4 |
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.
Minor comments, otherwise LGTM
import static org.hamcrest.Matchers.containsString; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.notNullValue; |
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.
revert all the un-necessary import changes due to intellij or check with @saratvemulapalli which code formatter to use.
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.
I guess IntelliJ has reformatted all changes according to project rules only. See below check which is passing.
┌[kiwish-4.2]-(workplace/harmishlakhani-OpenSearch)-[git:unsafe_bootstrap_read_only_block]-
└> ./gradlew spotlessApply
> Configure project :
========================= WARNING =========================
Backwards compatibility tests are disabled!
See https://github.com/opensearch-project/OpenSearch/issues/105
===========================================================
> Configure project :qa:os
Cannot add task 'destructiveDistroTest.docker' as a task with that name already exists.
=======================================
OpenSearch Build Hamster says Hello!
Gradle Version : 6.6.1
OS Info : Mac OS X 10.15.7 (x86_64)
Runtime JDK Version : 11 (JDK)
Runtime java.home : /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home
Gradle JDK Version : 15 (JDK)
Gradle java.home : /Library/Java/JavaVirtualMachines/amazon-corretto-15.jdk/Contents/Home
Random Testing Seed : 6884CF4EAA1728F3
In FIPS 140 mode : false
=======================================
BUILD SUCCESSFUL in 2s
23 actionable tasks: 23 up-to-date
┌[kiwish-4.2]-(workplace/harmishlakhani-OpenSearch)-[git:unsafe_bootstrap_read_only_block]-
└> git status
On branch unsafe_bootstrap_read_only_block
Your branch is up to date with 'origin/unsafe_bootstrap_read_only_block'.
nothing to commit, working tree clean
.build(); | ||
|
||
Boolean applyClusterReadOnlyBlock = applyClusterReadOnlyBlockOption.value(options); | ||
if(Objects.nonNull(applyClusterReadOnlyBlock)) { |
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.
I am wondering if the user passes false explicitly, then what should be the behavior. Should we keep the existing block as is (in case it exists on the cluster)? Thoughts?
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.
I think we should entertain what user has given in input, because unsafe-bootstrap should be used consciously and whoever is running the command should know what it will do. Also if cluster block is already present then we hope that user will aware about the same while using this command.
we might need to raise a backport PR for 1.x after this is merged. |
@shwetathareja Yes I will raise backport PR to 1.x after this is merged. |
start gradle check |
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.
The change looks good to me!
@harmishlakhani if need this change in 1.x, please backport it.
…p command #599 (#725) * apply user defined cluster wide read only block after unsafe bootstrap command Signed-off-by: Harmish Lakhani <harmish.lakhani@gmail.com> * Fixed gradle precommit failures Signed-off-by: Harmish Lakhani <harmish.lakhani@gmail.com> * remove default as false for read only block to avoid overriding user's existing settings Signed-off-by: Harmish Lakhani <harmish.lakhani@gmail.com>
…p command
Signed-off-by: Harmish Lakhani harmish.lakhani@gmail.com
Description
This change will add one optional argument to opensearch-node unsafe-bootstrap command known as apply-cluster-read-only-block. It will apply read only block to cluster based on its value (true or false) after successful bootstrap.
Usage :
./bin/opensearch-node unsafe-bootstrap --apply-cluster-read-only-block true
Older PR for previous conversations
#493
Issues Resolved
closes: #492
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.