Skip to content

Conversation

@rahulKQL
Copy link
Contributor

This commits contains:

  • A class with static method for conversion of BigtableOptions to BigtableDataSettings.
  • Basic test cases for the same, more to add once finalised.

Note: This work is still in progress, opening PR for review purpose.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 25, 2018
@rahulKQL
Copy link
Contributor Author

@igorbernstein2 Please review

Copy link
Collaborator

@igorbernstein2 igorbernstein2 left a comment

Choose a reason for hiding this comment

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

Looks like a good start. I added some comments. Please add inline TODOs for all settings that are currently unused

@rahulKQL
Copy link
Contributor Author

In this commit:

  • individual settings method, with retry check.
  • default method to set RetrySettings.
  • added/fixed code based on suggestions.
  • added many inline comment on doubtful points.
  • Added default RPC timeout as 100ms in case of No Retry

Would add test cases & removed unneeded comments once it gets reviewed.
@igorbernstein2 Could you please have a look at it

.setRetrySettings(defaultRetrySettings(options));
} else {
builder.readRowsSettings()
.setIdleTimeout(ofMillis(options.getRetryOptions().getReadPartialRowTimeoutMillis()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is incorrect idleTimeout is the delay for the user leaving a stream open not the timeout for the server. You want to set the streamingWaitTimeout. There are 2 ways to do it:

  1. the rpcTimeout of the RetrySettings gets translated into a waitTimeout
  2. set it in calloptions

1 will work for when retries are enabled. However when retries are disabled, you would have to augment the calloptions at the callsite, which is awkward. Please open a ticket in gax-java to expose waitTimeout at the callable level

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 would open an issue stating this above scenario. Thanks

@rahulKQL
Copy link
Contributor Author

@igorbernstein2 Could you please have a look at it.


I will add more junit for it tomorrow.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Dec 26, 2018
@rahulKQL rahulKQL changed the base branch from master to bigtable-client-build-latest December 26, 2018 11:20
@rahulKQL rahulKQL changed the base branch from bigtable-client-build-latest to master December 26, 2018 11:20
@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Dec 26, 2018
@rahulKQL
Copy link
Contributor Author

Changes

BigtableVaneerSettingsFactory

  • Added UserAgent through HeaderProvider with GrpcUtil.USER_AGENT_KEY which internally translated to ManagedChannel here.
  • Moved to InstantiatingGrpcChannelProvider for ChannelProvider, which gives option for Headers along with channel PoolSize.
  • Overriding non-idempotent RPCs only when SHORT_RPC_TIMEOUT is other than default value(i.e. 60seconds).
  • For BigtableTableAdminSettings: overriding Endpoint, CredentialProvider & TransportChannelProvider configuration only.

TestBigtableVaneerSettingsFactory

  • Added test case which tests BigtableDataClient as well BigtableTableAdminClient with an actual Bigtable, This test case runs only when it founds "test.client.project.id" & "test.client.project.id" VM arguments.

Question:

My purpose for using InstantiatingGrpcChannelProvider is to be able to create channelPools, however
according to this comment, it seems ManagedChannel#WithUserAgnet() should be used to setting user-agent, So for considering multipleChannel:

Should we use the BigtableSession#createChannelConfig as it takes care of creating ChannelPool?

@rahulKQL
Copy link
Contributor Author

rahulKQL commented Jan 2, 2019

@sduskis, @igorbernstein2

Please have a look at this and let me know of your thought.

* @param options a {@link BigtableOptions} object.
*/
private static void buildMutateRowSettings(Builder builder, BigtableOptions options) {
builder.mutateRowSettings()
Copy link
Collaborator

Choose a reason for hiding this comment

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

where are the retry codes configured? (here and everywhere else)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As of now, not overriding RetryCodes of BigtableDataSettings.
Defaults retrycode in GCJ:
[DEADLINE_EXCEEDED, UNAVAILABLE] --> sampleRowKeysSettings, readRowsSettings, mutateRowSettings.
empty for bulkMutationsSettings, readModifyWriteRowSettings, checkAndMutateRowSettings.

Default retrycodes in bigtable-client.

However, I can override these with operation specific retry codes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There are few more defaults for gcj in the overlay. The gapic generated client settings can't express all of the settings, so they are overlaid here:
https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java#L273-L321

This is where bulkMutations have their defaults set.

I'm trying to understand why we shouldn't copy the retry codes from cbt?

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 think for Non-idempotent operation we can utilize GCJ's default values, as we are overriding it with shortRpcTimeout & no retryCodes (here both adapters have the default value of 1 min).

In case of Idempotent operation default values varies alot &

adminBuilder.stubSettings()
.setCredentialsProvider(buildCredentialProvider(options.getCredentialOptions()));

String userAgent = BigtableVersionInfo.CORE_USER_AGENT + "," + options.getUserAgent();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add something here that would allow us to disambiguate when the hbase client is using the gcj adapter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does "VENEER_ADAPTER" sound good?

@rahulKQL rahulKQL force-pushed the dataSettings_addition branch 2 times, most recently from bc64044 to bffb90f Compare January 25, 2019 03:11
@rahulKQL
Copy link
Contributor Author

Summary of Client Settings changes

After many Iteration now in this PR, as of now we are:

  • Overriding both client setting's endpoint with BigtableOptions endpoint here.

  • Utilizing existing CredentialFactory#getCredentials for CredentialProvider.

  • Providing "VENEER_ADAPTER" in the User-Agent to be able to distinguish GCJ adapters.

  • Created TransportChannelProvider using InstantiatingGrpcChannelProvider here:

    • Kept ChannelsPerCpu to 2 (Though it BigtableOptions has 4 ChannelsPerCpu as default).
    • Kept MaxInboundMessageSize to CBT's default(i.e. 256MB).
    • For plainText Negotiation using ChannelConfigurator (would this be ok?, as its not stable yet?).
  • Created buildIdempotentRetrySettings to configure generic RetrySettings.

    createBigtableDataSettings

    • As of now we are not supporting disabling the retries.
    • In case of bulkMutationsSettings, We override:
      - BatchingSettings with BulkOptions values.
      - RetrySettings with idempotentRetrySettings.
      - RetryCodes with BigtableOptions's Retries Code.
    • In case of sampleRowKeysSettings, mutateRowSettings and readRowSettings, We overrides
      - RetrySettings with idempotentRetrySettings.
      - RetryCodes with BigtableOptions's Retries Code.
    • In case of readRowsSettings, We override
      - RetrySettings with idempotentRetrySettings considering streaming method according to this suggestion.
      - RetryCodes with BigtableOptions's Retries Code.
    • In case of checkAndMutateRowSettings & readModifyWriteRowSettings, We override SimpleTimeoutNoRetries when shortRpcTimeoutMs is not default.

    createTableAdminSettings

@rahulKQL
Copy link
Contributor Author

rahulKQL commented Feb 1, 2019

Please have a look & Please let me know if we need more modify any configurations.

//ChannelBuilder with provided value.
HeaderProvider headers = FixedHeaderProvider.create(USER_AGENT_KEY.name(), userAgent);

InstantiatingGrpcChannelProvider.Builder builder =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please a TODO to refactor google-cloud-java to expose a static defaultTransportChannelProvider method and then customize it.

* than 60_000 ms.
*/
private static void buildReadModifyWriteSettings(Builder builder, long rpcTimeoutMs) {
if(rpcTimeoutMs != SHORT_TIMEOUT_MS_DEFAULT) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why if? (here and above)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If shortTimeOutMs is at default then assuming the client did not customize BigtableOption's settings,
that is why we are not overriding the underlying settings here(or directly using defaults of GCJ's settings).

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you should override with the BigtableOptions in case the diverge

Copy link
Contributor Author

@rahulKQL rahulKQL Feb 12, 2019

Choose a reason for hiding this comment

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

override with the BigtableOptions in case the diverge

By saying above comment,
do you mean we should check all configuration against their default value(present in BigtableOption) & then override only those which are different?
OR
Should we override only in case of specific operation(say non-streming operations) by checking BigtableOption's present value against BigtableDataSetting's default value?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just meant you should remove the if statement and always setSimpleTimeoutNoRetries disrarding if the if its the default value or not. If we decide that to change the gapic config to 30 secs, but forget to change SHORT_TIMEOUT_MS_DEFAULT we will have confusing behavior: the user will check their BigtableOptions and see SHORT_TIMEOUT_MS_DEFAULT = 1 minute, but their rpcs will exceed deadline @ 30secs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the clarification!!
I followed the same here.

@igorbernstein2
Copy link
Collaborator

I just submitted googleapis/google-cloud-java#4507, it should help with the transport builder

Copy link
Collaborator

@igorbernstein2 igorbernstein2 left a comment

Choose a reason for hiding this comment

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

LGTM, except for a couple of nits

RetrySettings.Builder retryBuilder = retrySettings.toBuilder();

if (retryOptions.allowRetriesWithoutTimestamp()) {
LOG.warn("Retries without Timestamp does not support yet.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should throw instead of warn

@rahulKQL
Copy link
Contributor Author

@sduskis

Will be just rebasing and updating these three last comments

only adding fromBigtableOptions static method

adding separate methods for each settings

Added check for retry & remvoed unneeded setter
renamed Factory methods

Reverted BulkMutationSettings changes

refactored Credentail Provider
Used constant for maxRetryDelay & explicitly set the maxAttempts to zero
- Now using EnhancedBigtableDataSettings.defaultGrpcChannelPRovider for channel provider configuration.
- Updated existed BigtableDataSetttings.Builder to EnhancedBigtableDataSettings.Builder.
- changed user agent for vaneer adapter to lowercase.
- throwing exception in case of allowRetriesWithoutTimestamp.
@rahulKQL rahulKQL force-pushed the dataSettings_addition branch from f918830 to d98cd29 Compare February 28, 2019 13:18
@sduskis sduskis merged commit 0d751ae into googleapis:master Feb 28, 2019
@rahulKQL rahulKQL deleted the dataSettings_addition branch April 4, 2019 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants