Skip to content

Commit 2f07e90

Browse files
committed
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 dad1e91 commit 2f07e90

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

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

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

138+
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(node1));
138139
try(Store store = new Store(shardId, indexSettings, new SimpleFSDirectory(indexPath), new DummyShardLock(shardId))) {
139140
store.removeCorruptionMarker();
140141
}
142+
node1 = internalCluster().startNode();
141143

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

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

0 commit comments

Comments
 (0)