Skip to content

feat(storage): Takeover idempotence.#13230

Merged
tritone merged 1 commit intogoogleapis:mainfrom
cjc25:takeover-idempotence
Oct 27, 2025
Merged

feat(storage): Takeover idempotence.#13230
tritone merged 1 commit intogoogleapis:mainfrom
cjc25:takeover-idempotence

Conversation

@cjc25
Copy link
Copy Markdown
Contributor

@cjc25 cjc25 commented Oct 25, 2025

Takeovers at a specific object generation are safe to retry.

@cjc25 cjc25 requested review from a team October 25, 2025 03:09
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Oct 25, 2025
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @cjc25, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a crucial enhancement to the storage system's idempotency handling. By correctly identifying 'takeover' operations with specified object generations as idempotent, the system can now safely retry these operations without causing unintended side effects. This improves the overall reliability and fault tolerance of storage interactions, particularly for append-based operations.

Highlights

  • Idempotency Logic Enhancement: The logic for determining if a storage operation is idempotent has been updated. Specifically, 'takeover' operations that involve appending data (w.Append) to a specific object generation (w.o.gen > 0) are now explicitly recognized as idempotent.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request makes 'takeover' operations on a specific object generation idempotent, allowing them to be safely retried. The change correctly identifies this new condition for idempotency. My review includes a suggestion to consider unifying this new precondition logic with the existing w.o.conds mechanism to improve code clarity and maintainability.


isIdempotent := w.o.conds != nil && (w.o.conds.GenerationMatch >= 0 || w.o.conds.DoesNotExist)
// Specified generation takeovers are also idempotent
isIdempotent = isIdempotent || w.Append && w.o.gen > 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The condition w.Append && w.o.gen > 0 seems to implement a form of precondition for what the commit message calls a 'takeover' of a specific generation. This is conceptually similar to what w.o.conds.GenerationMatch provides. To keep the handling of preconditions centralized and improve maintainability, have you considered expressing this 'takeover' condition through the existing w.o.conds struct? For instance, if w.Append and w.o.gen > 0 are true, perhaps w.o.conds.GenerationMatch could be set accordingly earlier in the writer's setup. This would avoid having two separate mechanisms for specifying generation-based preconditions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment is incorrect :)

cpriti-os
cpriti-os previously approved these changes Oct 27, 2025
Takeovers at a specific object generation are safe to retry.
@cjc25 cjc25 force-pushed the takeover-idempotence branch from cdc4bf9 to 8557077 Compare October 27, 2025 13:02
@cpriti-os cpriti-os added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 27, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 27, 2025

isIdempotent := w.o.conds != nil && (w.o.conds.GenerationMatch >= 0 || w.o.conds.DoesNotExist)
// Specified generation takeovers are also idempotent
isIdempotent = isIdempotent || w.Append && w.o.gen > 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment is incorrect :)

@tritone tritone merged commit cc5d2a1 into googleapis:main Oct 27, 2025
9 checks passed
@cjc25 cjc25 deleted the takeover-idempotence branch October 27, 2025 16:11
krishnamd-jkp pushed a commit that referenced this pull request Oct 29, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.57.1](storage/v1.57.0...storage/v1.57.1)
(2025-10-28)


### Bug Fixes

* **storage:** Takeover idempotence.
([#13230](#13230))
([cc5d2a1](cc5d2a1))
* **storage:** Copy metadata when using Copier with grpc
([#12919](#12919))
([57a2e80](57a2e80))
* **storage:** Fix takeover response handling.
([#13239](#13239))
([26d75bc](26d75bc))
* **storage:** Remove default timeout for gRPC operations
([#13022](#13022))
([b94c3ba](b94c3ba))
* **storage:** Skip download of file outside of target dir
([#12945](#12945))
([6259aee](6259aee))
* **storage:** Upgrade gRPC service registration func
([8fffca2](8fffca2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Brenna N Epp <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants