Skip to content

pdOracle doesn't have retry mechanism like KVStore #1643

@rleungx

Description

@rleungx

pdOracle:

// GetTimestamp gets a new increasing time.
func (o *pdOracle) GetTimestamp(ctx context.Context, opt *oracle.Option) (uint64, error) {
ts, err := o.getTimestamp(ctx, opt.TxnScope)
if err != nil {
return 0, err
}
o.setLastTS(ts, opt.TxnScope)
return ts, nil
}

KVStore

client-go/tikv/kv.go

Lines 463 to 471 in 3150e38

// CurrentTimestamp returns current timestamp with the given txnScope (local or global).
func (s *KVStore) CurrentTimestamp(txnScope string) (uint64, error) {
bo := retry.NewBackofferWithVars(context.Background(), transaction.TsoMaxBackoff, nil)
startTS, err := s.getTimestampWithRetry(bo, txnScope)
if err != nil {
return 0, err
}
return startTS, nil
}

If PD has a leader change, the first one will directly return the error instead of retrying.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions