[close #663] Avoid overflow (#664)

Signed-off-by: shiyuhang <1136742008@qq.com>
This commit is contained in:
shi yuhang 2022-12-20 20:31:42 +08:00 committed by GitHub
parent 8936a91a98
commit 24ed9e2b8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -203,9 +203,11 @@ public class RegionManager {
}
}
}
// select a tiflash with RR strategy
// select a tiflash with Round-Robin strategy
if (tiflashStores.size() > 0) {
store = tiflashStores.get(tiflashStoreIndex.getAndIncrement() % tiflashStores.size());
store =
tiflashStores.get(
Math.floorMod(tiflashStoreIndex.getAndIncrement(), tiflashStores.size()));
}
if (store == null) {