Class StartBatchTransactionAction (6.60.0)

public final class StartBatchTransactionAction extends GeneratedMessageV3 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 Fields

BATCH_TXN_TIME_FIELD_NUMBER

public static final int BATCH_TXN_TIME_FIELD_NUMBER
Field Value
TypeDescription
int

CLOUD_DATABASE_ROLE_FIELD_NUMBER

public static final int CLOUD_DATABASE_ROLE_FIELD_NUMBER
Field Value
TypeDescription
int

TID_FIELD_NUMBER

public static final int TID_FIELD_NUMBER
Field Value
TypeDescription
int

Static Methods

getDefaultInstance()

public static StartBatchTransactionAction getDefaultInstance()
Returns
TypeDescription
StartBatchTransactionAction

getDescriptor()

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

newBuilder()

public static StartBatchTransactionAction.Builder newBuilder()
Returns
TypeDescription
StartBatchTransactionAction.Builder

newBuilder(StartBatchTransactionAction prototype)

public static StartBatchTransactionAction.Builder newBuilder(StartBatchTransactionAction prototype)
Parameter
NameDescription
prototypeStartBatchTransactionAction
Returns
TypeDescription
StartBatchTransactionAction.Builder

parseDelimitedFrom(InputStream input)

public static StartBatchTransactionAction parseDelimitedFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
IOException

parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static StartBatchTransactionAction parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
IOException

parseFrom(byte[] data)

public static StartBatchTransactionAction parseFrom(byte[] data)
Parameter
NameDescription
databyte[]
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)

public static StartBatchTransactionAction parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
databyte[]
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data)

public static StartBatchTransactionAction parseFrom(ByteString data)
Parameter
NameDescription
dataByteString
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)

public static StartBatchTransactionAction parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteString
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(CodedInputStream input)

public static StartBatchTransactionAction parseFrom(CodedInputStream input)
Parameter
NameDescription
inputCodedInputStream
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
IOException

parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public static StartBatchTransactionAction parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
IOException

parseFrom(InputStream input)

public static StartBatchTransactionAction parseFrom(InputStream input)
Parameter
NameDescription
inputInputStream
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
IOException

parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)

public static StartBatchTransactionAction parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
IOException

parseFrom(ByteBuffer data)

public static StartBatchTransactionAction parseFrom(ByteBuffer data)
Parameter
NameDescription
dataByteBuffer
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
InvalidProtocolBufferException

parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)

public static StartBatchTransactionAction parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
dataByteBuffer
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
StartBatchTransactionAction
Exceptions
TypeDescription
InvalidProtocolBufferException

parser()

public static Parser<StartBatchTransactionAction> parser()
Returns
TypeDescription
Parser<StartBatchTransactionAction>

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
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.

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

getParamCase()

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

getParserForType()

public Parser<StartBatchTransactionAction> getParserForType()
Returns
TypeDescription
Parser<StartBatchTransactionAction>
Overrides

getSerializedSize()

public int getSerializedSize()
Returns
TypeDescription
int
Overrides

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.

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

newBuilderForType()

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

newBuilderForType(GeneratedMessageV3.BuilderParent parent)

protected StartBatchTransactionAction.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
NameDescription
parentBuilderParent
Returns
TypeDescription
StartBatchTransactionAction.Builder
Overrides

newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)

protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
NameDescription
unusedUnusedPrivateParameter
Returns
TypeDescription
Object
Overrides

toBuilder()

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

writeTo(CodedOutputStream output)

public void writeTo(CodedOutputStream output)
Parameter
NameDescription
outputCodedOutputStream
Overrides
Exceptions
TypeDescription
IOException