Skip to content

Commit 3e624bf

Browse files
committed
better failure when trying to obtain a native lock on the node data location, and reduce the tries from 100 to 50.
1 parent e1c86b8 commit 3e624bf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/elasticsearch/src/main/java/org/elasticsearch/env/NodeEnvironment.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public class NodeEnvironment extends AbstractComponent {
5656
Lock lock = null;
5757
File dir = null;
5858
int localNodeId = -1;
59-
for (int i = 0; i < 100; i++) {
59+
IOException lastException = null;
60+
for (int i = 0; i < 50; i++) {
6061
dir = new File(new File(environment.dataWithClusterFile(), "nodes"), Integer.toString(i));
6162
if (!dir.exists()) {
6263
dir.mkdirs();
@@ -71,11 +72,11 @@ public class NodeEnvironment extends AbstractComponent {
7172
break;
7273
}
7374
} catch (IOException e) {
74-
// ignore
75+
lastException = e;
7576
}
7677
}
7778
if (lock == null) {
78-
throw new IOException("Failed to obtain node lock");
79+
throw new IOException("Failed to obtain node lock", lastException);
7980
}
8081
this.localNodeId = localNodeId;
8182
this.lock = lock;

0 commit comments

Comments
 (0)