incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Fixing bug where during the index import the HDFS files are not moved into the long term directory inside the join directory but rather were copied into the short term directory. This caused OOM errors with the HDFS key value store backing t
Date Tue, 25 Feb 2014 01:35:25 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/apache-blur-0.2 2f0f94f2e -> f3c779189


Fixing bug where during the index import the HDFS files are not moved into the long term directory
inside the join directory but rather were copied into the short term directory.  This caused
OOM errors with the HDFS key value store backing the short term directory.


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

Branch: refs/heads/apache-blur-0.2
Commit: f3c7791890a65228fa94037156863286ae4b17e3
Parents: 2f0f94f
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Feb 24 20:35:22 2014 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Feb 24 20:35:22 2014 -0500

----------------------------------------------------------------------
 .../lib/BlurOutputFormatMiniClusterTest.java    | 20 ++++++++++++++++-
 .../apache/blur/store/hdfs/HdfsDirectory.java   | 11 +++++++---
 .../apache/blur/store/hdfs/HdfsQuickMove.java   | 23 ++++++++++++++++++++
 .../blur/store/hdfs_v2/JoinDirectory.java       | 13 ++++++++---
 4 files changed, 60 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3c77918/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTest.java
----------------------------------------------------------------------
diff --git a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTest.java
b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTest.java
index f470b35..cbe4f47 100644
--- a/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTest.java
+++ b/blur-mapred/src/test/java/org/apache/blur/mapreduce/lib/BlurOutputFormatMiniClusterTest.java
@@ -16,7 +16,7 @@ package org.apache.blur.mapreduce.lib;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 import java.io.BufferedReader;
 import java.io.DataInputStream;
@@ -35,8 +35,10 @@ import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.thrift.generated.BlurException;
 import org.apache.blur.thrift.generated.TableDescriptor;
 import org.apache.blur.thrift.generated.TableStats;
+import org.apache.blur.utils.BlurUtil;
 import org.apache.blur.utils.GCWatcher;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.LocalFileSystem;
 import org.apache.hadoop.fs.Path;
@@ -156,6 +158,14 @@ public class BlurOutputFormatMiniClusterTest {
     client.createTable(tableDescriptor);
 
     BlurOutputFormat.setupJob(job, tableDescriptor);
+    Path tablePath = new Path(tableUri);
+    Path shardPath = new Path(tablePath, BlurUtil.getShardName(0));
+    FileStatus[] listStatus = fileSystem.listStatus(shardPath);
+    assertEquals(2, listStatus.length);
+    System.out.println("======" + listStatus.length);
+    for (FileStatus fileStatus : listStatus) {
+      System.out.println(fileStatus.getPath());
+    }
 
     assertTrue(job.waitForCompletion(true));
     Counters ctrs = job.getCounters();
@@ -169,6 +179,14 @@ public class BlurOutputFormatMiniClusterTest {
       }
       Thread.sleep(5000);
     }
+
+    assertTrue(fileSystem.exists(tablePath));
+    assertFalse(fileSystem.isFile(tablePath));
+
+    FileStatus[] listStatusAfter = fileSystem.listStatus(shardPath);
+
+    assertEquals(9, listStatusAfter.length);
+
   }
 
   private Iface getClient() {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3c77918/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java b/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
index e4607f1..82d16d4 100644
--- a/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
+++ b/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
@@ -55,7 +55,7 @@ import com.yammer.metrics.core.Histogram;
 import com.yammer.metrics.core.Meter;
 import com.yammer.metrics.core.MetricName;
 
-public class HdfsDirectory extends Directory implements LastModified {
+public class HdfsDirectory extends Directory implements LastModified, HdfsQuickMove {
 
   private static final Log LOG = LogFactory.getLog(HdfsDirectory.class);
 
@@ -330,8 +330,8 @@ public class HdfsDirectory extends Directory implements LastModified {
   public void copy(Directory to, String src, String dest, IOContext context) throws IOException
{
     if (to instanceof DirectoryDecorator) {
       copy(((DirectoryDecorator) to).getOriginalDirectory(), src, dest, context);
-    } else if (to instanceof HdfsDirectory) {
-      if (quickMove(to, src, dest, context)) {
+    } else if (to instanceof HdfsQuickMove) {
+      if (quickMove(((HdfsQuickMove) to).getQuickMoveDirectory(), src, dest, context)) {
         return;
       }
     } else {
@@ -367,4 +367,9 @@ public class HdfsDirectory extends Directory implements LastModified {
     return true;
   }
 
+  @Override
+  public HdfsDirectory getQuickMoveDirectory() {
+    return this;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3c77918/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsQuickMove.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsQuickMove.java b/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsQuickMove.java
new file mode 100644
index 0000000..9504ca7
--- /dev/null
+++ b/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsQuickMove.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.blur.store.hdfs;
+
+public interface HdfsQuickMove {
+  
+  HdfsDirectory getQuickMoveDirectory();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f3c77918/blur-store/src/main/java/org/apache/blur/store/hdfs_v2/JoinDirectory.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/hdfs_v2/JoinDirectory.java b/blur-store/src/main/java/org/apache/blur/store/hdfs_v2/JoinDirectory.java
index 3fba841..84f91a3 100644
--- a/blur-store/src/main/java/org/apache/blur/store/hdfs_v2/JoinDirectory.java
+++ b/blur-store/src/main/java/org/apache/blur/store/hdfs_v2/JoinDirectory.java
@@ -24,20 +24,22 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.blur.store.blockcache.LastModified;
+import org.apache.blur.store.hdfs.HdfsDirectory;
+import org.apache.blur.store.hdfs.HdfsQuickMove;
 import org.apache.blur.utils.BlurConstants;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.store.IndexOutput;
 
-public class JoinDirectory extends Directory implements LastModified {
+public class JoinDirectory extends Directory implements LastModified, HdfsQuickMove {
 
-  private final Directory _longTermStorage;
+  private final HdfsDirectory _longTermStorage;
   private final Directory _shortTermStorage;
   private final Set<String> _shortTermSyncFiles = Collections.newSetFromMap(new ConcurrentHashMap<String,
Boolean>());
   private final Set<String> _longTermSyncFiles = Collections.newSetFromMap(new ConcurrentHashMap<String,
Boolean>());
 
-  public JoinDirectory(Directory longTermStorage, Directory shortTermStorage) throws IOException
{
+  public JoinDirectory(HdfsDirectory longTermStorage, Directory shortTermStorage) throws
IOException {
     lastModifiedCheck(longTermStorage);
     lastModifiedCheck(shortTermStorage);
     _longTermStorage = longTermStorage;
@@ -156,4 +158,9 @@ public class JoinDirectory extends Directory implements LastModified {
     return ((LastModified) _longTermStorage).getFileModified(name);
   }
 
+  @Override
+  public HdfsDirectory getQuickMoveDirectory() {
+    return _longTermStorage;
+  }
+
 }


Mime
View raw message