Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing DataStreamsUpgradeIT
Browse files Browse the repository at this point in the history
masseyke committed Jan 17, 2025
1 parent 8b2cac0 commit f123715
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -263,11 +263,15 @@ private static void createAndRolloverDataStream(String dataStreamName, int numRo

private void upgradeDataStream(String dataStreamName, int numRolloversOnOldCluster) throws Exception {
Set<String> indicesNeedingUpgrade = getDataStreamIndices(dataStreamName);
Set<String> closedOnOldClusterIndices = getClosedIndices(dataStreamName);
Set<String> closedOldIndices = getClosedIndices(dataStreamName);
final int explicitRolloverOnNewClusterCount = randomIntBetween(0, 2);
for (int i = 0; i < explicitRolloverOnNewClusterCount; i++) {
String oldIndexName = rollover(dataStreamName);
if (randomBoolean()) {
if (i == 0) {
// Since this is the first rollover on the new cluster, the old index came from the old cluster
closedOldIndices.add(oldIndexName);
}
closeIndex(oldIndexName);
}
}
@@ -312,12 +316,12 @@ private void upgradeDataStream(String dataStreamName, int numRolloversOnOldClust
*/
assertThat(
statusResponseMap.get("total_indices_requiring_upgrade"),
equalTo(originalWriteIndex + numRolloversOnOldCluster - closedOnOldClusterIndices.size())
equalTo(originalWriteIndex + numRolloversOnOldCluster - closedOldIndices.size())
);
assertThat(statusResponseMap.get("successes"), equalTo(numRolloversOnOldCluster + 1 - closedOnOldClusterIndices.size()));
assertThat(statusResponseMap.get("successes"), equalTo(numRolloversOnOldCluster + 1 - closedOldIndices.size()));
// We expect all the original indices to have been deleted
for (String oldIndex : indicesNeedingUpgrade) {
if (closedOnOldClusterIndices.contains(oldIndex) == false) {
if (closedOldIndices.contains(oldIndex) == false) {
assertThat(indexExists(oldIndex), equalTo(false));
}
}

0 comments on commit f123715

Please sign in to comment.