Skip to content
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

IGNITE-23554 ScanQuery code cleanup #11645

Merged
merged 9 commits into from
Nov 7, 2024
Merged

Conversation

nizhikov
Copy link
Contributor

@nizhikov nizhikov commented Nov 3, 2024

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.

* Checks if transaction mode supported for transaction aware queries.
* @param isolation Transaction isolation to check.
*/
public static void ensureTransactionModeSupported(TransactionIsolation isolation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Only one usage. Do we really need this method? Can we keep it inlined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The second usage appear in #11580

try {
Integer part = qry.partition();

if (part != null && (part < 0 || part >= cctx.affinity().partitions()))
return new GridEmptyCloseableIterator() {
@Override public void close() throws IgniteCheckedException {
if (intFilter != null)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we don't need to close qry.scanFilter() anymore?

Copy link
Contributor Author

@nizhikov nizhikov Nov 6, 2024

Choose a reason for hiding this comment

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

Because, here we don't allocate any resources.
It required and happens only inside ScanQueryIterator.

ScanQueryIterator correctly manage those resources inside.

You are correct. Fixed.

@@ -869,36 +852,6 @@ private GridCloseableIterator scanIterator(final CacheQuery<?> qry, IgniteClosur
return iter;
}
catch (IgniteCheckedException | RuntimeException e) {
if (intFilter != null)
Copy link
Contributor

Choose a reason for hiding this comment

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

qry.scanFilter() is not closed now (for example, when we cant reserve locPart)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Fixed. Thanks.


/** */
static void closeFilter(IgniteBiPredicate<?, ?> filter) {
if (filter instanceof PlatformCacheEntryFilter)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like after sendboxing PlatformCacheEntryFilter is not instanceof PlatformCacheEntryFilter anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Thanks. Fixed.

Copy link

sonarqubecloud bot commented Nov 7, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
10 New Code Smells (required ≤ 1)

See analysis details on SonarCloud

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

@nizhikov nizhikov merged commit f56ffce into apache:master Nov 7, 2024
7 of 8 checks passed
vladnovoren pushed a commit to vladnovoren/ignite that referenced this pull request Nov 10, 2024
luchnikovbsk pushed a commit to luchnikovbsk/ignite that referenced this pull request Jan 31, 2025
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