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-22733 Support transactions in Scan query #11580

Merged
merged 222 commits into from
Nov 25, 2024

Conversation

nizhikov
Copy link
Contributor

@nizhikov nizhikov commented Oct 9, 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.

Copy link

sonarqubecloud bot commented Nov 8, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
16 New Code Smells (required ≤ 1)

See analysis details on SonarCloud

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

@@ -147,6 +152,10 @@ public class GridCacheQueryRequest extends GridCacheIdMessage implements GridCac
/** */
private AffinityTopologyVersion topVer;

/** Set of keys that must be skiped during iteration. */
@GridDirectCollection(KeyCacheObject.class)
private Collection<KeyCacheObject> skipKeys;
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps it worth to filter keys on reducer instead of modifying network protocol. I think it will be a little bit simplier. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are several reason to filter keys on remote nodes:

  1. Reduce network usage. We don't send values that will be filtered out.
  2. In case transformer used, we invoke it on remote node and receive transformed value on local node. This reduce network usage, also.

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. For example, you have 2 skipKeys and 10 nodes, in case of filtering on remote nodes you send additionaly 2 * 9 keys and receive 2 keys and 2 values less (but receive the same amount in case of insert only transactions). So, we can't be sure about reducing network usage. I think, in the typical usage, on the contrary, it will increase network usage.
  2. Transformers can enlarge values as well.

* @return First, set of object changed in transaction, second, list of transaction data in required format.
* @see ExecutionContext#transactionChanges(int, int[], Function)
*/
public IgniteBiTuple<Set<KeyCacheObject>, List<Object>> transactionChanges(Integer part) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There are a lot of declaration like IgniteBiTuple<Set<KeyCacheObject>, List<Object>> now in code, and a lot of calls like txChanges.get1(), txChanges.get2(). Perhaps we are ready to introduce new class for query transactional changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

try {
for (int i = 0; i < 50; i++)
cache.put(i, new Value("str" + i, i * 100));
assumeTrue(sqlTxMode == TestTransactionMode.NONE);
Copy link
Contributor

Choose a reason for hiding this comment

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

Any transactional test with local flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

}

/**
* @throws Exception If failed.
*/
@Test
public void testGetObjectFieldPartitioned() throws Exception {
IgniteCache<Integer, Value> cache = grid().createCache("test-cache");
IgniteCache<Integer, Value> cache = createTestCache();
Copy link
Contributor

Choose a reason for hiding this comment

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

This test only fill one partition, I think for transactional mode we should also check that tx entries with are filtered correcly by partition if there are data for other partitions exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@nizhikov nizhikov merged commit 841a70f into apache:master Nov 25, 2024
5 checks passed
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