Skip to content

IGNITE-28681 Operation Context integrated in Ignite internal async structures#13148

Open
petrov-mg wants to merge 12 commits into
apache:masterfrom
petrov-mg:IGNITE-28681
Open

IGNITE-28681 Operation Context integrated in Ignite internal async structures#13148
petrov-mg wants to merge 12 commits into
apache:masterfrom
petrov-mg:IGNITE-28681

Conversation

@petrov-mg
Copy link
Copy Markdown
Contributor

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 tab PR Check at TC.Bot - Instance 1 or TC.Bot - Instance 2)

Notes

If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.

@petrov-mg petrov-mg force-pushed the IGNITE-28681 branch 4 times, most recently from 00e2378 to 4d73864 Compare May 19, 2026 09:54

/** */
protected IgniteThread createWorkerThread(GridWorker worker) {
return new IgniteThread(igniteInstanceName(), name(), worker, GRP_IDX_UNASSIGNED, -1, GridIoPolicy.UNDEFINED);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We could use another IgniteThread constructor with only three arguments. grpIdx, stripe and plc parameters are always the same.

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

Choose a reason for hiding this comment

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

I guess cleanup method is called as part of node's stop procedure and race with start method is not possible?

By race I mean a situation when the first thread calls start method, the second on calls cleanup and then the third calls start again and reverts the work of the second thread.

If this situation is not possible it is fine to ignore this comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The start method creates and starts a worker thread. Once the worker thread completes execution of its body, it invokes the cleanup method (see GridWorker#run). Since cleanup is declared as protected, it can only be invoked by the worker thread itself.

Therefore, invocation of start always happens-before invocation of cleanup.

Currently, AsyncQueueHandler supports restarting, so the following scenario is expected:

  1. A worker thread is started.
  2. The worker is cancelled.
  3. The worker body completes execution.
  4. Resources are cleaned up.
  5. The worker thread terminates.
  6. A new worker thread is started.

We expect that code that uses AsyncQueueHandler must prevent unintended worker restarts.

}

/** */
public void scheduleAutoFlush(DataStreamerImpl<?, ?> dataStreamer) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why two methods exposed through GridKernalContext instead of passing flusher to DataStreamerImpl? Both approaches are not ideal but the last one is less invasive from my point of view.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

/**
* Cancel thread execution and completes all notification futures.
*/
/** Cancel thread execution and completes all notification futures. */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/** Cancel thread execution and completes all notification futures. */
/** Cancels thread execution and completes all notification futures. */

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
24 New Code Smells (required ≤ 1)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

2 participants