All Products
Search
Document Center

Tablestore:StartLocalTransaction

Last Updated:May 24, 2024

Enables the local transaction feature. After you enable the local transaction feature for a data table, you can create a local transaction based on a specified partition key value and perform read and write operations on data within the local transaction. You can use the local transaction feature to perform atomic operations to read and write one or more rows.

Usage notes

  • The local transaction feature is available for invitational preview. By default, this feature is disabled. To use the local transaction feature, submit a ticket.

    Important

    If you use Tablestore SDK for Java V5.11.0 or later, you can enable the local transaction feature when you create a data table. For more information, see Operations on tables.

  • You cannot use the auto-increment primary key column feature and the local transaction feature at the same time.

Request syntax

message StartLocalTransactionRequest {
    required string table_name = 1;
    required bytes key = 2;
}

Parameter

Type

Required

Description

table_name

string

Yes

The name of the data table.

key

bytes

Yes

The partition key value of the data table. The value must be encoded in PlainBuffer. For more information, see PlainBuffer.

Response syntax

message StartLocalTransactionResponse {
    required string transaction_id = 1;
}

Parameter

Type

Required

Description

transaction_id

string

Yes

The ID of the local transaction.

Use Tablestore SDKs

You can use the following Tablestore SDKs to implement local transactions: