-
Notifications
You must be signed in to change notification settings - Fork 246
Open
Description
pdOracle:
client-go/oracle/oracles/pd.go
Lines 217 to 225 in 3150e38
| // 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
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
Labels
No labels