Skip to content

Commit

Permalink
avoid negative number
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 authored and ti-chi-bot committed Nov 3, 2022
1 parent 7c111b7 commit 77d3c07
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public Pair<TiRegion, Store> getRegionStorePairByKey(
// select a tiflash with Round-Robin strategy
if (tiflashStores.size() > 0) {
store =
tiflashStores.get(Math.abs(tiflashStoreIndex.getAndIncrement() % tiflashStores.size()));
tiflashStores.get(
Math.floorMod(tiflashStoreIndex.getAndIncrement(), tiflashStores.size()));
}

if (store == null) {
Expand Down

0 comments on commit 77d3c07

Please sign in to comment.