Clear up some confusing code in IndexShardHotSpotTests (#1534)
* clear up some useless but confusing test code Signed-off-by: Weiguo Chen <viggoc96@gmail.com> * remove useless comment Signed-off-by: Weiguo Chen <viggoc96@gmail.com>
This commit is contained in:
parent
84cba7b0f6
commit
5dfd05c713
|
@ -20,14 +20,7 @@ public class IndexShardHotSpotTests extends OpenSearchAllocationWithConstraintsT
|
|||
terminateNodes("node_1");
|
||||
assertForIndexShardHotSpots(false, 4);
|
||||
addNodesWithoutIndexing(1, "new_node_");
|
||||
int movesForModeNone = allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0");
|
||||
|
||||
setupInitialCluster(5, 1, 5, 1);
|
||||
terminateNodes("node_1");
|
||||
assertForIndexShardHotSpots(false, 4);
|
||||
addNodesWithoutIndexing(1, "new_node_");
|
||||
int movesForModeUnassigned = allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0");
|
||||
assertTrue(movesForModeUnassigned <= movesForModeNone);
|
||||
allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,15 +32,7 @@ public class IndexShardHotSpotTests extends OpenSearchAllocationWithConstraintsT
|
|||
terminateNodes("node_1");
|
||||
assertForIndexShardHotSpots(false, 4);
|
||||
addNodesWithIndexing(1, "new_node_", 3, 20, 1);
|
||||
int movesForModeNone = allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0");
|
||||
|
||||
resetCluster();
|
||||
buildAllocationService();
|
||||
terminateNodes("node_1");
|
||||
assertForIndexShardHotSpots(false, 4);
|
||||
addNodesWithIndexing(1, "new_node_", 3, 20, 1);
|
||||
int movesForModeUnassigned = allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0");
|
||||
assertTrue(movesForModeUnassigned <= movesForModeNone);
|
||||
allocateAndCheckIndexShardHotSpots(false, 5, "new_node_0");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,32 +42,17 @@ public class IndexShardHotSpotTests extends OpenSearchAllocationWithConstraintsT
|
|||
setupInitialCluster(3, 30, 10, 1);
|
||||
buildAllocationService();
|
||||
addNodesWithIndexing(1, "new_node_", 8, 10, 1);
|
||||
int movesForModeNone = allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0");
|
||||
|
||||
resetCluster();
|
||||
buildAllocationService();
|
||||
addNodesWithIndexing(1, "new_node_", 8, 10, 1);
|
||||
int movesForModeUnassigned = allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0");
|
||||
assertTrue(movesForModeUnassigned <= movesForModeNone);
|
||||
allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test under replicated yellow cluster scale out to green.
|
||||
*
|
||||
* This scenario is not expected to create hotspots even without constraints enabled. The
|
||||
* test is a sanity check to ensure allocation constraints don't worsen the situation.
|
||||
*/
|
||||
public void testUnderReplicatedClusterScaleOut() {
|
||||
setupInitialCluster(3, 30, 10, 3);
|
||||
buildAllocationService();
|
||||
addNodesWithoutIndexing(1, "new_node_");
|
||||
int movesForModeNone = allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0");
|
||||
|
||||
resetCluster();
|
||||
buildAllocationService();
|
||||
addNodesWithoutIndexing(1, "new_node_");
|
||||
int movesForModeUnassigned = allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0");
|
||||
assertTrue(movesForModeUnassigned <= movesForModeNone);
|
||||
allocateAndCheckIndexShardHotSpots(false, 4, "new_node_0");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,19 +61,12 @@ public class IndexShardHotSpotTests extends OpenSearchAllocationWithConstraintsT
|
|||
*
|
||||
* During moveShards(), shards are picked from across indexes in an interleaved manner.
|
||||
* This prevents hot spots by evenly picking up shards. Since shard order can change
|
||||
* in subsequent runs, we are not guaranteed to less moves than no allocation constraint run.
|
||||
*
|
||||
* Move tests are hence just a sanity test, to ensure we don't create any unexpected hot spots with
|
||||
* allocation settings.
|
||||
* in subsequent runs.
|
||||
*/
|
||||
public void testClusterScaleIn() {
|
||||
setupInitialCluster(4, 30, 10, 1);
|
||||
buildAllocationService("node_0,node_1");
|
||||
allocateAndCheckIndexShardHotSpots(false, 2, "node_2", "node_3");
|
||||
|
||||
resetCluster();
|
||||
buildAllocationService("node_0,node_1");
|
||||
allocateAndCheckIndexShardHotSpots(false, 2, "node_2", "node_3");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,10 +78,5 @@ public class IndexShardHotSpotTests extends OpenSearchAllocationWithConstraintsT
|
|||
buildAllocationService("node_0,node_1");
|
||||
addNodesWithoutIndexing(1, "new_node_");
|
||||
allocateAndCheckIndexShardHotSpots(false, 3, "node_2", "node_3", "new_node_0");
|
||||
|
||||
resetCluster();
|
||||
buildAllocationService("node_0,node_1");
|
||||
addNodesWithoutIndexing(1, "new_node_");
|
||||
allocateAndCheckIndexShardHotSpots(false, 3, "node_2", "node_3", "new_node_0");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue