Skip to content

Conversation

@DEADripER
Copy link

@DEADripER DEADripER commented Dec 1, 2025

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)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached 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.

import org.apache.ignite.internal.management.api.ComputeCommand;
import org.jetbrains.annotations.Nullable;

public class CheckpointForceCommand implements ComputeCommand<CheckpointForceCommandArg, String> {

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

Copy link
Author

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 {

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.
            }

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@nizhikov
Copy link
Contributor

nizhikov commented Dec 3, 2025

@DEADripER please, fix code style violations.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 4, 2025

import org.apache.ignite.internal.management.api.ComputeCommand;
import org.jetbrains.annotations.Nullable;

/** Checkpoint command class*/
Copy link
Contributor

@nizhikov nizhikov Dec 4, 2025

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) {
Copy link
Contributor

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 {
Copy link
Contributor

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())) {
Copy link
Contributor

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";
Copy link
Contributor

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 {
Copy link
Contributor

@nizhikov nizhikov Dec 4, 2025

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();
Copy link
Contributor

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)
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants