Permalink
Browse files

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
  • Loading branch information...
1 parent 077b18c commit f9f797cbb90efbd6c1fb2060e19e44500812cb84 Eric C. Newton committed Sep 13, 2012
Showing with 23 additions and 3 deletions.
  1. +23 −3 distnn/src/main/java/org/apache/hadoop/hdfs/server/namenode/ZookeeperNameNode.java
@@ -120,7 +120,7 @@ public BlockInfo(long id, String[] datanodes, long size) {
}
// 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 LocatedBlock append(String src, String clientName) throws IOException {
@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

0 comments on commit f9f797c

Please sign in to comment.