accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [2/3] accumulo git commit: ACCUMULO-3772 All ZK WAL refs contain LogEntry in the node.
Date Thu, 07 May 2015 05:15:53 GMT
ACCUMULO-3772 All ZK WAL refs contain LogEntry in the node.

As bad as having two nodes for tracking WAL for the root
tablet, the data of current_logs and walogs in ZK varied.
Make them all the same value for consistency


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

Branch: refs/heads/master
Commit: f55751bc073d449099794fd4fc5cc7a3ce7ee388
Parents: f830300
Author: Josh Elser <elserj@apache.org>
Authored: Thu May 7 00:20:26 2015 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Thu May 7 00:42:37 2015 -0400

----------------------------------------------------------------------
 .../apache/accumulo/server/util/MetadataTableUtil.java | 13 +++++++++++--
 .../apache/accumulo/test/functional/WALSunnyDayIT.java |  4 +++-
 2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f55751bc/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
index 4470c55..c85cee7 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
@@ -1056,6 +1056,13 @@ public class MetadataTableUtil {
   public static void addNewLogMarker(ClientContext context, ZooLock zooLock, final TServerInstance
tabletSession, final Path filename, TabletLevel level) {
     log.debug("Adding log entry " + filename);
     if (level == TabletLevel.ROOT) {
+      LogEntry log = new LogEntry(RootTable.EXTENT, System.currentTimeMillis(), tabletSession.hostPort(),
filename.toString());
+      final byte[] node;
+      try {
+        node = log.toBytes();
+      } catch (IOException e) {
+        throw new RuntimeException("Failed to write to byte array", e);
+      }
       retryZooKeeperUpdate(context, zooLock, new ZooOperation() {
         @Override
         public void run(IZooReaderWriter rw) throws KeeperException, InterruptedException,
IOException {
@@ -1066,7 +1073,7 @@ public class MetadataTableUtil {
           path.append(CurrentLogsSection.getRowPrefix());
           path.append(tabletSession.toString());
           path.append(uniqueId);
-          rw.putPersistentData(path.toString(), filename.toString().getBytes(UTF_8), NodeExistsPolicy.OVERWRITE);
+          rw.putPersistentData(path.toString(), node, NodeExistsPolicy.OVERWRITE);
         }
       });
     } else {
@@ -1153,7 +1160,9 @@ public class MetadataTableUtil {
           String root = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + RootTable.ZROOT_TABLET_CURRENT_LOGS;
           logs.clear();
           for (String child : rw.getChildren(root)) {
-            logs.add(new Path(new String(rw.getData(root + "/" + child, null), UTF_8)));
+            byte[] data = rw.getData(root + "/" + child, null);
+            LogEntry entry = LogEntry.fromBytes(data);
+            logs.add(new Path(entry.filename));
           }
         }
       });

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f55751bc/test/src/test/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java b/test/src/test/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java
index 9f22466..74c79a1 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java
@@ -48,6 +48,7 @@ import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.CurrentLogsSection;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.TabletColumnFamily;
+import org.apache.accumulo.core.tabletserver.log.LogEntry;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.master.state.SetGoalState;
@@ -213,7 +214,8 @@ public class WALSunnyDayIT extends ConfigurableMacIT {
     List<String> children = zoo.getChildren(zpath, null);
     for (String child : children) {
       byte[] data = zoo.getData(zpath + "/" + child, null, null);
-      result.put(new String(data), true);
+      LogEntry entry = LogEntry.fromBytes(data);
+      result.put(entry.filename, true);
     }
     return result;
   }


Mime
View raw message