-
Notifications
You must be signed in to change notification settings - Fork 104
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
feat: Begin transactions before each transaction read/write merge onto main #1234
Closed
danieljbruce
wants to merge
2
commits into
googleapis:main
from
danieljbruce:nodejs-transaction-redesign-feature-branch-try-again
Closed
feat: Begin transactions before each transaction read/write merge onto main #1234
danieljbruce
wants to merge
2
commits into
googleapis:main
from
danieljbruce:nodejs-transaction-redesign-feature-branch-try-again
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…c functions and other read/write calls (googleapis#1196) * Add a unit test for commit as a non-tx The fact that using a transaction object to do a commit results in a non-transaction should be documented so that if we decide to introduce a change later where this behaves differently then it is well documented. # Conflicts: # test/transaction.ts * use linter * Write tests to capture current behavior of error When begin transaction sends back an error, we want some tests to capture what the behavior is so that when we make changes to the run function then behavior is preserved. * Add tests for passing a response A response should reach the user the right way. Add tests to make sure behavior is preserved. * run async close to working In the run function delegate calls to runAsync and use run async to make promise calls * Add runAsync to promise excludes This allows this function to return a promise instead of a promise wrapped in a promise. This makes the tests pass and behave the way they should. * Remove space * Change to use this instead of self Do not call request from self * Eliminate unused comments * Add two comments Comments should actually explain what is being done * Remove the commit test for this PR The commit test for this PR should be removed because it is not really relevant for the async run functionality. * Clarify types throughout the function The types used should be very specific so that reading the code isn’t confusing. * Add a bit more typing for clarity Add a type to the resolve function just to introduce more clarity * Change types used in the data client callback Make the types more specific in the data client callback so that it is easier to track down the signature and match against the begin transaction function. * run the linter * Add comments to clarify PR * Refactor the parsing logic out of run The parsing logic is going to be needed elsewhere so taking it apart now. * Change interface of request promise callback The interface name should be changed so that it matches what it is. It is the callback used to form a promise. * Hide data completely Change accessors to hide data completely instead of using the private modifier * PR use if/else block Eliminate the early return as suggested in the PR * Add comments to document the new functions The comments capture the parameters and return type. * Update return type in docs * Update the tests to include runAsync runAsync should be in promisfy excludes * refactor: Break transaction.run into smaller pieces for use with async functions and other read/write calls * Rename a function to be more descriptive Make sure it is explicit that we are parsing begin results. * Modify comment Modify comment so that it doesn’t reference the way the code was before.
…into nodejs-transaction-redesign-feature-branch
product-auto-label
bot
added
size: m
Pull request size is medium.
api: datastore
Issues related to the googleapis/nodejs-datastore API.
labels
Feb 23, 2024
danieljbruce
changed the title
feat: Nodejs transaction redesign feature branch try again
feat: Begin transactions before each transaction read/write merge onto main
Feb 23, 2024
danieljbruce
added
the
owlbot:run
Add this label to trigger the Owlbot post processor.
label
Feb 23, 2024
gcf-owl-bot
bot
removed
the
owlbot:run
Add this label to trigger the Owlbot post processor.
label
Feb 23, 2024
This doesn't seem to have all the transaction work changes. I'll look into this further. |
https://github.com/googleapis/nodejs-datastore/pull/1235/files was opened instead. It has the CLA override. |
We missed out on merging PR #1234 😞 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api: datastore
Issues related to the googleapis/nodejs-datastore API.
size: m
Pull request size is medium.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR contains all the work necessary to ensure that transactions are always started before the first transaction read/write call. It also solves various concurrency problems with transactions like ensuring that two transactions are never started at the same time.
Several PRs have been merged onto this feature branch so this PR contains all the work across these PRs and finally merges it into main. The other PRs have already been reviewed so this PR is one last review before the changes go fully into production.
PRs that make up this feature branch