Skip to content

Conversation

@bajajneha27
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea.
  • Follow the instructions in CONTRIBUTING. Most importantly, ensure the tests and linter pass by running bundle exec rake ci in the gem subdirectory.
  • Update code documentation if necessary.

closes: #<issue_number_goes_here>

@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jul 14, 2022
@bajajneha27 bajajneha27 added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed api: storage Issues related to the Cloud Storage API. labels Jul 14, 2022
@bajajneha27 bajajneha27 marked this pull request as ready for review July 14, 2022 10:28
@bajajneha27 bajajneha27 requested review from a team as code owners July 14, 2022 10:28
@bajajneha27 bajajneha27 removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 14, 2022
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jul 15, 2022
Copy link
Contributor

Choose a reason for hiding this comment

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

consider:

def self.retry? query_params
  query_params.any? { |_key, val| !val.nil? }
end

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like it should be a module, not a class, since there's no point in instantiating it. Also, if the module exists only to contain one helper method, maybe that method should just be a private helper method in the service class where it's being called from. It seems like it's not meant to be a part of the public interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that makes sense. I kept it in a separate file because I thought it'd be used from multiple places.

Copy link

@tritone tritone left a comment

Choose a reason for hiding this comment

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

Seems like a step in the right direction. Remind me, have you added user configuration to allow users to retry in all cases yet? This will be helpful if any users were depending on this current behavior, so it should be a fast follow from this PR if it's not already complete.

Copy link

Choose a reason for hiding this comment

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

Note that this should be for the destination file, not the source-- not sure how this is distinguished in Ruby.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this is for destination file and if_source_generation_match is for source file.

Copy link

Choose a reason for hiding this comment

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

I see you updated mocks for existing tests; is it possible to also add a simple test with preconditions to ensure that retries do occur in this case? I guess this will be covered by conformance tests as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did think of that. I'm not sure how I can verify if the method is being retried over here but then I thought this would be covered in conformance test. I think that would suffice, no?

Copy link

Choose a reason for hiding this comment

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

Yup conformance tests should cover it

Copy link

Choose a reason for hiding this comment

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

Same here, compose also requires preconditions for the destination specifically in order to allow retries.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same goes here. if_source_generation_match is for source files and if_generation_match is for destinations files.
@dazuma @quartzmo can you please confirm if you have any idea?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe that's correct.

@bajajneha27
Copy link
Contributor Author

Seems like a step in the right direction. Remind me, have you added user configuration to allow users to retry in all cases yet? This will be helpful if any users were depending on this current behavior, so it should be a fast follow from this PR if it's not already complete.

We by default used to retry all the operations. Now, we're trying not to retry the conditionally idempotent operations.
Not sure if I got your question and answered right.

@bajajneha27 bajajneha27 force-pushed the storage/retry/232349314 branch from ae00319 to f5a4d34 Compare July 20, 2022 11:09
@bajajneha27 bajajneha27 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 20, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 20, 2022
@bajajneha27 bajajneha27 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 21, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 21, 2022
@bajajneha27
Copy link
Contributor Author

The acceptance and samples tests failures are happening on the main branch too and are unrelated to my changes. I've created the issue#18854 to track this.

@tritone
Copy link

tritone commented Jul 21, 2022

Seems like a step in the right direction. Remind me, have you added user configuration to allow users to retry in all cases yet? This will be helpful if any users were depending on this current behavior, so it should be a fast follow from this PR if it's not already complete.

We by default used to retry all the operations. Now, we're trying not to retry the conditionally idempotent operations. Not sure if I got your question and answered right.

Changing the default to only retry idempotent ops is correct. My questions is, can users override this default? Having this configurability is important so users can choose to retry everything if they don't like the default behavior.

@bajajneha27
Copy link
Contributor Author

Seems like a step in the right direction. Remind me, have you added user configuration to allow users to retry in all cases yet? This will be helpful if any users were depending on this current behavior, so it should be a fast follow from this PR if it's not already complete.

We by default used to retry all the operations. Now, we're trying not to retry the conditionally idempotent operations. Not sure if I got your question and answered right.

Changing the default to only retry idempotent ops is correct. My questions is, can users override this default? Having this configurability is important so users can choose to retry everything if they don't like the default behavior.

No, not with this change. I thought the requirement was not to let users retry the conditionally idempotent & non-idempotent operations even if they want to.
But if that's not the case, I'll have to make more changes.

@bajajneha27 bajajneha27 force-pushed the storage/retry/232349314 branch from 5213b3b to 2aa5542 Compare August 1, 2022 06:14
Copy link

@tritone tritone left a comment

Choose a reason for hiding this comment

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

Overall LGTM, please add some docs for the retry option.

Copy link

Choose a reason for hiding this comment

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

Could you add docs for the option? Also just wanted to confirm that this will be something you can add across the board to library methods.

Copy link
Contributor Author

@bajajneha27 bajajneha27 Aug 8, 2022

Choose a reason for hiding this comment

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

I updated OVERVIEW doc which explains how to use the options field overall. Also updated other methods to accept options. We've a separate PR raised already for non-idempotent operations.

@bajajneha27 bajajneha27 force-pushed the storage/retry/232349314 branch from 4bdd3b6 to 9dd64f8 Compare August 8, 2022 07:57
@bajajneha27 bajajneha27 requested a review from a team as a code owner August 8, 2022 07:57
Copy link

@tritone tritone left a comment

Choose a reason for hiding this comment

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

Generally LGTM

(For ex. a file has the same "generation"), the library retries only if the
condition is specified.

Rather than using this default behaviour, you may choose to disable the retries
Copy link

Choose a reason for hiding this comment

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

Also include information about how users can enable retries on non-idempotent operations. (this is possible right?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll be adding it in a separate PR which covers retry configurations for non-idempotent operations overall. I didn't want to club that here because Sandeep has already worked on it.

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