You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "oleg-vlsk (via GitHub)" <gi...@apache.org> on 2023/12/25 14:45:34 UTC
[PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
oleg-vlsk opened a new pull request, #11138:
URL: https://github.com/apache/ignite/pull/11138
…-baseline command output
Thank you for submitting the pull request to the Apache Ignite.
In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:
### The Contribution Checklist
- [ ] There is a single JIRA ticket related to the pull request.
- [ ] The web-link to the pull request is attached to the JIRA ticket.
- [ ] The JIRA ticket has the _Patch Available_ state.
- [ ] The pull request body describes changes that have been made.
The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
- [ ] The pull request title is treated as the final commit message.
The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
- [ ] A reviewer has been mentioned through the JIRA comments
(see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers))
- [ ] The pull request has been checked by the Teamcity Bot and
the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
### Notes
- [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
- [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
- [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
- [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "timoninmaxim (via GitHub)" <gi...@apache.org>.
timoninmaxim commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1455107918
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -3972,6 +3972,33 @@ public void testCacheIdleVerifyLogLevelDebug() throws Exception {
assertContains(log, testOut.toString(), "no conflicts have been found");
}
+ /**
+ * Test to make sure that the '--baseline' command shows correct cluster state
+ *
+ * @throws Exception if failed.
+ */
+ @Test
+ public void testClusterStateInBaselineCommand() throws Exception {
+ Ignite ignite = startGrids(1);
+
+ injectTestSystemOut();
+
+ ignite.cluster().state(ACTIVE);
+ assertEquals(EXIT_CODE_OK, execute("--baseline"));
+ assertEquals(ACTIVE, ignite.cluster().state());
+ assertContains(log, testOut.toString().replaceAll("\r", ""), "Cluster state: ACTIVE\n");
Review Comment:
The same?
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "timoninmaxim (via GitHub)" <gi...@apache.org>.
timoninmaxim commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1455115650
##########
modules/core/src/main/java/org/apache/ignite/internal/management/StateCommand.java:
##########
@@ -1,4 +1,4 @@
-/*
+ /*
Review Comment:
Please remove this change
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "timoninmaxim (via GitHub)" <gi...@apache.org>.
timoninmaxim commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1481532006
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineTaskResult.java:
##########
@@ -273,6 +286,9 @@ public boolean isBaselineAdjustInProgress() {
remainingTimeToBaselineAdjust = in.readLong();
baselineAdjustInProgress = in.readBoolean();
}
+
+ if (protoVer > V2)
Review Comment:
Read is broken. You write the `enum` first, but read `boolean`.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "yurinaryshkin (via GitHub)" <gi...@apache.org>.
yurinaryshkin commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1436484086
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineTaskResult.java:
##########
@@ -252,6 +266,7 @@ public boolean isBaselineAdjustInProgress() {
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
out.writeBoolean(active);
+ out.writeObject(clusterState);
Review Comment:
Please use `U.writeEnum()` and `U.readEnum()` for ClusterState.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1436870001
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/AbstractBaselineCommand.java:
##########
@@ -57,7 +57,7 @@ public abstract class AbstractBaselineCommand implements ComputeCommand<Baseline
BaselineTaskResult res,
Consumer<String> printer
) {
- printer.accept("Cluster state: " + (res.isActive() ? "active" : "inactive"));
+ printer.accept("Cluster state: " + res.clusterState().toString().toLowerCase().replace("_", " "));
Review Comment:
Cluster state output simplified (same as Enum values)
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "yurinaryshkin (via GitHub)" <gi...@apache.org>.
yurinaryshkin commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1436481500
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineTaskResult.java:
##########
@@ -45,9 +46,12 @@ public class BaselineTaskResult extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
- /** Cluster state. */
+ /** Cluster activated flag. */
private boolean active;
+ /** Cluster state. */
+ private ClusterState clusterState;
Review Comment:
Please remove field `active` which becomes redundant with introducing field `clusterState`.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1436869564
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineTaskResult.java:
##########
@@ -45,9 +46,12 @@ public class BaselineTaskResult extends VisorDataTransferObject {
/** */
private static final long serialVersionUID = 0L;
- /** Cluster state. */
+ /** Cluster activated flag. */
private boolean active;
+ /** Cluster state. */
+ private ClusterState clusterState;
Review Comment:
Field 'active' removed
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineTaskResult.java:
##########
@@ -252,6 +266,7 @@ public boolean isBaselineAdjustInProgress() {
/** {@inheritDoc} */
@Override protected void writeExternalData(ObjectOutput out) throws IOException {
out.writeBoolean(active);
+ out.writeObject(clusterState);
Review Comment:
Methods U.writeEnum() and U.readEnum() are now used for ClusterState
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1456971595
##########
modules/core/src/main/java/org/apache/ignite/internal/management/StateCommand.java:
##########
@@ -1,4 +1,4 @@
-/*
+ /*
Review Comment:
Pattern/Matcher mechanism for checking output strings is implemented.
##########
modules/core/src/main/java/org/apache/ignite/internal/management/StateCommand.java:
##########
@@ -1,4 +1,4 @@
-/*
+ /*
Review Comment:
Pattern/Matcher mechanism for checking output strings is implemented.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "timoninmaxim (via GitHub)" <gi...@apache.org>.
timoninmaxim commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1457241026
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -903,7 +908,7 @@ public void testState() throws Exception {
assertEquals(EXIT_CODE_OK, execute("--state"));
- assertContains(log, testOut.toString(), "Cluster is inactive");
+ assertTrue(patternBuilder.apply(ignite.cluster().state().toString()).matcher(testOut.toString()).find());
Review Comment:
Looks like it can be simplified even more.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1457194635
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -903,7 +904,11 @@ public void testState() throws Exception {
assertEquals(EXIT_CODE_OK, execute("--state"));
- assertContains(log, testOut.toString(), "Cluster is inactive");
+ Pattern patternInactive = Pattern.compile("Cluster state: INACTIVE");
Review Comment:
Yes, it will. Both tests have been simplified by means of ```Function```.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1469284092
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -903,7 +908,7 @@ public void testState() throws Exception {
assertEquals(EXIT_CODE_OK, execute("--state"));
- assertContains(log, testOut.toString(), "Cluster is inactive");
+ assertTrue(patternBuilder.apply(ignite.cluster().state().toString()).matcher(testOut.toString()).find());
Review Comment:
Abbreviation plugin has been used to edit the name of the 'logOutput' parameter in the ```assertClusterState()``` method.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1444155552
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/AbstractBaselineCommand.java:
##########
@@ -57,7 +57,7 @@ public abstract class AbstractBaselineCommand implements ComputeCommand<Baseline
BaselineTaskResult res,
Consumer<String> printer
) {
- printer.accept("Cluster state: " + (res.isActive() ? "active" : "inactive"));
+ printer.accept("Cluster state: " + res.clusterState());
Review Comment:
@timoninmaxim Test has been added.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "timoninmaxim (via GitHub)" <gi...@apache.org>.
timoninmaxim commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1481528308
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineTaskResult.java:
##########
@@ -171,37 +175,46 @@ private static Collection<InetAddress> resolveInetAddresses(ClusterNode node) {
/**
* Constructor.
*
- * @param active Cluster state.
+ * @param clusterState Cluster state.
* @param topVer Current topology version.
* @param baseline Current baseline nodes.
* @param servers Current server nodes.
* @param remainingTimeToBaselineAdjust Time to next baseline adjust.
* @param baselineAdjustInProgress {@code true} If baseline adjust is in progress.
*/
public BaselineTaskResult(
- boolean active,
+ ClusterState clusterState,
long topVer,
Collection<? extends org.apache.ignite.cluster.BaselineNode> baseline,
Collection<? extends org.apache.ignite.cluster.BaselineNode> servers,
BaselineAutoAdjustSettings autoAdjustSettings,
long remainingTimeToBaselineAdjust,
boolean baselineAdjustInProgress) {
- this.active = active;
+ this.clusterState = clusterState;
this.topVer = topVer;
this.baseline = toMap(baseline);
this.servers = toMapWithResolvedAddresses(servers);
this.autoAdjustSettings = autoAdjustSettings;
this.remainingTimeToBaselineAdjust = remainingTimeToBaselineAdjust;
this.baselineAdjustInProgress = baselineAdjustInProgress;
+
+ active = !(clusterState == ClusterState.INACTIVE);
}
/**
- * @return Cluster state.
+ * @return Cluster activated flag.
*/
public boolean isActive() {
return active;
Review Comment:
It seems we don't need the `active` field at all, `return clusterState.active()`
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1463086265
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -903,7 +908,7 @@ public void testState() throws Exception {
assertEquals(EXIT_CODE_OK, execute("--state"));
- assertContains(log, testOut.toString(), "Cluster is inactive");
+ assertTrue(patternBuilder.apply(ignite.cluster().state().toString()).matcher(testOut.toString()).find());
Review Comment:
The ```assertClusterState()``` method is used to further simplify the process of checking current cluster state against the '--baseline' and '--state' commands output.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1455161574
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -919,7 +919,7 @@ public void testState() throws Exception {
assertEquals(EXIT_CODE_OK, execute("--state"));
- assertContains(log, testOut.toString(), "Cluster is active");
+ assertContains(log, testOut.toString().replaceAll("\r", ""), "Cluster state: ACTIVE\n");
Review Comment:
The *“Cluster state: ACTIVE”* string in this test will work for both “ATCIVE” and “ACTIVE_READ_ONLY”, so specifically for the “ATCIVE” state we need an end of line symbol (“\n”) in the string.
The “\n” symbol however works only for MacOS and Linux, in Windows it’s “\r\n”. So, for this test to work in all operating systems it’s necessary to delete the “\r” from the output string.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1455162359
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -3972,6 +3972,33 @@ public void testCacheIdleVerifyLogLevelDebug() throws Exception {
assertContains(log, testOut.toString(), "no conflicts have been found");
}
+ /**
+ * Test to make sure that the '--baseline' command shows correct cluster state
+ *
+ * @throws Exception if failed.
+ */
+ @Test
+ public void testClusterStateInBaselineCommand() throws Exception {
+ Ignite ignite = startGrids(1);
+
+ injectTestSystemOut();
+
+ ignite.cluster().state(ACTIVE);
+ assertEquals(EXIT_CODE_OK, execute("--baseline"));
+ assertEquals(ACTIVE, ignite.cluster().state());
+ assertContains(log, testOut.toString().replaceAll("\r", ""), "Cluster state: ACTIVE\n");
Review Comment:
Yes, the same reason.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "yurinaryshkin (via GitHub)" <gi...@apache.org>.
yurinaryshkin commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1436487680
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/AbstractBaselineCommand.java:
##########
@@ -57,7 +57,7 @@ public abstract class AbstractBaselineCommand implements ComputeCommand<Baseline
BaselineTaskResult res,
Consumer<String> printer
) {
- printer.accept("Cluster state: " + (res.isActive() ? "active" : "inactive"));
+ printer.accept("Cluster state: " + res.clusterState().toString().toLowerCase().replace("_", " "));
Review Comment:
Do we have a strict requirement to leave words "active" and "inactive" in output as they are?
Can they be changed to show more precise Cluster state like this?
Cluster state: ACTIVE
Cluster state: INACTIVE
Cluster state: ACTIVE_READ_ONLY
I'd vote for simplifying this and removing clusterState().toString() result modification.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "timoninmaxim (via GitHub)" <gi...@apache.org>.
timoninmaxim commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1455107370
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -919,7 +919,7 @@ public void testState() throws Exception {
assertEquals(EXIT_CODE_OK, execute("--state"));
- assertContains(log, testOut.toString(), "Cluster is active");
+ assertContains(log, testOut.toString().replaceAll("\r", ""), "Cluster state: ACTIVE\n");
Review Comment:
Why did you use `replaceAll` and "\n"?
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1455163044
##########
modules/core/src/main/java/org/apache/ignite/internal/management/StateCommand.java:
##########
@@ -1,4 +1,4 @@
-/*
+ /*
Review Comment:
The change is removed.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "timoninmaxim (via GitHub)" <gi...@apache.org>.
timoninmaxim commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1437658634
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/AbstractBaselineCommand.java:
##########
@@ -57,7 +57,7 @@ public abstract class AbstractBaselineCommand implements ComputeCommand<Baseline
BaselineTaskResult res,
Consumer<String> printer
) {
- printer.accept("Cluster state: " + (res.isActive() ? "active" : "inactive"));
+ printer.accept("Cluster state: " + res.clusterState());
Review Comment:
Let's add a test for that. Please, check the example on `GridCommandHandlerTest#testBaselineRemoveOnNotActiveCluster`. You can add similar test and check different states.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "yurinaryshkin (via GitHub)" <gi...@apache.org>.
yurinaryshkin commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1436487680
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/AbstractBaselineCommand.java:
##########
@@ -57,7 +57,7 @@ public abstract class AbstractBaselineCommand implements ComputeCommand<Baseline
BaselineTaskResult res,
Consumer<String> printer
) {
- printer.accept("Cluster state: " + (res.isActive() ? "active" : "inactive"));
+ printer.accept("Cluster state: " + res.clusterState().toString().toLowerCase().replace("_", " "));
Review Comment:
Do we have a strict requirement to leave words "active" and "inactive" in output as they are?
Can they be changed to show more precise Cluster state like this?
Cluster state: ACTIVE
Cluster state: INACTIVE
Cluster state: ACTIVE_READ_ONLY
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "timoninmaxim (via GitHub)" <gi...@apache.org>.
timoninmaxim commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1455933790
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -919,7 +919,7 @@ public void testState() throws Exception {
assertEquals(EXIT_CODE_OK, execute("--state"));
- assertContains(log, testOut.toString(), "Cluster is active");
+ assertContains(log, testOut.toString().replaceAll("\r", ""), "Cluster state: ACTIVE\n");
Review Comment:
Let's replace this check with `Pattern` matching then.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1436870001
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/AbstractBaselineCommand.java:
##########
@@ -57,7 +57,7 @@ public abstract class AbstractBaselineCommand implements ComputeCommand<Baseline
BaselineTaskResult res,
Consumer<String> printer
) {
- printer.accept("Cluster state: " + (res.isActive() ? "active" : "inactive"));
+ printer.accept("Cluster state: " + res.clusterState().toString().toLowerCase().replace("_", " "));
Review Comment:
Cluster state output simplified (same as Enum values)

--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1482251545
##########
modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineTaskResult.java:
##########
@@ -273,6 +286,9 @@ public boolean isBaselineAdjustInProgress() {
remainingTimeToBaselineAdjust = in.readLong();
baselineAdjustInProgress = in.readBoolean();
}
+
+ if (protoVer > V2)
Review Comment:
Corrections have been made, the order of properties in writeExternalData() and readExternalData() is the same 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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Use ClusterState enum for baseline control.sh commands output [ignite]
Posted by "timoninmaxim (via GitHub)" <gi...@apache.org>.
timoninmaxim merged PR #11138:
URL: https://github.com/apache/ignite/pull/11138
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1458206504
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -903,7 +908,7 @@ public void testState() throws Exception {
assertEquals(EXIT_CODE_OK, execute("--state"));
- assertContains(log, testOut.toString(), "Cluster is inactive");
+ assertTrue(patternBuilder.apply(ignite.cluster().state().toString()).matcher(testOut.toString()).find());
Review Comment:
Done, I changed cluster states to string values in all ‘apply()’ methods in testState().
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "oleg-vlsk (via GitHub)" <gi...@apache.org>.
oleg-vlsk commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1456971806
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -919,7 +919,7 @@ public void testState() throws Exception {
assertEquals(EXIT_CODE_OK, execute("--state"));
- assertContains(log, testOut.toString(), "Cluster is active");
+ assertContains(log, testOut.toString().replaceAll("\r", ""), "Cluster state: ACTIVE\n");
Review Comment:
Pattern/Matcher mechanism for checking output strings is implemented.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21102 Cluster activated flag replaced with cluster state for --baseline command output [ignite]
Posted by "timoninmaxim (via GitHub)" <gi...@apache.org>.
timoninmaxim commented on code in PR #11138:
URL: https://github.com/apache/ignite/pull/11138#discussion_r1457121562
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -903,7 +904,11 @@ public void testState() throws Exception {
assertEquals(EXIT_CODE_OK, execute("--state"));
- assertContains(log, testOut.toString(), "Cluster is inactive");
+ Pattern patternInactive = Pattern.compile("Cluster state: INACTIVE");
Review Comment:
Can we replace it with smth like
```
Function<String, Pattern> patternBuilder = (state) -> Pattern.compile("Cluster state: " + state + "\\s+");
assertTrue(patternBuilder.apply("INACTIVE").matcher(testOut.toString()).find());
```
Will it work on Windows 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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org