Skip to content

Commit

Permalink
optimize scan resolve lock
Browse files Browse the repository at this point in the history
Signed-off-by: birdstorm <[email protected]>
  • Loading branch information
birdstorm committed Aug 5, 2021
1 parent 4aad320 commit d701470
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tikv-client/scripts/proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CURRENT_DIR=`pwd`
TISPARK_HOME="$(cd "`dirname "$0"`"/../..; pwd)"
cd $TISPARK_HOME/tikv-client

kvproto_hash=6ed99a08e262d8a32d6355dcba91cf99cb92074a
kvproto_hash=5dfa7b1325a3bfc07100eb2bcde655950122fa25

raft_rs_hash=b9891b673573fad77ebcf9bbe0969cf945841926

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,20 +279,22 @@ public boolean handleResponseError(BackOffer backOffer, RespT resp) {
boolean retry = false;

if (resp instanceof ScanResponse) {
List<KvPair> kvPairs = ((ScanResponse) resp).getPairsList();
List<Lock> locks = new ArrayList<>();
for (KvPair kvPair : kvPairs) {
if (kvPair.hasError()) {
Lock lock = AbstractLockResolverClient.extractLockFromKeyErr(kvPair.getError());
locks.add(lock);
if (((ScanResponse) resp).hasError()) {
List<KvPair> kvPairs = ((ScanResponse) resp).getPairsList();
List<Lock> locks = new ArrayList<>();
for (KvPair kvPair : kvPairs) {
if (kvPair.hasError()) {
Lock lock = AbstractLockResolverClient.extractLockFromKeyErr(kvPair.getError());
locks.add(lock);
}
}
}
if (!locks.isEmpty()) {
try {
resolveLocks(backOffer, locks);
retry = true;
} catch (KeyException e) {
logger.warn("Unable to handle KeyExceptions other than LockException", e);
if (!locks.isEmpty()) {
try {
resolveLocks(backOffer, locks);
retry = true;
} catch (KeyException e) {
logger.warn("Unable to handle KeyExceptions other than LockException", e);
}
}
}
} else {
Expand Down

0 comments on commit d701470

Please sign in to comment.