You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2016/08/31 19:22:47 UTC
[4/9] accumulo git commit: ACCUMULO-4428 Stabilize the new
GarbageCollectorIT
ACCUMULO-4428 Stabilize the new GarbageCollectorIT
Use the clusterControl on MAC to alter the state. Make
the verification based on the filesystem instead of log
messages from the GC.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/8a3cc4f0
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/8a3cc4f0
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/8a3cc4f0
Branch: refs/heads/1.7
Commit: 8a3cc4f04c61847a7dcc9abd24a83c072a35b00f
Parents: 9edda32
Author: Josh Elser <el...@apache.org>
Authored: Wed Aug 31 15:13:23 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Wed Aug 31 15:13:23 2016 -0400
----------------------------------------------------------------------
.../test/functional/GarbageCollectorIT.java | 36 ++++++++------------
1 file changed, 14 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/8a3cc4f0/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
index 3e8abe6..ee790be 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
@@ -99,9 +99,9 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
}
- private void killMacGc() throws ProcessNotFoundException, InterruptedException, KeeperException {
+ private void killMacGc() throws ProcessNotFoundException, InterruptedException, KeeperException, IOException {
// kill gc started by MAC
- getCluster().killProcess(ServerType.GARBAGE_COLLECTOR, getCluster().getProcesses().get(ServerType.GARBAGE_COLLECTOR).iterator().next());
+ getCluster().getClusterControl().stop(ServerType.GARBAGE_COLLECTOR);
// delete lock in zookeeper if there, this will allow next GC to start quickly
String path = ZooUtil.getRoot(new ZooKeeperInstance(getCluster().getClientConfig())) + Constants.ZGC_LOCK;
ZooReaderWriter zk = new ZooReaderWriter(cluster.getZooKeepers(), 30000, OUR_SECRET);
@@ -114,10 +114,6 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
assertNull(getCluster().getProcesses().get(ServerType.GARBAGE_COLLECTOR));
}
- private void killMacTServer() throws ProcessNotFoundException, InterruptedException, KeeperException {
- getCluster().killProcess(ServerType.TABLET_SERVER, getCluster().getProcesses().get(ServerType.TABLET_SERVER).iterator().next());
- }
-
@Test
public void gcTest() throws Exception {
killMacGc();
@@ -170,29 +166,25 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
// Test WAL log has been created
List<String> walsBefore = getWALsForTableId(tableId);
Assert.assertEquals("Should be one WAL", 1, walsBefore.size());
-
- // Flush and check for no WAL logs
- c.tableOperations().flush("test_ingest", null, null, true);
- List<String> walsAfter = getWALsForTableId(tableId);
- Assert.assertEquals("Should be no WALs", 0, walsAfter.size());
+ final File walToBeDeleted = new File(walsBefore.get(0).split("\\|")[0].replaceFirst("file:///", ""));
// Validate WAL file still exists
- String walFile = walsBefore.get(0).split("\\|")[0].replaceFirst("file:///", "");
- File wf = new File(walFile);
- Assert.assertEquals("WAL file does not exist", true, wf.exists());
+ Assert.assertEquals("WAL file does not exist", true, walToBeDeleted.exists());
- // Kill TServer and give it some time to die and master to rebalance
- killMacTServer();
+ // Kill TServers and give it some time to die
+ getCluster().getClusterControl().stop(ServerType.TABLET_SERVER);
UtilWaitThread.sleep(5000);
+ // Restart them or the GC won't ever be able to run a cycle
+ getCluster().getClusterControl().start(ServerType.TABLET_SERVER);
// Restart GC and let it run
- Process gc = getCluster().exec(SimpleGarbageCollector.class);
- UtilWaitThread.sleep(60000);
+ getCluster().getClusterControl().start(ServerType.GARBAGE_COLLECTOR);
- // Then check the log for proper events
- String output = FunctionalTestUtils.readAll(getCluster(), SimpleGarbageCollector.class, gc);
- assertTrue("WAL GC should have started", output.contains("Beginning garbage collection of write-ahead logs"));
- assertTrue("WAL was not removed even though tserver was down", output.contains("Removing WAL for offline server"));
+ log.info("Waiting for garbage collector to delete the WAL {}", walToBeDeleted);
+ while (walToBeDeleted.exists()) {
+ // Wait for the file to be deleted
+ Thread.sleep(2000);
+ }
}
@Test