-
Notifications
You must be signed in to change notification settings - Fork 1.9k
IGNITE-27033: checkpoint control.sh command #12547
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
base: master
Are you sure you want to change the base?
Conversation
| import org.apache.ignite.internal.management.api.ComputeCommand; | ||
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
| public class CheckpointForceCommand implements ComputeCommand<CheckpointForceCommandArg, String> { |
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.
This logic must be in CheckpointCommand itself.
So the desired syntax is:
> ./control.sh --checkpoint
> ./control.sh --checkpoint --reason "After data load checkpoint"
> ./control.sh --checkoint --wait-for-finish --timeout 60000
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.
done
| } | ||
|
|
||
| /** {@inheritDoc} */ | ||
| @Override protected String run(@Nullable CheckpointForceCommandArg arg) throws IgniteException { |
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.
We must check if persistence enabled on node with the:
if (!CU.isPersistenceEnabled(ignite.configuration())) {
throw new IgniteException("Can't checkpoint on in-memory node"); // Or return some result here.
}
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.
done
|
@DEADripER please, fix code style violations. |
|
| import org.apache.ignite.internal.management.api.ComputeCommand; | ||
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
| /** Checkpoint command class*/ |
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.
typo: /** Checkpoint command class*/ -> /** Checkpoint command. */
| CheckpointProgress checkpointfut = dbMgr.forceCheckpoint(reason); | ||
|
|
||
| if (waitForFinish) { | ||
| if (timeout != null && timeout > 0) { |
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 (timeout != null && timeout > 0)
checkpointfut.futureFor(CheckpointState.FINISHED).get(timeout, TimeUnit.MILLISECONDS);
else
checkpointfut.futureFor(CheckpointState.FINISHED).get();
| } | ||
| return "Checkpoint completed on node: " + ignite.localNode().id(); | ||
| } | ||
| else { |
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.
else
return "Checkpoint triggered on node: " + ignite.localNode().id();
|
|
||
| /** {@inheritDoc} */ | ||
| @Override protected String run(@Nullable CheckpointCommandArg arg) throws IgniteException { | ||
| if (!CU.isPersistenceEnabled(ignite.configuration())) { |
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.
One line statements written without quote.
Please, take a look at style guide:
https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines
if (!CU.isPersistenceEnabled(ignite.configuration()))
throw new IgniteException("Can't checkpoint on in-memory node");
| throw new IgniteException("Can't checkpoint on in-memory node"); | ||
| } | ||
|
|
||
| String reason = arg != null && arg.reason() != null ? arg.reason() : "control.sh"; |
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.
Let's skip arg null checks here and in other places.
| } | ||
|
|
||
| /** {@inheritDoc} */ | ||
| @Override protected String run(@Nullable CheckpointCommandArg arg) throws IgniteException { |
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.
Please, remove Nullable annotation.
| stopAllGrids(); | ||
| cleanPersistenceDir(); | ||
| injectTestSystemOut(); | ||
| super.beforeTest(); |
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.
super.beforeTest(); must be invoked first.
| @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { | ||
| IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); | ||
|
|
||
| if (clusterState == 1) |
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.
Let's use
GridCommandHandlerAbstractTest#persistenceEnable instead of clusterState flag



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
The description explains WHAT and WHY was made instead of HOW.
The following pattern must be used:
IGNITE-XXXX Change summarywhereXXXX- number of JIRA issue.(see the Maintainers list)
the
green visaattached to the JIRA ticket (see TC.Bot: Check PR)Notes
If you need any help, please email [email protected] or ask anу advice on http://asf.slack.com #ignite channel.