Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ public ClusterState execute(ClusterState currentState) {
minIndexCompatibilityVersion);
continue;
}
if (currentState.nodes().getMinNodeVersion().before(indexMetaData.getCreationVersion())) {
logger.warn("ignoring dangled index [{}] on node [{}]" +
" since its created version [{}] is later than the oldest versioned node in the cluster [{}]",
indexMetaData.getIndex(), request.fromNode, indexMetaData.getCreationVersion(),
currentState.getNodes().getMasterNode().getVersion());
continue;
}
if (currentState.metaData().hasIndex(indexMetaData.getIndex().getName())) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,28 @@ public void testDanglingIndicesWithAliasConflict() throws Exception {
assertNotNull(clusterService.state().getMetaData().index(alias));
}

public void testDanglingIndicesWithLaterVersion() throws Exception {
final String indexNameLater = "test-idxnewer";
final ClusterService clusterService = getInstanceFromNode(ClusterService.class);
final ClusterState originalState = clusterService.state();

//import an index with minor version incremented by one over cluster master version, it should be ignored
final LocalAllocateDangledIndices dangling = getInstanceFromNode(LocalAllocateDangledIndices.class);
final Settings idxSettingsLater = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED,
Version.fromId(Version.CURRENT.id + 10000))
.put(IndexMetaData.SETTING_INDEX_UUID, UUIDs.randomBase64UUID())
.build();
final IndexMetaData indexMetaDataLater = new IndexMetaData.Builder(indexNameLater)
.settings(idxSettingsLater)
.numberOfShards(1)
.numberOfReplicas(0)
.build();
CountDownLatch latch = new CountDownLatch(1);
dangling.allocateDangled(Arrays.asList(indexMetaDataLater), ActionListener.wrap(latch::countDown));
latch.await();
assertThat(clusterService.state(), equalTo(originalState));
}

/**
* This test checks an edge case where, if a node had an index (lets call it A with UUID 1), then
* deleted it (so a tombstone entry for A will exist in the cluster state), then created
Expand Down