GeezerVison is showing github.com — When DatastoreImpl.runQuery() gets a 503 it does not retry · Issue #244 · googleapis/google-cloud-java
When DatastoreImpl.runQuery() gets a 503 it does not retry #244DescriptionI'm getting a "Could not reach service" DatastoreException when retrying would run the query successfully.
com.google.gcloud.datastore.DatastoreException: Could not reach service
at com.google.gcloud.datastore.DatastoreException$Code.translate(DatastoreException.java:87)
at com.google.gcloud.datastore.DatastoreException.translateAndThrow(DatastoreException.java:140)
at com.google.gcloud.datastore.DatastoreException.translateAndThrow(DatastoreException.java:120)
at com.google.gcloud.datastore.DatastoreImpl.runQuery(DatastoreImpl.java:113)
at com.google.gcloud.datastore.QueryResultsImpl.sendRequest(QueryResultsImpl.java:66)
at com.google.gcloud.datastore.QueryResultsImpl.(QueryResultsImpl.java:56)
at com.google.gcloud.datastore.DatastoreImpl.run(DatastoreImpl.java:102)
at com.google.gcloud.datastore.DatastoreImpl.run(DatastoreImpl.java:98)
...
Activitysimon-temple commented on Oct 12, 2015 mziccard commented on Oct 12, 2015 Hi @simon-temple!
I tried to reproduce the error with a test but it seems to me that the request is being retried.
Could you share with us the code you used to create DatastoreService (and its options) and the code that throws the exception? Are you providing some RetryParams to DatastoreOptions, like:
DatastoreOptions options = DatastoreOptions.builder()
.retryParams(RetryParams.getDefaultInstance())
.serviceRpcFactory(rpcFactoryMock)
.build(); simon-temple commented on Oct 12, 2015 Ah! Maybe that's because I did not specify RetryParams... if I don't specify them to the options builder do I get NO_RETRIES as default?
PrivateKey pk = PkiUtils.pkcs8PemDecode( pemPrivateKey );
AuthCredentials credentials = AuthCredentials.createFor( clientId, pk );
options = DatastoreOptions.builder()
.authCredentials( credentials )
.build();
Datastore datastore = DatastoreFactory.instance().get( options );mziccard commented on Oct 12, 2015 Yes, if you do not explicitly set retryParams the default behaviour is doing no retries. See here.
But we should document this. Please do not close this issue, I'll close it as soon as we add better javadoc. simon-temple commented on Oct 12, 2015 Thanks again for your help... I'll start with
RetryParams.getDefaultInstance()
and see how we get on. mziccard commented on Oct 12, 2015 You're welcome!
You should not have problems with getDefaultInstance but if you need to, you can also build your own retry configuration:
RetryParams.builder()
.retryMaxAttempts(10)
.retryMinAttempts(6)
.maxRetryDelayMillis(30000)
.totalRetryPeriodMillis(120000)
.initialRetryDelayMillis(250)
.build() mziccard commented on Oct 12, 2015
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|