Class StartBatchTransactionAction.Builder (6.60.0)

public static final class StartBatchTransactionAction.Builder extends GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder> implements StartBatchTransactionActionOrBuilder

Starts a batch read-only transaction in executor. Successful outcomes of this action will contain batch_txn_id--the identificator that can be used to start the same transaction in other Executors to parallelize partition processing.

Example of a batch read flow:

  1. Start batch transaction with a timestamp (StartBatchTransactionAction)
  2. Generate database partitions for a read or query (GenerateDbPartitionsForReadAction/GenerateDbPartitionsForQueryAction)
  3. Call ExecutePartitionAction for some or all partitions, process rows
  4. Clean up the transaction (CloseBatchTransactionAction).

    More sophisticated example, with parallel processing:

  5. Start batch transaction with a timestamp (StartBatchTransactionAction), note the returned BatchTransactionId
  6. Generate database partitions for a read or query (GenerateDbPartitionsForReadAction/GenerateDbPartitionsForQueryAction)
  7. Distribute the partitions over a pool of workers, along with the transaction ID.

    In each worker: 4-1. StartBatchTransactionAction with the given transaction ID 4-2. ExecutePartitionAction for each partition it got, process read results 4-3. Close (not cleanup) the transaction (CloseBatchTransactionAction).

    When all workers are done:

  8. Cleanup the transaction (CloseBatchTransactionAction). This can be done either by the last worker to finish the job, or by the main Executor that initialized this transaction in the first place. It is also possible to clean it up with a brand new Executor -- just execute StartBatchTransactionAction with the ID, then clean it up right away.

    Cleaning up is optional, but recommended.

Protobuf type google.spanner.executor.v1.StartBatchTransactionAction

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public StartBatchTransactionAction.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides

build()

public StartBatchTransactionAction build()
Returns
TypeDescription
StartBatchTransactionAction

buildPartial()

public StartBatchTransactionAction buildPartial()
Returns
TypeDescription
StartBatchTransactionAction

clear()

public StartBatchTransactionAction.Builder clear()
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides

clearBatchTxnTime()

public StartBatchTransactionAction.Builder clearBatchTxnTime()

The exact timestamp to start the batch transaction.

.google.protobuf.Timestamp batch_txn_time = 1;

Returns
TypeDescription
StartBatchTransactionAction.Builder

clearCloudDatabaseRole()

public StartBatchTransactionAction.Builder clearCloudDatabaseRole()

Database role to assume while performing this action. Setting the database_role will enforce additional role-based access checks on this action.

string cloud_database_role = 3;

Returns
TypeDescription
StartBatchTransactionAction.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public StartBatchTransactionAction.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public StartBatchTransactionAction.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides

clearParam()

public StartBatchTransactionAction.Builder clearParam()
Returns
TypeDescription
StartBatchTransactionAction.Builder

clearTid()

public StartBatchTransactionAction.Builder clearTid()

ID of a batch read-only transaction. It can be used to start the same batch transaction on multiple executors and parallelize partition processing.

bytes tid = 2;

Returns
TypeDescription
StartBatchTransactionAction.Builder

This builder for chaining.

clone()

public StartBatchTransactionAction.Builder clone()
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides

getBatchTxnTime()

public Timestamp getBatchTxnTime()

The exact timestamp to start the batch transaction.

.google.protobuf.Timestamp batch_txn_time = 1;

Returns
TypeDescription
Timestamp

The batchTxnTime.

getBatchTxnTimeBuilder()

public Timestamp.Builder getBatchTxnTimeBuilder()

The exact timestamp to start the batch transaction.

.google.protobuf.Timestamp batch_txn_time = 1;

Returns
TypeDescription
Builder

getBatchTxnTimeOrBuilder()

public TimestampOrBuilder getBatchTxnTimeOrBuilder()

The exact timestamp to start the batch transaction.

.google.protobuf.Timestamp batch_txn_time = 1;

Returns
TypeDescription
TimestampOrBuilder

getCloudDatabaseRole()

public String getCloudDatabaseRole()

Database role to assume while performing this action. Setting the database_role will enforce additional role-based access checks on this action.

string cloud_database_role = 3;

Returns
TypeDescription
String

The cloudDatabaseRole.

getCloudDatabaseRoleBytes()

public ByteString getCloudDatabaseRoleBytes()

Database role to assume while performing this action. Setting the database_role will enforce additional role-based access checks on this action.

string cloud_database_role = 3;

Returns
TypeDescription
ByteString

The bytes for cloudDatabaseRole.

getDefaultInstanceForType()

public StartBatchTransactionAction getDefaultInstanceForType()
Returns
TypeDescription
StartBatchTransactionAction

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
Descriptor
Overrides

getParamCase()

public StartBatchTransactionAction.ParamCase getParamCase()
Returns
TypeDescription
StartBatchTransactionAction.ParamCase

getTid()

public ByteString getTid()

ID of a batch read-only transaction. It can be used to start the same batch transaction on multiple executors and parallelize partition processing.

bytes tid = 2;

Returns
TypeDescription
ByteString

The tid.

hasBatchTxnTime()

public boolean hasBatchTxnTime()

The exact timestamp to start the batch transaction.

.google.protobuf.Timestamp batch_txn_time = 1;

Returns
TypeDescription
boolean

Whether the batchTxnTime field is set.

hasTid()

public boolean hasTid()

ID of a batch read-only transaction. It can be used to start the same batch transaction on multiple executors and parallelize partition processing.

bytes tid = 2;

Returns
TypeDescription
boolean

Whether the tid field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeBatchTxnTime(Timestamp value)

public StartBatchTransactionAction.Builder mergeBatchTxnTime(Timestamp value)

The exact timestamp to start the batch transaction.

.google.protobuf.Timestamp batch_txn_time = 1;

Parameter
NameDescription
valueTimestamp
Returns
TypeDescription
StartBatchTransactionAction.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public StartBatchTransactionAction.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public StartBatchTransactionAction.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides

mergeFrom(StartBatchTransactionAction other)

public StartBatchTransactionAction.Builder mergeFrom(StartBatchTransactionAction other)
Parameter
NameDescription
otherStartBatchTransactionAction
Returns
TypeDescription
StartBatchTransactionAction.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final StartBatchTransactionAction.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides

setBatchTxnTime(Timestamp value)

public StartBatchTransactionAction.Builder setBatchTxnTime(Timestamp value)

The exact timestamp to start the batch transaction.

.google.protobuf.Timestamp batch_txn_time = 1;

Parameter
NameDescription
valueTimestamp
Returns
TypeDescription
StartBatchTransactionAction.Builder

setBatchTxnTime(Timestamp.Builder builderForValue)

public StartBatchTransactionAction.Builder setBatchTxnTime(Timestamp.Builder builderForValue)

The exact timestamp to start the batch transaction.

.google.protobuf.Timestamp batch_txn_time = 1;

Parameter
NameDescription
builderForValueBuilder
Returns
TypeDescription
StartBatchTransactionAction.Builder

setCloudDatabaseRole(String value)

public StartBatchTransactionAction.Builder setCloudDatabaseRole(String value)

Database role to assume while performing this action. Setting the database_role will enforce additional role-based access checks on this action.

string cloud_database_role = 3;

Parameter
NameDescription
valueString

The cloudDatabaseRole to set.

Returns
TypeDescription
StartBatchTransactionAction.Builder

This builder for chaining.

setCloudDatabaseRoleBytes(ByteString value)

public StartBatchTransactionAction.Builder setCloudDatabaseRoleBytes(ByteString value)

Database role to assume while performing this action. Setting the database_role will enforce additional role-based access checks on this action.

string cloud_database_role = 3;

Parameter
NameDescription
valueByteString

The bytes for cloudDatabaseRole to set.

Returns
TypeDescription
StartBatchTransactionAction.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public StartBatchTransactionAction.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public StartBatchTransactionAction.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides

setTid(ByteString value)

public StartBatchTransactionAction.Builder setTid(ByteString value)

ID of a batch read-only transaction. It can be used to start the same batch transaction on multiple executors and parallelize partition processing.

bytes tid = 2;

Parameter
NameDescription
valueByteString

The tid to set.

Returns
TypeDescription
StartBatchTransactionAction.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final StartBatchTransactionAction.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides