mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-09 06:25:07 +00:00
add defense to selectNewPathForShard
This commit is contained in:
parent
ed5e5db188
commit
37e0e63a65
@ -187,7 +187,7 @@ public final class ShardPath {
|
|||||||
// TODO - do we need something more extensible? Yet, this does the job for now...
|
// TODO - do we need something more extensible? Yet, this does the job for now...
|
||||||
final NodeEnvironment.NodePath[] paths = env.nodePaths();
|
final NodeEnvironment.NodePath[] paths = env.nodePaths();
|
||||||
NodeEnvironment.NodePath bestPath = null;
|
NodeEnvironment.NodePath bestPath = null;
|
||||||
BigInteger maxUsableBytes = BigInteger.valueOf(-1);
|
BigInteger maxUsableBytes = BigInteger.valueOf(Long.MIN_VALUE);
|
||||||
for (NodeEnvironment.NodePath nodePath : paths) {
|
for (NodeEnvironment.NodePath nodePath : paths) {
|
||||||
FileStore fileStore = nodePath.fileStore;
|
FileStore fileStore = nodePath.fileStore;
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ public final class ShardPath {
|
|||||||
if (count != null) {
|
if (count != null) {
|
||||||
usableBytes = usableBytes.subtract(estShardSizeInBytes.multiply(BigInteger.valueOf(count)));
|
usableBytes = usableBytes.subtract(estShardSizeInBytes.multiply(BigInteger.valueOf(count)));
|
||||||
}
|
}
|
||||||
if (usableBytes.compareTo(maxUsableBytes) > 0) {
|
if (bestPath == null || usableBytes.compareTo(maxUsableBytes) > 0) {
|
||||||
maxUsableBytes = usableBytes;
|
maxUsableBytes = usableBytes;
|
||||||
bestPath = nodePath;
|
bestPath = nodePath;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user