accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [61/61] [abbrv] accumulo git commit: ACCUMULO-722: complete files in ZNN when recoverLease is called, move the root node to ZNN
Date Thu, 03 Mar 2016 22:00:26 GMT
ACCUMULO-722: complete files in ZNN when recoverLease is called, move the root node to ZNN

git-svn-id: https://svn.apache.org/repos/asf/accumulo/branches/ACCUMULO-722@1384340 13f79535-47bb-0310-9956-ffa450edef68


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

Branch: refs/heads/ACCUMULO-722
Commit: f9f797cbb90efbd6c1fb2060e19e44500812cb84
Parents: 077b18c
Author: Eric C. Newton <ecn@apache.org>
Authored: Thu Sep 13 14:19:27 2012 +0000
Committer: Eric C. Newton <ecn@apache.org>
Committed: Thu Sep 13 14:19:27 2012 +0000

----------------------------------------------------------------------
 .../hdfs/server/namenode/ZookeeperNameNode.java | 26 +++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f9f797cb/distnn/src/main/java/org/apache/hadoop/hdfs/server/namenode/ZookeeperNameNode.java
----------------------------------------------------------------------
diff --git a/distnn/src/main/java/org/apache/hadoop/hdfs/server/namenode/ZookeeperNameNode.java
b/distnn/src/main/java/org/apache/hadoop/hdfs/server/namenode/ZookeeperNameNode.java
index e74813f..077f478 100644
--- a/distnn/src/main/java/org/apache/hadoop/hdfs/server/namenode/ZookeeperNameNode.java
+++ b/distnn/src/main/java/org/apache/hadoop/hdfs/server/namenode/ZookeeperNameNode.java
@@ -120,7 +120,7 @@ public class ZookeeperNameNode implements FakeNameNode {
   }
   
   // Metadata for these files are stored in zookeeper
-  static Pattern metaDataFileNames = Pattern.compile("/accumulo(|/instance_id.*|/version.*|/walogArchive|/wal(/.*|$)|/recovery.*|/tables$|/tables/(\\!0|\\!1|\\!2|\\!3)(/.*|$))");
+  static Pattern metaDataFileNames = Pattern.compile("/$|/accumulo(|/instance_id.*|/version.*|/walogArchive|/wal(/.*|$)|/recovery.*|/tables$|/tables/(\\!0|\\!1|\\!2|\\!3)(/.*|$))");
   
   static private boolean isZooName(String path) {
     boolean result = metaDataFileNames.matcher(path).matches();
@@ -314,8 +314,28 @@ public class ZookeeperNameNode implements FakeNameNode {
   
   @Override
   public boolean recoverLease(String src, String clientName) throws IOException {
-    notImplementedWarning(src, clientName);
-    return true;
+    log.info("recoverLease " + src);
+    String path = DNNConstants.NAMESPACE_PATH + src;
+    try {
+      long length = 0;
+      for (String child : keeper.getChildren().forPath(path)) {
+        Object object = deserialize(keeper.getData().forPath(path + "/" + child));
+        if (object instanceof BlockInfo) {
+          BlockInfo info = (BlockInfo)object;
+          Block block = new Block(info.id);
+          String blockPath = DNNConstants.BLOCKS_PATH + "/" + block.getBlockName();
+          info = (BlockInfo)deserialize(keeper.getData().forPath(blockPath));
+          if (!info.complete) {
+            info.complete = true;
+            keeper.setData().forPath(blockPath);
+          }
+        }
+      }
+      return true;
+    } catch (Exception ex) {
+      log.error(ex, ex);
+      return false;
+    }
   }
   
   @Override


Mime
View raw message