-
Notifications
You must be signed in to change notification settings - Fork 29
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
[Explainer] Ignore batch inner locks and support atomic batch updates #228
Merged
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
…tional Behavior This change switches to ignore internal locks within the `batchUpdate()` method to enable transactional behavior. All updates within a `batchUpdate()` call will now execute as a single unit of work, ensuring data consistency. This assumes that methods within `batchUpdate()` are logically related and intended for a single use case, making a single `batchUpdate()`-level lock sufficient.
@jkarlin / @pythagoraskitty: PTAL. Thanks! |
jkarlin
reviewed
Mar 4, 2025
jkarlin
reviewed
Mar 7, 2025
pythagoraskitty
approved these changes
Mar 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM w/nit
LGTM |
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
Mar 19, 2025
Introduce SharedStorageDatabase::BatchUpdate() method that executes multiple methods within a sql::Transaction. If any inner method fails, all changes are rolled back. This is proposed in: WICG/shared-storage#228 Note that we still accept parameter type vector<mojom::SharedStorageModifierMethodWithOptionsPtr>, although we ignore the `with_lock` option: - Backward compatibility: The inner method locks are still needed in other components during the deprecation phase. Reusing the same type simplifies the transition. - Forward compatibility: This parameter may be repurposed/expanded to include other options in the future. Bug: 404568020 Change-Id: I8489083343379cb75cf2c2a538e3fbd9882feaed Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6368281 Reviewed-by: Cammie Smith Barnes <[email protected]> Commit-Queue: Yao Xiao <[email protected]> Reviewed-by: Tsuyoshi Horo <[email protected]> Cr-Commit-Position: refs/heads/main@{#1434805}
xyaoinum
added a commit
that referenced
this pull request
Mar 20, 2025
The spec changes for #228 Specifically: - Add a "batch update entries in the database" algorithm that provides transactional support. Switch to call this algorithm for batchUpdate(). - `batchUpdate()` now explicitly throws an exception when any inner method specifies the `withLock` option, preventing unintended behavior. - For headers, if `with_lock` is specified for any inner method, the whole batch will be ignored as well. This integrates seamlessly with the existing "handle a Shared-Storage-Write response" algorithm, which invokes `batchUpdate()` in the end and will trigger the failure as intended.
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
Mar 25, 2025
Introduce SharedStorageManager::BatchUpdate() method that forwards the request to the underlying SharedStorageDatabase. Explainer PR: WICG/shared-storage#228 Fuchsia-Binary-Size: Size increase is unavoidable. Bug: 404568020 Change-Id: I39feb84af04f69d6b0d2c4a7432ad5e46b9d3ed7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6384755 Commit-Queue: Yao Xiao <[email protected]> Reviewed-by: Cammie Smith Barnes <[email protected]> Reviewed-by: Tsuyoshi Horo <[email protected]> Cr-Commit-Position: refs/heads/main@{#1437454}
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
Mar 27, 2025
…hUpdate method Introduce `network::features::kSharedStorageTransactionalBatchUpdate` and use the new, transactional SharedStorageManager::BatchUpdate() when the feature is enabled. Move some unit tests to a separate "TransactionalBatchUpdateDisabled" suite, as they wouldn't be applicable for the new implementation (i.e., inner methods won't contain locks / we'll reject at mojom traits). PR: WICG/shared-storage#228 Integration CL preview: https://crrev.com/c/6393777 Bug: 404568020 Change-Id: I00821af78107c6b2ff9913e596837544ec8495d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6395183 Reviewed-by: Cammie Smith Barnes <[email protected]> Reviewed-by: Adam Rice <[email protected]> Commit-Queue: Yao Xiao <[email protected]> Cr-Commit-Position: refs/heads/main@{#1438688}
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
Mar 27, 2025
…ment Introduce mojom::SharedStorageBatchUpdateMethodsArgument, which is type mapped to vector<::network::mojom::SharedStorageModifierMethodWithOptionsPtr>. Currently, the mojom traits perform a trivial conversion and no validation. When we later switch to disallow the 'withLock' option for methods within batchUpdate() (PR: [1]; Integration CL preview: [2]), the mojom traits will be updated to enforce this restriction. [1] WICG/shared-storage#228 [2] https://crrev.com/c/6393777 Bug: 404568020 Change-Id: I31f87d3ef1c98d7a24ab9d1b9e4cb27bedf4d32c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6394820 Commit-Queue: Yao Xiao <[email protected]> Reviewed-by: Cammie Smith Barnes <[email protected]> Reviewed-by: Adam Rice <[email protected]> Reviewed-by: Ken Buchanan <[email protected]> Cr-Commit-Position: refs/heads/main@{#1438964}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This change removes the individual method locks within
batchUpdate()
, enabling transactional behavior.Rationale:
batchUpdate()
is designed for single, transactional use cases. Therefore, a single batch-level lock is sufficient.