|
22 | 22 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
23 | 23 | import static org.junit.jupiter.api.Assertions.assertNull;
|
24 | 24 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
| 25 | +import static org.junit.jupiter.api.Assertions.fail; |
25 | 26 |
|
26 | 27 | import java.util.List;
|
27 | 28 | import java.util.Map;
|
@@ -66,6 +67,7 @@ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration coreS
|
66 | 67 | cfg.getClusterServerConfiguration().setNumDefaultTabletServers(1);
|
67 | 68 | cfg.getClusterServerConfiguration().setNumDefaultScanServers(0);
|
68 | 69 | cfg.getClusterServerConfiguration().setNumDefaultCompactors(1);
|
| 70 | + cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "15s"); |
69 | 71 | cfg.setProperty(Property.GENERAL_LOW_MEM_DETECTOR_INTERVAL, "5s");
|
70 | 72 | cfg.setProperty(Property.GENERAL_LOW_MEM_DETECTOR_THRESHOLD,
|
71 | 73 | Double.toString(MemoryStarvedScanIT.FREE_MEMORY_THRESHOLD));
|
@@ -132,10 +134,23 @@ public void testMajCPauses() throws Exception {
|
132 | 134 |
|
133 | 135 | ClientContext ctx = (ClientContext) client;
|
134 | 136 |
|
135 |
| - // Stop the normal compactors and start the version that will consume |
136 |
| - // and free memory when we need it to |
137 |
| - getCluster().getClusterControl().stopAllServers(ServerType.COMPACTOR); |
| 137 | + // Kill the normal compactors and wait until their addresses in ZK are cleared |
| 138 | + getCluster().getConfig().getClusterServerConfiguration().getCompactorConfiguration().keySet() |
| 139 | + .forEach(resourceGroup -> { |
| 140 | + List<Process> procs = getCluster().getClusterControl().getCompactors(resourceGroup); |
| 141 | + for (int i = 0; i < procs.size(); i++) { |
| 142 | + LOG.info("Stopping compactor process: {}", procs.get(i).pid()); |
| 143 | + try { |
| 144 | + procs.get(i).destroyForcibly().waitFor(); |
| 145 | + } catch (InterruptedException e) { |
| 146 | + fail("Interrupted trying to stop compactor process"); |
| 147 | + } |
| 148 | + } |
| 149 | + getCluster().getClusterControl().getCompactors(resourceGroup).clear(); |
| 150 | + }); |
| 151 | + Wait.waitFor(() -> ExternalCompactionUtil.getCompactorAddrs(ctx).size() == 0, 60_000); |
138 | 152 |
|
| 153 | + // Start the Compactors that will consume and free memory when we need it to |
139 | 154 | getCluster().getClusterControl().start(ServerType.COMPACTOR, null, 1,
|
140 | 155 | MemoryConsumingCompactor.class);
|
141 | 156 | Wait.waitFor(() -> ExternalCompactionUtil.getCompactorAddrs(ctx).size() == 4, 60_000);
|
|
0 commit comments