Browse Source

Feature/tcc async commit (#100)

implement async commit for tcc
pull/110/head
bu,hehe GitHub 3 years ago
parent
commit
53db855920
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 440 additions and 290 deletions
  1. +217
    -124
      pkg/apis/seata.pb.go
  2. +21
    -19
      pkg/apis/seata.proto
  3. +1
    -0
      pkg/client/base/context/business_action_context.go
  4. +2
    -1
      pkg/client/rm/resource_manager.go
  5. +10
    -2
      pkg/client/tcc/proxy.go
  6. +1
    -1
      pkg/tc/model/global_transaction.go
  7. +14
    -6
      pkg/tc/server/transaction_coordinator.go
  8. +4
    -4
      pkg/tc/storage/driver/inmemory/inmemory.go
  9. +98
    -63
      pkg/tc/storage/driver/mysql/mysql.go
  10. +70
    -70
      pkg/tc/storage/driver/pgsql/pgsql.go
  11. +1
    -0
      scripts/server/db/mysql.sql
  12. +1
    -0
      scripts/server/db/pgsql.sql

+ 217
- 124
pkg/apis/seata.pb.go View File

@@ -462,6 +462,7 @@ type BranchSession struct {
Type BranchSession_BranchType `protobuf:"varint,7,opt,name=Type,proto3,enum=apis.BranchSession_BranchType" json:"Type,omitempty" xorm:"branch_type"`
Status BranchSession_BranchStatus `protobuf:"varint,8,opt,name=Status,proto3,enum=apis.BranchSession_BranchStatus" json:"Status,omitempty" xorm:"status"`
ApplicationData []byte `protobuf:"bytes,9,opt,name=ApplicationData,proto3" json:"ApplicationData,omitempty" xorm:"application_data"`
AsyncCommit bool `protobuf:"varint,10,opt,name=AsyncCommit,proto3" json:"AsyncCommit,omitempty" xorm:"async_commit"`
}

func (m *BranchSession) Reset() { *m = BranchSession{} }
@@ -559,6 +560,13 @@ func (m *BranchSession) GetApplicationData() []byte {
return nil
}

func (m *BranchSession) GetAsyncCommit() bool {
if m != nil {
return m.AsyncCommit
}
return false
}

type RowLock struct {
XID string `protobuf:"bytes,1,opt,name=XID,proto3" json:"XID,omitempty" xorm:"xid"`
TransactionID int64 `protobuf:"varint,2,opt,name=TransactionID,proto3" json:"TransactionID,omitempty" xorm:"transaction_id"`
@@ -786,6 +794,7 @@ type BranchRegisterRequest struct {
LockKey string `protobuf:"bytes,4,opt,name=LockKey,proto3" json:"LockKey,omitempty"`
BranchType BranchSession_BranchType `protobuf:"varint,5,opt,name=BranchType,proto3,enum=apis.BranchSession_BranchType" json:"BranchType,omitempty"`
ApplicationData []byte `protobuf:"bytes,6,opt,name=ApplicationData,proto3" json:"ApplicationData,omitempty"`
AsyncCommit bool `protobuf:"varint,7,opt,name=AsyncCommit,proto3" json:"AsyncCommit,omitempty"`
}

func (m *BranchRegisterRequest) Reset() { *m = BranchRegisterRequest{} }
@@ -862,6 +871,13 @@ func (m *BranchRegisterRequest) GetApplicationData() []byte {
return nil
}

func (m *BranchRegisterRequest) GetAsyncCommit() bool {
if m != nil {
return m.AsyncCommit
}
return false
}

// BranchRegisterResponse represents a response to BranchRegisterRequest
type BranchRegisterResponse struct {
ResultCode ResultCode `protobuf:"varint,1,opt,name=ResultCode,proto3,enum=apis.ResultCode" json:"ResultCode,omitempty"`
@@ -2097,128 +2113,129 @@ func init() {
func init() { proto.RegisterFile("seata.proto", fileDescriptor_450a439f8893981f) }

var fileDescriptor_450a439f8893981f = []byte{
// 1931 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0xcd, 0x6f, 0x23, 0x49,
0x15, 0x77, 0xb7, 0xbf, 0x5f, 0x62, 0xbb, 0x52, 0xce, 0x87, 0xe3, 0xd9, 0xb4, 0x33, 0xbd, 0x5a,
0xe1, 0x1d, 0xd8, 0x64, 0x94, 0x11, 0x48, 0x8b, 0x10, 0x2b, 0x3b, 0xc9, 0x0e, 0x21, 0xec, 0xee,
0xd0, 0xc9, 0x8a, 0x15, 0x97, 0x51, 0xc7, 0xae, 0x75, 0x5a, 0x71, 0xba, 0x4d, 0x77, 0x7b, 0x12,
0x8b, 0x0b, 0x77, 0x0e, 0x80, 0x56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xfd, 0x6c,
0x67, 0xbb, 0x77, 0xd6, 0xd9, 0xa6, 0x5b, 0x9f, 0x64, 0x58, 0xb9, 0x7f, 0xf4, 0xef, 0x00, 0x00,
0x00, 0xff, 0xff, 0xf4, 0xc7, 0x17, 0x6a, 0x32, 0x1d, 0x00, 0x00,
// 1943 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x59, 0x4f, 0x6f, 0x23, 0x49,
0x15, 0x77, 0xb7, 0xff, 0xbf, 0xc4, 0x76, 0xa5, 0x3c, 0x49, 0x1c, 0xcf, 0xa6, 0xed, 0xe9, 0xd5,
0x0a, 0xef, 0x88, 0xcd, 0x8c, 0x32, 0x80, 0x34, 0x08, 0xb1, 0xb2, 0x93, 0xec, 0x10, 0xc2, 0xee,
0x0e, 0x9d, 0xac, 0xd8, 0x5b, 0xd4, 0xb1, 0x6b, 0x9d, 0x56, 0x9c, 0x6e, 0xd3, 0xdd, 0x9e, 0xc4,
0xe2, 0xc2, 0x37, 0x58, 0xd0, 0x4a, 0x1c, 0x90, 0xb8, 0x71, 0xe0, 0xc4, 0x8d, 0x03, 0x82, 0x33,
0xe2, 0xc0, 0x61, 0x4e, 0x68, 0x4f, 0x16, 0x93, 0x11, 0x02, 0x24, 0x0e, 0x2b, 0x7f, 0x02, 0x54,
0x7f, 0xda, 0x5d, 0x65, 0x3b, 0xeb, 0xc9, 0x02, 0x22, 0xec, 0xcd, 0xf5, 0xde, 0xaf, 0x5e, 0x55,
0xbf, 0xf7, 0x7e, 0xef, 0x55, 0x95, 0x61, 0x29, 0x20, 0x76, 0x68, 0x6f, 0xf5, 0x7d, 0x2f, 0xf4,
0x70, 0xca, 0xee, 0x3b, 0x41, 0xf5, 0xad, 0xae, 0x13, 0x9e, 0x0e, 0x4e, 0xb6, 0xda, 0xde, 0xf9,
0x83, 0xae, 0xd7, 0xf5, 0x1e, 0x30, 0xe5, 0xc9, 0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 0x3c, 0x70, 0x69, 0x77, 0x20, 0xb8, 0x3c, 0xa7, 0x88, 0x55, 0xe7, 0x09, 0x1b, 0xda, 0x43,
0x0d, 0x1f, 0x40, 0x51, 0xe5, 0x70, 0xb4, 0xd5, 0xb9, 0xcf, 0x56, 0xd1, 0x56, 0xaf, 0x79, 0xc1,
0xd9, 0x8b, 0x4a, 0xb8, 0xea, 0xf9, 0x39, 0x2f, 0x26, 0x91, 0xe3, 0xe6, 0x3e, 0x1b, 0x7c, 0x07,
0xf2, 0x93, 0x1b, 0x30, 0x56, 0x9c, 0x33, 0x7d, 0x7f, 0xaf, 0x6e, 0x5e, 0xa3, 0xe5, 0x96, 0x5a,
0x5f, 0x7b, 0xfe, 0xc2, 0x48, 0x7c, 0xfa, 0xc2, 0x48, 0x7c, 0xf6, 0xc2, 0xd0, 0x7e, 0x7c, 0x65,
0x68, 0xbf, 0xba, 0x32, 0xb4, 0x3f, 0x5e, 0x19, 0xda, 0xf3, 0x2b, 0x43, 0xfb, 0xcb, 0x95, 0xa1,
0xfd, 0xfd, 0xca, 0x48, 0x7c, 0x76, 0x65, 0x68, 0x3f, 0x79, 0x69, 0x24, 0x9e, 0xbf, 0x34, 0x12,
0x9f, 0xbe, 0x34, 0x12, 0x27, 0x19, 0x56, 0xc1, 0x1f, 0xfd, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x29,
0x5b, 0x99, 0x9e, 0x85, 0x1d, 0x00, 0x00,
}

func (x ResultCode) String() string {
@@ -2354,6 +2371,9 @@ func (this *BranchSession) Equal(that interface{}) bool {
if !bytes.Equal(this.ApplicationData, that1.ApplicationData) {
return false
}
if this.AsyncCommit != that1.AsyncCommit {
return false
}
return true
}
func (this *RowLock) Equal(that interface{}) bool {
@@ -2498,6 +2518,9 @@ func (this *BranchRegisterRequest) Equal(that interface{}) bool {
if !bytes.Equal(this.ApplicationData, that1.ApplicationData) {
return false
}
if this.AsyncCommit != that1.AsyncCommit {
return false
}
return true
}
func (this *BranchRegisterResponse) Equal(that interface{}) bool {
@@ -3106,7 +3129,7 @@ func (this *BranchSession) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 13)
s := make([]string, 0, 14)
s = append(s, "&apis.BranchSession{")
s = append(s, "Addressing: "+fmt.Sprintf("%#v", this.Addressing)+",\n")
s = append(s, "XID: "+fmt.Sprintf("%#v", this.XID)+",\n")
@@ -3117,6 +3140,7 @@ func (this *BranchSession) GoString() string {
s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n")
s = append(s, "Status: "+fmt.Sprintf("%#v", this.Status)+",\n")
s = append(s, "ApplicationData: "+fmt.Sprintf("%#v", this.ApplicationData)+",\n")
s = append(s, "AsyncCommit: "+fmt.Sprintf("%#v", this.AsyncCommit)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
@@ -3165,7 +3189,7 @@ func (this *BranchRegisterRequest) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 10)
s := make([]string, 0, 11)
s = append(s, "&apis.BranchRegisterRequest{")
s = append(s, "Addressing: "+fmt.Sprintf("%#v", this.Addressing)+",\n")
s = append(s, "XID: "+fmt.Sprintf("%#v", this.XID)+",\n")
@@ -3173,6 +3197,7 @@ func (this *BranchRegisterRequest) GoString() string {
s = append(s, "LockKey: "+fmt.Sprintf("%#v", this.LockKey)+",\n")
s = append(s, "BranchType: "+fmt.Sprintf("%#v", this.BranchType)+",\n")
s = append(s, "ApplicationData: "+fmt.Sprintf("%#v", this.ApplicationData)+",\n")
s = append(s, "AsyncCommit: "+fmt.Sprintf("%#v", this.AsyncCommit)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
@@ -3511,6 +3536,16 @@ func (m *BranchSession) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.AsyncCommit {
i--
if m.AsyncCommit {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x50
}
if len(m.ApplicationData) > 0 {
i -= len(m.ApplicationData)
copy(dAtA[i:], m.ApplicationData)
@@ -3746,6 +3781,16 @@ func (m *BranchRegisterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.AsyncCommit {
i--
if m.AsyncCommit {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x38
}
if len(m.ApplicationData) > 0 {
i -= len(m.ApplicationData)
copy(dAtA[i:], m.ApplicationData)
@@ -4703,6 +4748,9 @@ func (m *BranchSession) Size() (n int) {
if l > 0 {
n += 1 + l + sovSeata(uint64(l))
}
if m.AsyncCommit {
n += 2
}
return n
}

@@ -4813,6 +4861,9 @@ func (m *BranchRegisterRequest) Size() (n int) {
if l > 0 {
n += 1 + l + sovSeata(uint64(l))
}
if m.AsyncCommit {
n += 2
}
return n
}

@@ -5252,6 +5303,7 @@ func (this *BranchSession) String() string {
`Type:` + fmt.Sprintf("%v", this.Type) + `,`,
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
`ApplicationData:` + fmt.Sprintf("%v", this.ApplicationData) + `,`,
`AsyncCommit:` + fmt.Sprintf("%v", this.AsyncCommit) + `,`,
`}`,
}, "")
return s
@@ -5308,6 +5360,7 @@ func (this *BranchRegisterRequest) String() string {
`LockKey:` + fmt.Sprintf("%v", this.LockKey) + `,`,
`BranchType:` + fmt.Sprintf("%v", this.BranchType) + `,`,
`ApplicationData:` + fmt.Sprintf("%v", this.ApplicationData) + `,`,
`AsyncCommit:` + fmt.Sprintf("%v", this.AsyncCommit) + `,`,
`}`,
}, "")
return s
@@ -6060,6 +6113,26 @@ func (m *BranchSession) Unmarshal(dAtA []byte) error {
m.ApplicationData = []byte{}
}
iNdEx = postIndex
case 10:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field AsyncCommit", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSeata
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.AsyncCommit = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipSeata(dAtA[iNdEx:])
@@ -6824,6 +6897,26 @@ func (m *BranchRegisterRequest) Unmarshal(dAtA []byte) error {
m.ApplicationData = []byte{}
}
iNdEx = postIndex
case 7:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field AsyncCommit", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowSeata
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.AsyncCommit = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipSeata(dAtA[iNdEx:])


+ 21
- 19
pkg/apis/seata.proto View File

@@ -108,7 +108,7 @@ message GlobalSession {
// Retrying rollback (since timeout) after a recoverable failure.
TimeoutRollbackRetrying = 7;

// All branches can be async committed. The committing is NOT done yet, but it can be seen as
// All branches can be async committed. The committing is NOT done yet, but it can be seen as
// committed for TM/RM rpc_client.
AsyncCommitting = 8;

@@ -215,6 +215,7 @@ message BranchSession {
BranchType Type = 7 [(gogoproto.moretags) = "xorm:\"branch_type\""];
BranchStatus Status = 8 [(gogoproto.moretags) = "xorm:\"status\""];
bytes ApplicationData = 9 [(gogoproto.moretags) = "xorm:\"application_data\""];
bool AsyncCommit = 10 [(gogoproto.moretags) = "xorm:\"async_commit\""];
}

message RowLock {
@@ -227,14 +228,14 @@ message RowLock {
string RowKey = 7 [(gogoproto.moretags) = "xorm:\"row_key\""];
}

// GlobalBeginRequest represents a global transaction begin
// GlobalBeginRequest represents a global transaction begin
message GlobalBeginRequest {
string Addressing = 1;
int32 Timeout = 2;
string TransactionName = 3;
}

// GlobalBeginResponse represents a response to GlobalBeginRequest
// GlobalBeginResponse represents a response to GlobalBeginRequest
message GlobalBeginResponse {
ResultCode ResultCode = 1;
ExceptionCode ExceptionCode = 2;
@@ -242,7 +243,7 @@ message GlobalBeginResponse {
string XID = 4;
}

// BranchRegisterRequest represents a branch transaction join in the global transaction
// BranchRegisterRequest represents a branch transaction join in the global transaction
message BranchRegisterRequest {
string Addressing = 1;
string XID = 2;
@@ -250,9 +251,10 @@ message BranchRegisterRequest {
string LockKey = 4;
BranchSession.BranchType BranchType = 5;
bytes ApplicationData = 6;
bool AsyncCommit = 7;
}

// BranchRegisterResponse represents a response to BranchRegisterRequest
// BranchRegisterResponse represents a response to BranchRegisterRequest
message BranchRegisterResponse {
ResultCode ResultCode = 1;
ExceptionCode ExceptionCode = 2;
@@ -260,7 +262,7 @@ message BranchRegisterResponse {
int64 BranchID = 4;
}

// BranchReportRequest represents a request to report branch transaction execution status
// BranchReportRequest represents a request to report branch transaction execution status
message BranchReportRequest {
string XID = 1;
int64 BranchID = 2;
@@ -270,7 +272,7 @@ message BranchReportRequest {
bytes ApplicationData = 6;
}

// BranchReportResponse represents a response to BranchReportRequest
// BranchReportResponse represents a response to BranchReportRequest
message BranchReportResponse {
ResultCode ResultCode = 1;
ExceptionCode ExceptionCode = 2;
@@ -293,12 +295,12 @@ message GlobalLockQueryResponse {
bool Lockable = 4;
}

// GlobalStatusRequest represents a request to query the global transaction status
// GlobalStatusRequest represents a request to query the global transaction status
message GlobalStatusRequest {
string XID = 1;
}

// GlobalStatusResponse represents a response to GlobalStatusRequest
// GlobalStatusResponse represents a response to GlobalStatusRequest
message GlobalStatusResponse {
ResultCode ResultCode = 1;
ExceptionCode ExceptionCode = 2;
@@ -306,12 +308,12 @@ message GlobalStatusResponse {
GlobalSession.GlobalStatus GlobalStatus = 4;
}

// GlobalCommitRequest represents a request to commit global transaction
// GlobalCommitRequest represents a request to commit global transaction
message GlobalCommitRequest {
string XID = 1;
}

// GlobalCommitResponse represents a response to GlobalCommitRequest
// GlobalCommitResponse represents a response to GlobalCommitRequest
message GlobalCommitResponse {
ResultCode ResultCode = 1;
ExceptionCode ExceptionCode = 2;
@@ -319,12 +321,12 @@ message GlobalCommitResponse {
GlobalSession.GlobalStatus GlobalStatus = 4;
}

// GlobalRollbackRequest represents a request to rollback global transaction
// GlobalRollbackRequest represents a request to rollback global transaction
message GlobalRollbackRequest {
string XID = 1;
}

// GlobalRollbackResponse represents a response to GlobalRollbackRequest
// GlobalRollbackResponse represents a response to GlobalRollbackRequest
message GlobalRollbackResponse {
ResultCode ResultCode = 1;
ExceptionCode ExceptionCode = 2;
@@ -332,13 +334,13 @@ message GlobalRollbackResponse {
GlobalSession.GlobalStatus GlobalStatus = 4;
}

// GlobalReportRequest represents a request to report global transaction execution status
// GlobalReportRequest represents a request to report global transaction execution status
message GlobalReportRequest {
string XID = 1;
GlobalSession.GlobalStatus GlobalStatus = 2;
}

// GlobalReportResponse represents a response to GlobalReportRequest
// GlobalReportResponse represents a response to GlobalReportRequest
message GlobalReportResponse {
ResultCode ResultCode = 1;
ExceptionCode ExceptionCode = 2;
@@ -346,7 +348,7 @@ message GlobalReportResponse {
GlobalSession.GlobalStatus GlobalStatus = 4;
}

// BranchCommitRequest represents a request to commit branch transaction
// BranchCommitRequest represents a request to commit branch transaction
message BranchCommitRequest {
string XID = 1;
int64 BranchID = 2;
@@ -356,7 +358,7 @@ message BranchCommitRequest {
bytes ApplicationData = 6;
}

// BranchCommitResponse represents a response to BranchCommitRequest
// BranchCommitResponse represents a response to BranchCommitRequest
message BranchCommitResponse {
ResultCode ResultCode = 1;
ExceptionCode ExceptionCode = 2;
@@ -366,7 +368,7 @@ message BranchCommitResponse {
BranchSession.BranchStatus BranchStatus = 6;
}

// BranchCommitRequest represents a request to rollback branch transaction
// BranchCommitRequest represents a request to rollback branch transaction
message BranchRollbackRequest {
string XID = 1;
int64 BranchID = 2;
@@ -376,7 +378,7 @@ message BranchRollbackRequest {
bytes ApplicationData = 6;
}

// BranchRollbackResponse represents a response to BranchRollbackRequest
// BranchRollbackResponse represents a response to BranchRollbackRequest
message BranchRollbackResponse {
ResultCode ResultCode = 1;
ExceptionCode ExceptionCode = 2;


+ 1
- 0
pkg/client/base/context/business_action_context.go View File

@@ -7,4 +7,5 @@ type BusinessActionContext struct {
BranchID int64
ActionName string
ActionContext map[string]interface{}
AsyncCommit bool
}

+ 2
- 1
pkg/client/rm/resource_manager.go View File

@@ -157,7 +157,7 @@ func (manager *ResourceManager) branchCommunicate() {
}

func (manager *ResourceManager) BranchRegister(ctx context.Context, xid string, resourceID string,
branchType apis.BranchSession_BranchType, applicationData []byte, lockKeys string) (int64, error) {
branchType apis.BranchSession_BranchType, applicationData []byte, lockKeys string, asyncCommit bool) (int64, error) {
request := &apis.BranchRegisterRequest{
Addressing: manager.addressing,
XID: xid,
@@ -165,6 +165,7 @@ func (manager *ResourceManager) BranchRegister(ctx context.Context, xid string,
LockKey: lockKeys,
BranchType: branchType,
ApplicationData: applicationData,
AsyncCommit: asyncCommit,
}
resp, err := manager.rpcClient.BranchRegister(ctx, request)
if err != nil {


+ 10
- 2
pkg/client/tcc/proxy.go View File

@@ -36,7 +36,7 @@ var (
)

type TccService interface {
Try(ctx *ctx.BusinessActionContext) (bool, error)
Try(ctx *ctx.BusinessActionContext, async bool) (bool, error)
Confirm(ctx *ctx.BusinessActionContext) bool
Cancel(ctx *ctx.BusinessActionContext) bool
}
@@ -162,7 +162,15 @@ func doTccActionLogStore(ctx *ctx.BusinessActionContext, resource *TCCResource)
return 0, err
}

branchID, err := rm.GetResourceManager().BranchRegister(ctx.RootContext, ctx.XID, resource.GetResourceID(), resource.GetBranchType(), applicationData, "")
branchID, err := rm.GetResourceManager().BranchRegister(
ctx.RootContext,
ctx.XID,
resource.GetResourceID(),
resource.GetBranchType(),
applicationData,
"",
ctx.AsyncCommit,
)
if err != nil {
log.Errorf("TCC branch Register error, xid: %s", ctx.XID)
return 0, errors.WithStack(err)


+ 1
- 1
pkg/tc/model/global_transaction.go View File

@@ -31,7 +31,7 @@ func (gt *GlobalTransaction) GetBranch(branchID int64) *apis.BranchSession {

func (gt *GlobalTransaction) CanBeCommittedAsync() bool {
for branchSession := range gt.BranchSessions {
if branchSession.Type == apis.TCC {
if !branchSession.AsyncCommit {
return false
}
}


+ 14
- 6
pkg/tc/server/transaction_coordinator.go View File

@@ -709,11 +709,11 @@ func (tc *TransactionCoordinator) BranchCommunicate(stream apis.ResourceManagerS
func (tc *TransactionCoordinator) BranchRegister(ctx context.Context, request *apis.BranchRegisterRequest) (*apis.BranchRegisterResponse, error) {
gt := tc.holder.FindGlobalTransaction(request.XID)
if gt == nil {
log.Errorf("could not found global transaction xid = %s", request.XID)
log.Errorf("could not find global transaction xid = %s", request.XID)
return &apis.BranchRegisterResponse{
ResultCode: apis.ResultCodeFailed,
ExceptionCode: apis.GlobalTransactionNotExist,
Message: fmt.Sprintf("could not found global transaction xid = %s", request.XID),
Message: fmt.Sprintf("could not find global transaction xid = %s", request.XID),
}, nil
}

@@ -722,7 +722,7 @@ func (tc *TransactionCoordinator) BranchRegister(ctx context.Context, request *a
return &apis.BranchRegisterResponse{
ResultCode: apis.ResultCodeFailed,
ExceptionCode: apis.FailedLockGlobalTransaction,
Message: fmt.Sprintf("could not found global transaction xid = %s", request.XID),
Message: fmt.Sprintf("could not find global transaction xid = %s", request.XID),
}, nil
}
if result {
@@ -743,6 +743,13 @@ func (tc *TransactionCoordinator) BranchRegister(ctx context.Context, request *a
}, nil
}

var asyncCommit bool
if request.BranchType == apis.AT {
asyncCommit = true
} else {
asyncCommit = request.AsyncCommit
}

bs := &apis.BranchSession{
Addressing: request.Addressing,
XID: request.XID,
@@ -753,6 +760,7 @@ func (tc *TransactionCoordinator) BranchRegister(ctx context.Context, request *a
Type: request.BranchType,
Status: apis.Registered,
ApplicationData: request.ApplicationData,
AsyncCommit: asyncCommit,
}

if bs.Type == apis.AT {
@@ -793,11 +801,11 @@ func (tc *TransactionCoordinator) BranchRegister(ctx context.Context, request *a
func (tc *TransactionCoordinator) BranchReport(ctx context.Context, request *apis.BranchReportRequest) (*apis.BranchReportResponse, error) {
gt := tc.holder.FindGlobalTransaction(request.XID)
if gt == nil {
log.Errorf("could not found global transaction xid = %s", request.XID)
log.Errorf("could not find global transaction xid = %s", request.XID)
return &apis.BranchReportResponse{
ResultCode: apis.ResultCodeFailed,
ExceptionCode: apis.GlobalTransactionNotExist,
Message: fmt.Sprintf("could not found global transaction xid = %s", request.XID),
Message: fmt.Sprintf("could not find global transaction xid = %s", request.XID),
}, nil
}

@@ -806,7 +814,7 @@ func (tc *TransactionCoordinator) BranchReport(ctx context.Context, request *api
return &apis.BranchReportResponse{
ResultCode: apis.ResultCodeFailed,
ExceptionCode: apis.BranchTransactionNotExist,
Message: fmt.Sprintf("could not found branch session xid = %s branchID = %d", gt.XID, request.BranchID),
Message: fmt.Sprintf("could not find branch session xid = %s branchID = %d", gt.XID, request.BranchID),
}, nil
}



+ 4
- 4
pkg/tc/storage/driver/inmemory/inmemory.go View File

@@ -121,7 +121,7 @@ func (driver *driver) UpdateGlobalSessionStatus(session *apis.GlobalSession, sta
gt.Status = status
return nil
}
return fmt.Errorf("could not found global transaction xid = %s", session.XID)
return fmt.Errorf("could not find global transaction xid = %s", session.XID)
}

// Inactive global session.
@@ -132,7 +132,7 @@ func (driver *driver) InactiveGlobalSession(session *apis.GlobalSession) error {
gt.Active = false
return nil
}
return fmt.Errorf("could not found global transaction xid = %s", session.XID)
return fmt.Errorf("could not find global transaction xid = %s", session.XID)
}

// Remove global session.
@@ -149,7 +149,7 @@ func (driver *driver) AddBranchSession(globalSession *apis.GlobalSession, sessio
gt.BranchSessions[session] = true
return nil
}
return fmt.Errorf("could not found global transaction xid = %s", session.XID)
return fmt.Errorf("could not find global transaction xid = %s", session.XID)
}

// Find branch session.
@@ -195,7 +195,7 @@ func (driver *driver) RemoveBranchSession(globalSession *apis.GlobalSession, ses
delete(gt.BranchSessions, session)
return nil
}
return fmt.Errorf("could not found global transaction xid = %s", session.XID)
return fmt.Errorf("could not find global transaction xid = %s", session.XID)
}

// AcquireLock Acquire lock boolean.


+ 98
- 63
pkg/tc/storage/driver/mysql/mysql.go View File

@@ -31,13 +31,13 @@ const (
DeleteGlobalTransaction = "delete from %s where xid = ?"

InsertBranchTransaction = `insert into %s (addressing, xid, branch_id, transaction_id, resource_id, lock_key, branch_type,
status, application_data, gmt_create, gmt_modified) values(?, ?, ?, ?, ?, ?, ?, ?, ?, now(), now())`
status, application_data, async_commit, gmt_create, gmt_modified) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, now(), now())`

QueryBranchTransaction = `select addressing, xid, branch_id, transaction_id, resource_id, lock_key, branch_type, status,
application_data, gmt_create, gmt_modified from %s where %s order by gmt_create asc`
application_data, async_commit, gmt_create, gmt_modified from %s where %s order by gmt_create asc`

QueryBranchTransactionByXid = `select addressing, xid, branch_id, transaction_id, resource_id, lock_key, branch_type, status,
application_data, gmt_create, gmt_modified from %s where xid = ? order by gmt_create asc`
application_data, async_commit, gmt_create, gmt_modified from %s where xid = ? order by gmt_create asc`

UpdateBranchTransaction = "update %s set status = ?, gmt_modified = now() where branch_id = ?"

@@ -49,22 +49,58 @@ const (
QueryRowKey = `select xid, transaction_id, branch_id, resource_id, table_name, pk, row_key, gmt_create, gmt_modified
from %s where %s order by gmt_create asc`

CreateGlobalTable = "CREATE TABLE IF NOT EXISTS `%s` (`addressing` varchar(128) NOT NULL, " +
"`xid` varchar(128) NOT NULL, `transaction_id` bigint DEFAULT NULL, " +
"`transaction_name` varchar(128) DEFAULT NULL, `timeout` int DEFAULT NULL, `begin_time` bigint DEFAULT NULL, " +
"`status` tinyint NOT NULL, `active` bit(1) NOT NULL, `gmt_create` datetime DEFAULT NULL, `gmt_modified` datetime DEFAULT NULL, " +
"PRIMARY KEY (`xid`), KEY `idx_gmt_modified_status` (`gmt_modified`,`status`), KEY `idx_transaction_id` (`transaction_id`)) " +
"ENGINE = InnoDB DEFAULT CHARSET = utf8;"

CreateBranchTable = "CREATE TABLE IF NOT EXISTS `%s` (`addressing` varchar(128) NOT NULL, `xid` varchar(128) NOT NULL, " +
"`branch_id` bigint NOT NULL, `transaction_id` bigint DEFAULT NULL, `resource_id` varchar(256) DEFAULT NULL, `lock_key` VARCHAR(1000), " +
"`branch_type` varchar(8) DEFAULT NULL, `status` tinyint DEFAULT NULL, `application_data` varchar(2000) DEFAULT NULL, " +
"`gmt_create` datetime(6) DEFAULT NULL, `gmt_modified` datetime(6) DEFAULT NULL, PRIMARY KEY (`branch_id`), KEY `idx_xid` (`xid`)) " +
"ENGINE = InnoDB DEFAULT CHARSET = utf8;"

CreateLockTable = "CREATE TABLE IF NOT EXISTS `%s` (`row_key` VARCHAR(256) NOT NULL, `xid` VARCHAR(128) NOT NULL, `transaction_id` BIGINT, " +
"`branch_id` BIGINT NOT NULL, `resource_id` VARCHAR(256), `table_name` VARCHAR(64), `pk` VARCHAR(36), `gmt_create` DATETIME, " +
"`gmt_modified` DATETIME, PRIMARY KEY (`row_key`), KEY `idx_branch_id` (`branch_id`)) ENGINE = InnoDB DEFAULT CHARSET = utf8;"
CreateGlobalTable = `
CREATE TABLE IF NOT EXISTS %s
(
addressing varchar(128) NOT NULL,
xid varchar(128) NOT NULL,
transaction_id bigint DEFAULT NULL,
transaction_name varchar(128) DEFAULT NULL,
timeout int DEFAULT NULL,
begin_time bigint DEFAULT NULL,
status tinyint NOT NULL,
active bit(1) NOT NULL,
gmt_create datetime DEFAULT NULL,
gmt_modified datetime DEFAULT NULL,
PRIMARY KEY (xid),
KEY idx_gmt_modified_status (gmt_modified, status),
KEY idx_transaction_id (transaction_id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;`

CreateBranchTable = `
CREATE TABLE IF NOT EXISTS %s
(
addressing varchar(128) NOT NULL,
xid varchar(128) NOT NULL,
branch_id bigint NOT NULL,
transaction_id bigint DEFAULT NULL,
resource_id varchar(256) DEFAULT NULL,
lock_key VARCHAR(1000),
branch_type varchar(8) DEFAULT NULL,
status tinyint DEFAULT NULL,
application_data varchar(2000) DEFAULT NULL,
async_commit tinyint NOT NULL DEFAULT 0,
gmt_create datetime(6) DEFAULT NULL,
gmt_modified datetime(6) DEFAULT NULL,
PRIMARY KEY (branch_id),
KEY idx_xid (xid)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;`

CreateLockTable = `
CREATE TABLE IF NOT EXISTS %s
(
row_key VARCHAR(256) NOT NULL,
xid VARCHAR(128) NOT NULL,
transaction_id BIGINT,
branch_id BIGINT NOT NULL,
resource_id VARCHAR(256),
table_name VARCHAR(64),
pk VARCHAR(36),
gmt_create DATETIME,
gmt_modified DATETIME,
PRIMARY KEY (row_key),
KEY idx_branch_id (branch_id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8;`
)

func init() {
@@ -200,7 +236,7 @@ func FromParameters(parameters map[string]interface{}) (storage.Driver, error) {
return New(driverParameters)
}

// New constructs a new Driver
// New constructs a new Driver.
func New(params DriverParameters) (storage.Driver, error) {
if params.DSN == "" {
return nil, fmt.Errorf("the dsn parameter should not be empty")
@@ -235,7 +271,7 @@ func New(params DriverParameters) (storage.Driver, error) {
}, nil
}

// Add global session.
// AddGlobalSession adds a global session.
func (driver *driver) AddGlobalSession(session *apis.GlobalSession) error {
_, err := driver.engine.Exec(fmt.Sprintf(InsertGlobalTransaction, driver.globalTable),
session.Addressing, session.XID, session.TransactionID, session.TransactionName,
@@ -243,7 +279,7 @@ func (driver *driver) AddGlobalSession(session *apis.GlobalSession) error {
return err
}

// Find global session.
// FindGlobalSession finds a global session by xid.
func (driver *driver) FindGlobalSession(xid string) *apis.GlobalSession {
var globalTransaction apis.GlobalSession
result, err := driver.engine.SQL(fmt.Sprintf(QueryGlobalTransactionByXid, driver.globalTable), xid).
@@ -257,7 +293,7 @@ func (driver *driver) FindGlobalSession(xid string) *apis.GlobalSession {
return nil
}

// Find global sessions list.
// FindGlobalSessions finds global sessions list by statuses list
func (driver *driver) FindGlobalSessions(statuses []apis.GlobalSession_GlobalStatus) []*apis.GlobalSession {
var globalSessions []*apis.GlobalSession
err := driver.engine.Table(driver.globalTable).
@@ -272,9 +308,8 @@ func (driver *driver) FindGlobalSessions(statuses []apis.GlobalSession_GlobalSta
return globalSessions
}

// Find global sessions list with addressing identities
func (driver *driver) FindGlobalSessionsWithAddressingIdentities(statuses []apis.GlobalSession_GlobalStatus,
addressingIdentities []string) []*apis.GlobalSession {
// FindGlobalSessionsWithAddressingIdentities finds global sessions list by addressing identities and statuses list
func (driver *driver) FindGlobalSessionsWithAddressingIdentities(statuses []apis.GlobalSession_GlobalStatus, addressingIdentities []string) []*apis.GlobalSession {
var globalSessions []*apis.GlobalSession
err := driver.engine.Table(driver.globalTable).
Where(builder.
@@ -290,7 +325,7 @@ func (driver *driver) FindGlobalSessionsWithAddressingIdentities(statuses []apis
return globalSessions
}

// All sessions collection.
// AllSessions returns all sessions collection.
func (driver *driver) AllSessions() []*apis.GlobalSession {
var globalSessions []*apis.GlobalSession
err := driver.engine.Table(driver.globalTable).
@@ -304,33 +339,33 @@ func (driver *driver) AllSessions() []*apis.GlobalSession {
return globalSessions
}

// Update global session status.
// UpdateGlobalSessionStatus updates status of global session.
func (driver *driver) UpdateGlobalSessionStatus(session *apis.GlobalSession, status apis.GlobalSession_GlobalStatus) error {
_, err := driver.engine.Exec(fmt.Sprintf(UpdateGlobalTransaction, driver.globalTable), status, session.XID)
return err
}

// Inactive global session.
// InactiveGlobalSession inactivates a global session.
func (driver *driver) InactiveGlobalSession(session *apis.GlobalSession) error {
_, err := driver.engine.Exec(fmt.Sprintf(InactiveGlobalTransaction, driver.globalTable), session.XID)
return err
}

// Remove global session.
// RemoveGlobalSession removes a global session.
func (driver *driver) RemoveGlobalSession(session *apis.GlobalSession) error {
_, err := driver.engine.Exec(fmt.Sprintf(DeleteGlobalTransaction, driver.globalTable), session.XID)
return err
}

// Add branch session.
// AddBranchSession adds a branch session.
func (driver *driver) AddBranchSession(globalSession *apis.GlobalSession, session *apis.BranchSession) error {
_, err := driver.engine.Exec(fmt.Sprintf(InsertBranchTransaction, driver.branchTable),
session.Addressing, session.XID, session.BranchID, session.TransactionID, session.ResourceID, session.LockKey,
session.Type, session.Status, session.ApplicationData)
session.Type, session.Status, session.ApplicationData, session.AsyncCommit)
return err
}

// Find branch session.
// FindBranchSessions finds branch sessions list by xid.
func (driver *driver) FindBranchSessions(xid string) []*apis.BranchSession {
var branchTransactions []*apis.BranchSession
err := driver.engine.SQL(fmt.Sprintf(QueryBranchTransactionByXid, driver.branchTable), xid).Find(&branchTransactions)
@@ -340,7 +375,7 @@ func (driver *driver) FindBranchSessions(xid string) []*apis.BranchSession {
return branchTransactions
}

// Find branch session.
// FindBatchBranchSessions finds branch sessions list by xids list.
func (driver *driver) FindBatchBranchSessions(xids []string) []*apis.BranchSession {
var (
branchTransactions []*apis.BranchSession
@@ -358,7 +393,7 @@ func (driver *driver) FindBatchBranchSessions(xids []string) []*apis.BranchSessi
return branchTransactions
}

// Update branch session status.
// UpdateBranchSessionStatus updates status of branch session.
func (driver *driver) UpdateBranchSessionStatus(session *apis.BranchSession, status apis.BranchSession_BranchStatus) error {
_, err := driver.engine.Exec(fmt.Sprintf(UpdateBranchTransaction, driver.branchTable),
status,
@@ -366,14 +401,14 @@ func (driver *driver) UpdateBranchSessionStatus(session *apis.BranchSession, sta
return err
}

// Remove branch session.
// RemoveBranchSession removes branch session.
func (driver *driver) RemoveBranchSession(globalSession *apis.GlobalSession, session *apis.BranchSession) error {
_, err := driver.engine.Exec(fmt.Sprintf(DeleteBranchTransaction, driver.branchTable),
session.BranchID)
return err
}

// AcquireLock Acquire lock boolean.
// AcquireLock acquires row locks.
func (driver *driver) AcquireLock(rowLocks []*apis.RowLock) bool {
locks, rowKeyArgs := distinctByKey(rowLocks)
var existedRowLocks []*apis.RowLock
@@ -439,31 +474,7 @@ func (driver *driver) AcquireLock(rowLocks []*apis.RowLock) bool {
return true
}

func distinctByKey(locks []*apis.RowLock) ([]*apis.RowLock, []interface{}) {
result := make([]*apis.RowLock, 0)
rowKeys := make([]interface{}, 0)
lockMap := make(map[string]byte)
for _, lockDO := range locks {
l := len(lockMap)
lockMap[lockDO.RowKey] = 0
if len(lockMap) != l {
result = append(result, lockDO)
rowKeys = append(rowKeys, lockDO.RowKey)
}
}
return result, rowKeys
}

func contains(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}

// ReleaseLock Unlock boolean.
// ReleaseLock releases locked rows.
func (driver *driver) ReleaseLock(rowLocks []*apis.RowLock) bool {
if rowLocks != nil && len(rowLocks) == 0 {
return true
@@ -485,7 +496,7 @@ func (driver *driver) ReleaseLock(rowLocks []*apis.RowLock) bool {
return true
}

// IsLockable Is lockable boolean.
// IsLockable checks if a global transaction is lockable by xid, resourceID, lockKey.
func (driver *driver) IsLockable(xid string, resourceID string, lockKey string) bool {
locks := storage.CollectRowLocks(lockKey, resourceID, xid)
var existedRowLocks []*apis.RowLock
@@ -507,3 +518,27 @@ func (driver *driver) IsLockable(xid string, resourceID string, lockKey string)
}
return true
}

func distinctByKey(locks []*apis.RowLock) ([]*apis.RowLock, []interface{}) {
result := make([]*apis.RowLock, 0)
rowKeys := make([]interface{}, 0)
lockMap := make(map[string]byte)
for _, lockDO := range locks {
l := len(lockMap)
lockMap[lockDO.RowKey] = 0
if len(lockMap) != l {
result = append(result, lockDO)
rowKeys = append(rowKeys, lockDO.RowKey)
}
}
return result, rowKeys
}

func contains(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}

+ 70
- 70
pkg/tc/storage/driver/pgsql/pgsql.go View File

@@ -31,13 +31,13 @@ const (
DeleteGlobalTransaction = "delete from %s where xid = $1"

InsertBranchTransaction = `insert into %s (addressing, xid, branch_id, transaction_id, resource_id, lock_key, branch_type,
status, application_data, gmt_create, gmt_modified) values($1, $2, $3, $4, $5, $6, $7, $8, $9, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)`
status, application_data, async_commit, gmt_create, gmt_modified) values($1, $2, $3, $4, $5, $6, $7, $8, $9, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)`

QueryBranchTransaction = `select addressing, xid, branch_id, transaction_id, resource_id, lock_key, branch_type, status,
application_data, gmt_create, gmt_modified from %s where %s order by gmt_create asc`
application_data, async_commit, gmt_create, gmt_modified from %s where %s order by gmt_create asc`

QueryBranchTransactionByXid = `select addressing, xid, branch_id, transaction_id, resource_id, lock_key, branch_type, status,
application_data, gmt_create, gmt_modified from %s where xid = $1 order by gmt_create asc`
application_data, async_commit, gmt_create, gmt_modified from %s where xid = $1 order by gmt_create asc`

UpdateBranchTransaction = "update %s set status = $1, gmt_modified = CURRENT_TIMESTAMP where branch_id = $2"

@@ -52,17 +52,17 @@ const (
CreateGlobalTable = `
CREATE TABLE IF NOT EXISTS %s
(
addressing varchar(128) NOT NULL,
xid varchar(128) NOT NULL,
transaction_id bigint DEFAULT NULL,
transaction_name varchar(128) DEFAULT NULL,
timeout int DEFAULT NULL,
begin_time bigint DEFAULT NULL,
status int NOT NULL,
active bool NOT NULL,
gmt_create timestamp DEFAULT NULL,
gmt_modified timestamp DEFAULT NULL,
PRIMARY KEY (xid)
addressing varchar(128) NOT NULL,
xid varchar(128) NOT NULL,
transaction_id bigint DEFAULT NULL,
transaction_name varchar(128) DEFAULT NULL,
timeout int DEFAULT NULL,
begin_time bigint DEFAULT NULL,
status int NOT NULL,
active bool NOT NULL,
gmt_create timestamp DEFAULT NULL,
gmt_modified timestamp DEFAULT NULL,
PRIMARY KEY (xid)
);
CREATE INDEX IF NOT EXISTS idx_gmt_modified_status ON %s(gmt_modified, status);
CREATE INDEX IF NOT EXISTS idx_transaction_id ON %s(transaction_id);`
@@ -70,18 +70,19 @@ const (
CreateBranchTable = `
CREATE TABLE IF NOT EXISTS %s
(
addressing varchar(128) NOT NULL,
xid varchar(128) NOT NULL,
branch_id bigint NOT NULL,
transaction_id bigint DEFAULT NULL,
resource_id varchar(256) DEFAULT NULL,
lock_key VARCHAR(1000),
branch_type varchar(8) DEFAULT NULL,
status int DEFAULT NULL,
application_data varchar(2000) DEFAULT NULL,
gmt_create timestamp DEFAULT NULL,
gmt_modified timestamp DEFAULT NULL,
PRIMARY KEY (branch_id)
addressing varchar(128) NOT NULL,
xid varchar(128) NOT NULL,
branch_id bigint NOT NULL,
transaction_id bigint DEFAULT NULL,
resource_id varchar(256) DEFAULT NULL,
lock_key VARCHAR(1000),
branch_type varchar(8) DEFAULT NULL,
status int DEFAULT NULL,
application_data varchar(2000) DEFAULT NULL,
async_commit tinyint NOT NULL DEFAULT 0,
gmt_create timestamp DEFAULT NULL,
gmt_modified timestamp DEFAULT NULL,
PRIMARY KEY (branch_id)
);
CREATE INDEX IF NOT EXISTS idx_xid ON %s(xid);`

@@ -235,7 +236,7 @@ func FromParameters(parameters map[string]interface{}) (storage.Driver, error) {
return New(driverParameters)
}

// New constructs a new Driver
// New constructs a new Driver.
func New(params DriverParameters) (storage.Driver, error) {
if params.DSN == "" {
return nil, fmt.Errorf("the dsn parameter should not be empty")
@@ -270,7 +271,7 @@ func New(params DriverParameters) (storage.Driver, error) {
}, nil
}

// Add global session.
// AddGlobalSession adds a global session.
func (driver *driver) AddGlobalSession(session *apis.GlobalSession) error {
_, err := driver.engine.Exec(fmt.Sprintf(InsertGlobalTransaction, driver.globalTable),
session.Addressing, session.XID, session.TransactionID, session.TransactionName,
@@ -278,7 +279,7 @@ func (driver *driver) AddGlobalSession(session *apis.GlobalSession) error {
return err
}

// Find global session.
// FindGlobalSession finds a global session by xid.
func (driver *driver) FindGlobalSession(xid string) *apis.GlobalSession {
var globalTransaction apis.GlobalSession
result, err := driver.engine.SQL(fmt.Sprintf(QueryGlobalTransactionByXid, driver.globalTable), xid).
@@ -292,7 +293,7 @@ func (driver *driver) FindGlobalSession(xid string) *apis.GlobalSession {
return nil
}

// Find global sessions list.
// FindGlobalSessions finds global sessions list by statuses list
func (driver *driver) FindGlobalSessions(statuses []apis.GlobalSession_GlobalStatus) []*apis.GlobalSession {
var globalSessions []*apis.GlobalSession
err := driver.engine.Table(driver.globalTable).
@@ -307,9 +308,8 @@ func (driver *driver) FindGlobalSessions(statuses []apis.GlobalSession_GlobalSta
return globalSessions
}

// Find global sessions list with addressing identities
func (driver *driver) FindGlobalSessionsWithAddressingIdentities(statuses []apis.GlobalSession_GlobalStatus,
addressingIdentities []string) []*apis.GlobalSession {
// FindGlobalSessionsWithAddressingIdentities finds global sessions list by addressing identities and statuses list
func (driver *driver) FindGlobalSessionsWithAddressingIdentities(statuses []apis.GlobalSession_GlobalStatus, addressingIdentities []string) []*apis.GlobalSession {
var globalSessions []*apis.GlobalSession
err := driver.engine.Table(driver.globalTable).
Where(builder.
@@ -325,7 +325,7 @@ func (driver *driver) FindGlobalSessionsWithAddressingIdentities(statuses []apis
return globalSessions
}

// All sessions collection.
// AllSessions returns all sessions collection.
func (driver *driver) AllSessions() []*apis.GlobalSession {
var globalSessions []*apis.GlobalSession
err := driver.engine.Table(driver.globalTable).
@@ -338,33 +338,33 @@ func (driver *driver) AllSessions() []*apis.GlobalSession {
return globalSessions
}

// Update global session status.
// UpdateGlobalSessionStatus updates status of global session.
func (driver *driver) UpdateGlobalSessionStatus(session *apis.GlobalSession, status apis.GlobalSession_GlobalStatus) error {
_, err := driver.engine.Exec(fmt.Sprintf(UpdateGlobalTransaction, driver.globalTable), status, session.XID)
return err
}

// Inactive global session.
// InactiveGlobalSession inactivates a global session.
func (driver *driver) InactiveGlobalSession(session *apis.GlobalSession) error {
_, err := driver.engine.Exec(fmt.Sprintf(InactiveGlobalTransaction, driver.globalTable), session.XID)
return err
}

// Remove global session.
// RemoveGlobalSession removes a global session.
func (driver *driver) RemoveGlobalSession(session *apis.GlobalSession) error {
_, err := driver.engine.Exec(fmt.Sprintf(DeleteGlobalTransaction, driver.globalTable), session.XID)
return err
}

// Add branch session.
// AddBranchSession adds a branch session.
func (driver *driver) AddBranchSession(globalSession *apis.GlobalSession, session *apis.BranchSession) error {
_, err := driver.engine.Exec(fmt.Sprintf(InsertBranchTransaction, driver.branchTable),
session.Addressing, session.XID, session.BranchID, session.TransactionID, session.ResourceID, session.LockKey,
session.Type, session.Status, session.ApplicationData)
session.Type, session.Status, session.ApplicationData, session.AsyncCommit)
return err
}

// Find branch session.
// FindBranchSessions finds branch sessions list by xid.
func (driver *driver) FindBranchSessions(xid string) []*apis.BranchSession {
var branchTransactions []*apis.BranchSession
err := driver.engine.SQL(fmt.Sprintf(QueryBranchTransactionByXid, driver.branchTable), xid).Find(&branchTransactions)
@@ -374,7 +374,7 @@ func (driver *driver) FindBranchSessions(xid string) []*apis.BranchSession {
return branchTransactions
}

// Find branch session.
// FindBatchBranchSessions finds branch sessions list by xids list.
func (driver *driver) FindBatchBranchSessions(xids []string) []*apis.BranchSession {
var (
branchTransactions []*apis.BranchSession
@@ -392,7 +392,7 @@ func (driver *driver) FindBatchBranchSessions(xids []string) []*apis.BranchSessi
return branchTransactions
}

// Update branch session status.
// UpdateBranchSessionStatus updates status of branch session.
func (driver *driver) UpdateBranchSessionStatus(session *apis.BranchSession, status apis.BranchSession_BranchStatus) error {
_, err := driver.engine.Exec(fmt.Sprintf(UpdateBranchTransaction, driver.branchTable),
status,
@@ -400,14 +400,14 @@ func (driver *driver) UpdateBranchSessionStatus(session *apis.BranchSession, sta
return err
}

// Remove branch session.
// RemoveBranchSession removes branch session.
func (driver *driver) RemoveBranchSession(globalSession *apis.GlobalSession, session *apis.BranchSession) error {
_, err := driver.engine.Exec(fmt.Sprintf(DeleteBranchTransaction, driver.branchTable),
session.BranchID)
return err
}

// AcquireLock Acquire lock boolean.
// AcquireLock acquires row locks.
func (driver *driver) AcquireLock(rowLocks []*apis.RowLock) bool {
locks, rowKeyArgs := distinctByKey(rowLocks)
var existedRowLocks []*apis.RowLock
@@ -473,31 +473,7 @@ func (driver *driver) AcquireLock(rowLocks []*apis.RowLock) bool {
return true
}

func distinctByKey(locks []*apis.RowLock) ([]*apis.RowLock, []interface{}) {
result := make([]*apis.RowLock, 0)
rowKeys := make([]interface{}, 0)
lockMap := make(map[string]byte)
for _, lockDO := range locks {
l := len(lockMap)
lockMap[lockDO.RowKey] = 0
if len(lockMap) != l {
result = append(result, lockDO)
rowKeys = append(rowKeys, lockDO.RowKey)
}
}
return result, rowKeys
}

func contains(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}

// ReleaseLock Unlock boolean.
// ReleaseLock releases locked rows.
func (driver *driver) ReleaseLock(rowLocks []*apis.RowLock) bool {
if rowLocks != nil && len(rowLocks) == 0 {
return true
@@ -519,7 +495,7 @@ func (driver *driver) ReleaseLock(rowLocks []*apis.RowLock) bool {
return true
}

// IsLockable Is lockable boolean.
// IsLockable checks if a global transaction is lockable by xid, resourceID, lockKey.
func (driver *driver) IsLockable(xid string, resourceID string, lockKey string) bool {
locks := storage.CollectRowLocks(lockKey, resourceID, xid)
var existedRowLocks []*apis.RowLock
@@ -541,3 +517,27 @@ func (driver *driver) IsLockable(xid string, resourceID string, lockKey string)
}
return true
}

func distinctByKey(locks []*apis.RowLock) ([]*apis.RowLock, []interface{}) {
result := make([]*apis.RowLock, 0)
rowKeys := make([]interface{}, 0)
lockMap := make(map[string]byte)
for _, lockDO := range locks {
l := len(lockMap)
lockMap[lockDO.RowKey] = 0
if len(lockMap) != l {
result = append(result, lockDO)
rowKeys = append(rowKeys, lockDO.RowKey)
}
}
return result, rowKeys
}

func contains(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}

+ 1
- 0
scripts/server/db/mysql.sql View File

@@ -36,6 +36,7 @@ CREATE TABLE IF NOT EXISTS `branch_table`
`branch_type` varchar(8) DEFAULT NULL,
`status` tinyint DEFAULT NULL,
`application_data` varchar(2000) DEFAULT NULL,
`async_commit` tinyint NOT NULL DEFAULT 1,
`gmt_create` datetime(6) DEFAULT NULL,
`gmt_modified` datetime(6) DEFAULT NULL,
PRIMARY KEY (`branch_id`),


+ 1
- 0
scripts/server/db/pgsql.sql View File

@@ -33,6 +33,7 @@ CREATE TABLE IF NOT EXISTS branch_table
branch_type varchar(8) DEFAULT NULL,
status int DEFAULT NULL,
application_data varchar(2000) DEFAULT NULL,
async_commit tinyint NOT NULL DEFAULT 1,
gmt_create timestamp DEFAULT NULL,
gmt_modified timestamp DEFAULT NULL,
PRIMARY KEY (branch_id)


Loading…
Cancel
Save