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

Node: transaction commands for json module #2690

Merged
merged 11 commits into from
Nov 16, 2024

Conversation

prateek-kumar-improving
Copy link
Collaborator

@prateek-kumar-improving prateek-kumar-improving commented Nov 14, 2024

Issue link

This Pull Request is linked to issue (URL): #2683

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Commits will be squashed upon merging.

Test results on 61a85d0:
image

Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
node/tests/ServerModules.test.ts Outdated Show resolved Hide resolved
node/tests/ServerModules.test.ts Outdated Show resolved Hide resolved
node/tests/TestUtilities.ts Outdated Show resolved Hide resolved
node/tests/TestUtilities.ts Outdated Show resolved Hide resolved
@acarbonetto acarbonetto changed the title Node transaction commands json Node: transaction commands for json module Nov 14, 2024
@acarbonetto acarbonetto added the node Node.js wrapper label Nov 14, 2024
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
baseTransaction: ClusterTransaction,
): Promise<[string, GlideReturnType][]> {
const responseData: [string, GlideReturnType][] = [];
const key1 = "key1" + uuidv4();
Copy link
Contributor

Choose a reason for hiding this comment

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

update the key to use the same prefix

* is atomic only at the slot level. If one or more slot-specific requests fail, the entire
* call will return the first encountered error, even though some requests may have succeeded
* while others did not. If this behavior impacts your application logic, consider splitting
* the request into sub-requests per slot to ensure atomicity.
Copy link
Contributor

Choose a reason for hiding this comment

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

@remarks When in cluster mode, all keys in the transaction must be mapped to the same slot.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the remark on BaseClient mget as well. Should that also be updated?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No
transaction goes to only 1 node always, but a command executed outside of transaction could be routed to multiple nodes.
Good finding - should be updated for mget in transaction for all clients

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. I have made a comment on 3 PRs.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Yury-Fridlyand should it be added to MGET? (not JSON.MGET)
I think our logic was that the same comment applies to all commands (including between commands) and so it's defined on the wiki instead of in the javadoc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment could be applied to all multi-key commands.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean JSON.MGET
I remember we were not adding same slot notice in transaction, but I don't remember the reason...

@jamesx-improving jamesx-improving changed the base branch from release-1.2 to feature/module-transaction November 15, 2024 19:59
… transaction tests

Signed-off-by: Jonathan Louie <Jonathan.Louie@improving.com>
Signed-off-by: Jonathan Louie <Jonathan.Louie@improving.com>
Signed-off-by: Jonathan Louie <Jonathan.Louie@improving.com>
@acarbonetto acarbonetto merged commit ecfe7a6 into feature/module-transaction Nov 16, 2024
46 of 49 checks passed
@acarbonetto acarbonetto deleted the node-transaction-commands-json branch November 16, 2024 00:47
yipin-chen pushed a commit that referenced this pull request Dec 24, 2024
* Node: Add Transaction for JSON commands

---------

Signed-off-by: Prateek Kumar <prateek.kumar@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Jonathan Louie <Jonathan.Louie@improving.com>
Co-authored-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Co-authored-by: Jonathan Louie <Jonathan.Louie@improving.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node Node.js wrapper
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants