private static void buildBulkMutationsSettings(Builder builder,
      BigtableOptions options) {
    BulkOptions bulkOptions = options.getBulkOptions();
    BatchingSettings.Builder batchBuilder =
        builder.bulkMutateRowsSettings().getBatchingSettings().toBuilder();

    long autoFlushMs = bulkOptions.getAutoflushMs();
    long bulkMaxRowKeyCount = bulkOptions.getBulkMaxRowKeyCount();
    long maxInflightRpcs = bulkOptions.getMaxInflightRpcs();

    if (autoFlushMs > 0) {
      batchBuilder.setDelayThreshold(ofMillis(autoFlushMs));
    }
    FlowControlSettings.Builder flowControlBuilder = FlowControlSettings.newBuilder();
    if (maxInflightRpcs > 0) {
      flowControlBuilder
          .setMaxOutstandingRequestBytes(bulkOptions.getMaxMemory())
          .setMaxOutstandingElementCount(maxInflightRpcs * bulkMaxRowKeyCount);
    }

    batchBuilder
        .setIsEnabled(bulkOptions.useBulkApi())
        .setElementCountThreshold(Long.valueOf(bulkOptions.getBulkMaxRowKeyCount()))
        .setRequestByteThreshold(bulkOptions.getBulkMaxRequestSize())
        .setFlowControlSettings(flowControlBuilder.build());

    RetrySettings retrySettings =
        buildIdempotentRetrySettings(builder.bulkMutateRowsSettings().getRetrySettings(), options);

    // TODO(rahulkql): implement bulkMutationThrottling & bulkMutationRpcTargetMs, once available
    builder.bulkMutateRowsSettings()
        .setBatchingSettings(batchBuilder.build())
        .setRetrySettings(retrySettings)
        .setRetryableCodes(buildRetryCodes(options.getRetryOptions()));
  }
private static void buildBulkMutationsSettings ( Builder builder , BigtableOptions options ) { BulkOptions bulkOptions = options . getBulkOptions ( ) ; BatchingSettings . Builder batchBuilder = builder . bulkMutateRowsSettings ( ) . getBatchingSettings ( ) . toBuilder ( ) ; long autoFlushMs = bulkOptions . getAutoflushMs ( ) ; long bulkMaxRowKeyCount = bulkOptions . getBulkMaxRowKeyCount ( ) ; long maxInflightRpcs = bulkOptions . getMaxInflightRpcs ( ) ; if ( autoFlushMs > 0 ) { batchBuilder . setDelayThreshold ( ofMillis ( autoFlushMs ) ) ; } FlowControlSettings . Builder flowControlBuilder = FlowControlSettings . newBuilder ( ) ; if ( maxInflightRpcs > 0 ) { flowControlBuilder . setMaxOutstandingRequestBytes ( bulkOptions . getMaxMemory ( ) ) . setMaxOutstandingElementCount ( maxInflightRpcs * bulkMaxRowKeyCount ) ; } batchBuilder . setIsEnabled ( bulkOptions . useBulkApi ( ) ) . setElementCountThreshold ( Long . valueOf ( bulkOptions . getBulkMaxRowKeyCount ( ) ) ) . setRequestByteThreshold ( bulkOptions . getBulkMaxRequestSize ( ) ) . setFlowControlSettings ( flowControlBuilder . build ( ) ) ; RetrySettings retrySettings = buildIdempotentRetrySettings ( builder . bulkMutateRowsSettings ( ) . getRetrySettings ( ) , options ) ; builder . bulkMutateRowsSettings ( ) . setBatchingSettings ( batchBuilder . build ( ) ) . setRetrySettings ( retrySettings ) . setRetryableCodes ( buildRetryCodes ( options . getRetryOptions ( ) ) ) ; }
Builds {@link BatchingSettings} based on {@link BulkOptions} configuration.