-
Notifications
You must be signed in to change notification settings - Fork 537
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
Convert Datastore to GAPIC #903
Conversation
This PR should also remove files that are no longer needed for backoff, to close #893. |
Not all gems are converted to GAX, so the backoff code should stay until they are all converted. |
Oh right, I mistakenly thought it wasn't shared. Of course. |
2641bbd
to
8717867
Compare
The fourth commit on this PR removes Here is the default {
"interfaces": {
"google.datastore.v1.Datastore": {
"retry_codes": {
"retry_codes_def": {
"idempotent": [
"DEADLINE_EXCEEDED",
"UNAVAILABLE"
],
"non_idempotent": []
}
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 60000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 60000,
"total_timeout_millis": 600000
}
},
"methods": {
"Lookup": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"RunQuery": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"BeginTransaction": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"Commit": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"Rollback": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"AllocateIds": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
}
}
}
}
} As you can see, there are some interesting fields, such as Please note that this leaks the GAPIC implementation to the @timanovsky @bmclean Any feedback on this proposal? We hope to merge and release this PR next week. |
# @param [Integer] timeout Default timeout to use in requests. Optional. | ||
# @param [Hash] client_config A hash of values to override the default | ||
# behavior of the API client. See Google::Gax::CallSettings. Optional. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@quartzmo Please correct me if I have any of this wrong: |
@bmclean I'll take a swing at answering your question. Yes, your understanding is correct. That is the default behavior. We asked several times which endpoints we should retry and which ones we should not. But we never got an answer so we did a blanket retry on them all. I believe that this new behavior is correct. Of course, the good news is that you can now override how each endpoint is treated and use whatever behavior you wish. :) |
@@ -108,12 +108,12 @@ def datastore scope: nil, retries: nil, timeout: nil | |||
# t["done"] = false | |||
# t["priority"] = 4 | |||
# t["description"] = "Learn Cloud Datastore" | |||
# end | |||
# end `` |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
def execute | ||
require "grpc" # Ensure GRPC is loaded before rescuing exception | ||
yield | ||
rescue GRPC::BadStatus => e |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@blowmage What do you mean by "blanket retry on them all"? Retry all for a specific method as opposed to a specific endpoint? |
Correct. Not all errors, and not all endpoints should be retried. Of course, you are free to override the default configuration and make it behave as you want. |
Thanks. I agree that the proposed default config is correct. For Lookup and RunQuery, if datastore returns either a DEADLINE_EXCEEDED or UNAVAILABLE error the request is retried as per the retry configuration. For all other endpoints, the default is not to invoke the retry logic. |
This new configuration comes from Google. It has been hard for those of us outside of Google to get this information, so we are happy to finally get this level of guidance. 😄 |
Adopt 'service' and 'mocked_service' naming convention.
GAX does not directly support integer. [refs googleapis#848]
Replace retries value with the GAX client configuration. This leaks the GAX implementation to the public API. If Gax changes its implementation this may result in a change to the google-cloud-datastore public API.
8717867
to
3e08e46
Compare
@blowmage I believe I've updated this PR with everything it needs to match the merged GAPIC conversions for Vision and Pub/Sub. PTAL! |
oops wrong comment button |
This PR converts all Datastore requests to the GAX client introduced in #884.
There is a breaking change: The
retries
parameter is no longer supported (although method signatures have not changed.) See #848 and #849 for proposals to add new configuration options for retry behavior.Also, Datastore is one of the three services that still requires expanded acceptance testing (#759). I could add the needed tests as part of this PR if desired.