Class StartBatchTransactionAction

java.lang.Object
com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessage
com.google.protobuf.GeneratedMessageV3
com.google.spanner.executor.v1.StartBatchTransactionAction
All Implemented Interfaces:
com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, StartBatchTransactionActionOrBuilder, Serializable

public final class StartBatchTransactionAction extends com.google.protobuf.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:
 1. Start batch transaction with a timestamp (StartBatchTransactionAction),
 note the returned BatchTransactionId
 2. Generate database partitions for a read or query
 (GenerateDbPartitionsForReadAction/GenerateDbPartitionsForQueryAction)
 3. 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:
 5. 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
See Also:
  • Field Details

    • BATCH_TXN_TIME_FIELD_NUMBER

      public static final int BATCH_TXN_TIME_FIELD_NUMBER
      See Also:
    • TID_FIELD_NUMBER

      public static final int TID_FIELD_NUMBER
      See Also:
    • CLOUD_DATABASE_ROLE_FIELD_NUMBER

      public static final int CLOUD_DATABASE_ROLE_FIELD_NUMBER
      See Also:
  • Method Details

    • newInstance

      protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
      Overrides:
      newInstance in class com.google.protobuf.GeneratedMessageV3
    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
    • getParamCase

      Specified by:
      getParamCase in interface StartBatchTransactionActionOrBuilder
    • hasBatchTxnTime

      public boolean hasBatchTxnTime()
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
      Specified by:
      hasBatchTxnTime in interface StartBatchTransactionActionOrBuilder
      Returns:
      Whether the batchTxnTime field is set.
    • getBatchTxnTime

      public com.google.protobuf.Timestamp getBatchTxnTime()
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
      Specified by:
      getBatchTxnTime in interface StartBatchTransactionActionOrBuilder
      Returns:
      The batchTxnTime.
    • getBatchTxnTimeOrBuilder

      public com.google.protobuf.TimestampOrBuilder getBatchTxnTimeOrBuilder()
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
      Specified by:
      getBatchTxnTimeOrBuilder in interface StartBatchTransactionActionOrBuilder
    • 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;
      Specified by:
      hasTid in interface StartBatchTransactionActionOrBuilder
      Returns:
      Whether the tid field is set.
    • getTid

      public com.google.protobuf.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;
      Specified by:
      getTid in interface StartBatchTransactionActionOrBuilder
      Returns:
      The tid.
    • 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;
      Specified by:
      getCloudDatabaseRole in interface StartBatchTransactionActionOrBuilder
      Returns:
      The cloudDatabaseRole.
    • getCloudDatabaseRoleBytes

      public com.google.protobuf.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;
      Specified by:
      getCloudDatabaseRoleBytes in interface StartBatchTransactionActionOrBuilder
      Returns:
      The bytes for cloudDatabaseRole.
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3
    • writeTo

      public void writeTo(com.google.protobuf.CodedOutputStream output) throws IOException
      Specified by:
      writeTo in interface com.google.protobuf.MessageLite
      Overrides:
      writeTo in class com.google.protobuf.GeneratedMessageV3
      Throws:
      IOException
    • getSerializedSize

      public int getSerializedSize()
      Specified by:
      getSerializedSize in interface com.google.protobuf.MessageLite
      Overrides:
      getSerializedSize in class com.google.protobuf.GeneratedMessageV3
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface com.google.protobuf.Message
      Overrides:
      equals in class com.google.protobuf.AbstractMessage
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface com.google.protobuf.Message
      Overrides:
      hashCode in class com.google.protobuf.AbstractMessage
    • parseFrom

      public static StartBatchTransactionAction parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StartBatchTransactionAction parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StartBatchTransactionAction parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StartBatchTransactionAction parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StartBatchTransactionAction parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StartBatchTransactionAction parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseFrom

      public static StartBatchTransactionAction parseFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static StartBatchTransactionAction parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static StartBatchTransactionAction parseDelimitedFrom(InputStream input) throws IOException
      Throws:
      IOException
    • parseDelimitedFrom

      public static StartBatchTransactionAction parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • parseFrom

      public static StartBatchTransactionAction parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
      Throws:
      IOException
    • parseFrom

      public static StartBatchTransactionAction parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Throws:
      IOException
    • newBuilderForType

      public StartBatchTransactionAction.Builder newBuilderForType()
      Specified by:
      newBuilderForType in interface com.google.protobuf.Message
      Specified by:
      newBuilderForType in interface com.google.protobuf.MessageLite
    • newBuilder

      public static StartBatchTransactionAction.Builder newBuilder()
    • newBuilder

    • toBuilder

      Specified by:
      toBuilder in interface com.google.protobuf.Message
      Specified by:
      toBuilder in interface com.google.protobuf.MessageLite
    • newBuilderForType

      protected StartBatchTransactionAction.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
      Specified by:
      newBuilderForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstance

      public static StartBatchTransactionAction getDefaultInstance()
    • parser

      public static com.google.protobuf.Parser<StartBatchTransactionAction> parser()
    • getParserForType

      public com.google.protobuf.Parser<StartBatchTransactionAction> getParserForType()
      Specified by:
      getParserForType in interface com.google.protobuf.Message
      Specified by:
      getParserForType in interface com.google.protobuf.MessageLite
      Overrides:
      getParserForType in class com.google.protobuf.GeneratedMessageV3
    • getDefaultInstanceForType

      public StartBatchTransactionAction getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder