-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tikvclient: reduce wait backoff time when lock has be expired (#10006)
- Loading branch information
Showing
12 changed files
with
202 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2019 PingCAP, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package oracles | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/pingcap/tidb/store/tikv/oracle" | ||
) | ||
|
||
// SetOracleHookCurrentTime exports localOracle's time hook to test. | ||
func SetOracleHookCurrentTime(oc oracle.Oracle, t time.Time) { | ||
switch o := oc.(type) { | ||
case *localOracle: | ||
if o.hook == nil { | ||
o.hook = &struct { | ||
currentTime time.Time | ||
}{} | ||
} | ||
o.hook.currentTime = t | ||
} | ||
} | ||
|
||
// ClearOracleHook exports localOracle's clear hook method | ||
func ClearOracleHook(oc oracle.Oracle) { | ||
switch o := oc.(type) { | ||
case *localOracle: | ||
o.hook = nil | ||
} | ||
} | ||
|
||
// NewEmptyPDOracle exports pdOracle struct to test | ||
func NewEmptyPDOracle() oracle.Oracle { | ||
return &pdOracle{} | ||
} | ||
|
||
// SetEmptyPDOracleLastTs exports PD oracle's last ts to test. | ||
func SetEmptyPDOracleLastTs(oc oracle.Oracle, ts uint64) { | ||
switch o := oc.(type) { | ||
case *pdOracle: | ||
o.lastTS = ts | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.