Skip to content

Commit 4568082

Browse files
authored
Fix AllocationIdIT test failure on WindowFS (#67179)
This test failed on WindowsFS. We failed to remove the corrupted file if it's being opened (for a short window by ListShardStore action) and the pending delete files were clear when we restarted that node. This commit fixes the issue by shutting down the node before removing the corrupted file to avoid any access to that file. Closes #66893
1 parent eaa0d92 commit 4568082

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

server/src/internalClusterTest/java/org/elasticsearch/cluster/routing/AllocationIdIT.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,16 @@ public void testFailedRecoveryOnAllocateStalePrimaryRequiresAnotherAllocateStale
136136
assertThat(shardRouting.unassignedInfo().getReason(), equalTo(UnassignedInfo.Reason.ALLOCATION_FAILED));
137137
});
138138

139+
internalCluster().stopNode(node1);
139140
try(Store store = new Store(shardId, indexSettings, new SimpleFSDirectory(indexPath), new DummyShardLock(shardId))) {
140141
store.removeCorruptionMarker();
141142
}
143+
node1 = internalCluster().startNode(node1DataPathSettings);
142144

143145
// index is red: no any shard is allocated (allocation id is a fake id that does not match to anything)
144146
checkHealthStatus(indexName, ClusterHealthStatus.RED);
145147
checkNoValidShardCopy(indexName, shardId);
146148

147-
internalCluster().restartNode(node1, InternalTestCluster.EMPTY_CALLBACK);
148-
149-
// index is still red due to mismatch of allocation id
150-
checkHealthStatus(indexName, ClusterHealthStatus.RED);
151-
checkNoValidShardCopy(indexName, shardId);
152-
153149
// no any valid shard is there; have to invoke AllocateStalePrimary again
154150
client().admin().cluster().prepareReroute()
155151
.add(new AllocateStalePrimaryAllocationCommand(indexName, 0, node1, true))

0 commit comments

Comments
 (0)