[TEST] Register data.path for all nodes on close in InternalTestCluster
We need to register those data paths otherwise we might miss path that need to get cleaned when using local gatway etc. which can otherwise cause imports of dangeling indices.
This commit is contained in:
parent
2f40b464ad
commit
c6c709eda2
|
@ -784,11 +784,16 @@ public final class InternalTestCluster extends TestCluster {
|
|||
transportClient = null;
|
||||
}
|
||||
|
||||
void closeNode() {
|
||||
registerDataPath();
|
||||
node.close();
|
||||
}
|
||||
|
||||
void restart(RestartCallback callback) throws Exception {
|
||||
assert callback != null;
|
||||
resetClient();
|
||||
if (!node.isClosed()) {
|
||||
node.close();
|
||||
closeNode();
|
||||
}
|
||||
Settings newSettings = callback.onNodeStopped(name);
|
||||
if (newSettings == null) {
|
||||
|
@ -797,18 +802,25 @@ public final class InternalTestCluster extends TestCluster {
|
|||
if (callback.clearData(name)) {
|
||||
NodeEnvironment nodeEnv = getInstanceFromNode(NodeEnvironment.class, node);
|
||||
if (nodeEnv.hasNodeFile()) {
|
||||
IOUtils.rm(FileSystemUtils.toPaths(nodeEnv.nodeDataLocations()));
|
||||
IOUtils.rm(nodeEnv.nodeDataPaths());
|
||||
}
|
||||
}
|
||||
node = (InternalNode) nodeBuilder().settings(node.settings()).settings(newSettings).node();
|
||||
}
|
||||
|
||||
void registerDataPath() {
|
||||
NodeEnvironment nodeEnv = getInstanceFromNode(NodeEnvironment.class, node);
|
||||
if (nodeEnv.hasNodeFile()) {
|
||||
dataDirToClean.addAll(Arrays.asList(nodeEnv.nodeDataPaths()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
resetClient();
|
||||
closed.set(true);
|
||||
node.close();
|
||||
closeNode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1205,7 +1217,7 @@ public final class InternalTestCluster extends TestCluster {
|
|||
if (activeDisruptionScheme != null) {
|
||||
activeDisruptionScheme.removeFromNode(nodeAndClient.name, this);
|
||||
}
|
||||
nodeAndClient.node.close();
|
||||
nodeAndClient.closeNode();
|
||||
}
|
||||
for (NodeAndClient nodeAndClient : nodes.values()) {
|
||||
logger.info("Starting node [{}] ", nodeAndClient.name);
|
||||
|
@ -1413,7 +1425,7 @@ public final class InternalTestCluster extends TestCluster {
|
|||
assert !nodeAndClient.node().isClosed();
|
||||
NodeEnvironment nodeEnv = getInstanceFromNode(NodeEnvironment.class, nodeAndClient.node);
|
||||
if (nodeEnv.hasNodeFile()) {
|
||||
dataDirToClean.addAll(Arrays.asList(FileSystemUtils.toPaths(nodeEnv.nodeDataLocations())));
|
||||
dataDirToClean.addAll(Arrays.asList(nodeEnv.nodeDataPaths()));
|
||||
}
|
||||
nodes.put(nodeAndClient.name, nodeAndClient);
|
||||
applyDisruptionSchemeToNode(nodeAndClient);
|
||||
|
|
Loading…
Reference in New Issue