accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [6/9] git commit: ACCUMULO-3249 Create work only when there is work to be done for the status.
Date Thu, 23 Oct 2014 18:58:23 GMT
ACCUMULO-3249 Create work only when there is work to be done for the status.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/6cbc5863
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/6cbc5863
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/6cbc5863

Branch: refs/heads/master
Commit: 6cbc58630d3507cadf641d8c2309ee15452aa4db
Parents: 48f94bd
Author: Josh Elser <elserj@apache.org>
Authored: Wed Oct 22 15:05:17 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Thu Oct 23 11:18:59 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/accumulo/master/replication/WorkMaker.java  | 5 ++++-
 .../org/apache/accumulo/master/replication/WorkMakerTest.java   | 5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/6cbc5863/server/master/src/main/java/org/apache/accumulo/master/replication/WorkMaker.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/replication/WorkMaker.java
b/server/master/src/main/java/org/apache/accumulo/master/replication/WorkMaker.java
index 0eefca3..eabcc84 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/replication/WorkMaker.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/replication/WorkMaker.java
@@ -103,7 +103,7 @@ public class WorkMaker {
           continue;
         }
 
-        // Don't create the record if we have nothing to do
+        // Don't create the record if we have nothing to do.
         // TODO put this into a filter on serverside
         if (!shouldCreateWork(status)) {
           continue;
@@ -155,6 +155,9 @@ public class WorkMaker {
    * @return Should a Work entry be created for this status
    */
   protected boolean shouldCreateWork(Status status) {
+    // Only creating work when there is work to do (regardless of closed status) is safe
+    // as long as the ReplicaSystem implementation is correctly observing
+    // that a file is completely replicated only when the file is closed
     return StatusUtil.isWorkRequired(status);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/6cbc5863/server/master/src/test/java/org/apache/accumulo/master/replication/WorkMakerTest.java
----------------------------------------------------------------------
diff --git a/server/master/src/test/java/org/apache/accumulo/master/replication/WorkMakerTest.java
b/server/master/src/test/java/org/apache/accumulo/master/replication/WorkMakerTest.java
index 9bc3102..d486ded 100644
--- a/server/master/src/test/java/org/apache/accumulo/master/replication/WorkMakerTest.java
+++ b/server/master/src/test/java/org/apache/accumulo/master/replication/WorkMakerTest.java
@@ -50,7 +50,7 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Iterables;
 
 /**
- * 
+ *
  */
 public class WorkMakerTest {
 
@@ -207,6 +207,7 @@ public class WorkMakerTest {
 
     Assert.assertFalse(workMaker.shouldCreateWork(StatusUtil.fileCreated(System.currentTimeMillis())));
     Assert.assertTrue(workMaker.shouldCreateWork(StatusUtil.ingestedUntil(1000)));
-    Assert.assertTrue(workMaker.shouldCreateWork(Status.newBuilder().setBegin(Long.MAX_VALUE).setEnd(0).setInfiniteEnd(true).setClosed(true).build()));
+    // We don't need to re-create work for something that's already replicated.
+    Assert.assertFalse(workMaker.shouldCreateWork(Status.newBuilder().setBegin(Long.MAX_VALUE).setEnd(0).setInfiniteEnd(true).setClosed(true).build()));
   }
 }


Mime
View raw message