tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [1/4] tajo git commit: TAJO-1318: Unit test failure after miniDFS cluster restart. (jinho)
Date Wed, 28 Jan 2015 03:55:24 GMT
Repository: tajo
Updated Branches:
  refs/heads/index_support 9d48a40ad -> 7cafc33b0


TAJO-1318: Unit test failure after miniDFS cluster restart. (jinho)

Closes #360


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

Branch: refs/heads/index_support
Commit: 5ba8e383c61e6074e84dbd07a3b150370ccbaea1
Parents: a15b5fa
Author: jhkim <jhkim@apache.org>
Authored: Tue Jan 27 16:00:19 2015 +0900
Committer: jhkim <jhkim@apache.org>
Committed: Tue Jan 27 16:00:19 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  2 ++
 .../java/org/apache/tajo/worker/TajoWorker.java |  7 ++++++
 .../org/apache/tajo/TajoTestingCluster.java     | 24 ++++++++------------
 .../org/apache/tajo/storage/StorageManager.java |  3 ++-
 4 files changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/5ba8e383/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 6969bf1..eb1c3dc 100644
--- a/CHANGES
+++ b/CHANGES
@@ -171,6 +171,8 @@ Release 0.10.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1318: Unit test failure after miniDFS cluster restart. (jinho)
+
     TAJO-1289: History reader fails to get the query information after 
     a successful query execution. (jinho)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5ba8e383/tajo-core/src/main/java/org/apache/tajo/worker/TajoWorker.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/worker/TajoWorker.java b/tajo-core/src/main/java/org/apache/tajo/worker/TajoWorker.java
index 4003014..c217e3e 100644
--- a/tajo-core/src/main/java/org/apache/tajo/worker/TajoWorker.java
+++ b/tajo-core/src/main/java/org/apache/tajo/worker/TajoWorker.java
@@ -49,6 +49,7 @@ import org.apache.tajo.rule.EvaluationFailedException;
 import org.apache.tajo.rule.SelfDiagnosisRuleEngine;
 import org.apache.tajo.rule.SelfDiagnosisRuleSession;
 import org.apache.tajo.storage.HashShuffleAppenderManager;
+import org.apache.tajo.storage.StorageManager;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.JvmPauseMonitor;
 import org.apache.tajo.util.NetUtils;
@@ -395,6 +396,12 @@ public class TajoWorker extends CompositeService {
       }
     }
 
+    try {
+      StorageManager.close();
+    } catch (IOException ie) {
+      LOG.error(ie.getMessage(), ie);
+    }
+
     if(workerSystemMetrics != null) {
       workerSystemMetrics.stop();
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/5ba8e383/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java b/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
index e548b81..64b38ac 100644
--- a/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
+++ b/tajo-core/src/test/java/org/apache/tajo/TajoTestingCluster.java
@@ -45,11 +45,11 @@ import org.apache.tajo.conf.TajoConf.ConfVars;
 import org.apache.tajo.engine.planner.global.rewriter.GlobalPlanTestRuleProvider;
 import org.apache.tajo.master.QueryInProgress;
 import org.apache.tajo.master.TajoMaster;
+import org.apache.tajo.master.rm.TajoWorkerResourceManager;
+import org.apache.tajo.plan.rewrite.LogicalPlanTestRuleProvider;
 import org.apache.tajo.querymaster.Query;
 import org.apache.tajo.querymaster.Stage;
 import org.apache.tajo.querymaster.StageState;
-import org.apache.tajo.master.rm.TajoWorkerResourceManager;
-import org.apache.tajo.plan.rewrite.LogicalPlanTestRuleProvider;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.KeyValueSet;
 import org.apache.tajo.util.NetUtils;
@@ -59,7 +59,10 @@ import java.io.*;
 import java.net.InetSocketAddress;
 import java.net.URL;
 import java.sql.ResultSet;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.TimeZone;
+import java.util.UUID;
 
 public class TajoTestingCluster {
 	private static Log LOG = LogFactory.getLog(TajoTestingCluster.class);
@@ -237,18 +240,14 @@ public class TajoTestingCluster {
    * @throws java.io.IOException
    */
   public MiniDFSCluster startMiniDFSCluster(int servers,
-                                            final File dir,
+                                            File dir,
                                             final String hosts[])
       throws IOException {
     if (dir == null) {
-      this.clusterTestBuildDir = setupClusterTestBuildDir();
-    } else {
-      this.clusterTestBuildDir = dir;
+      dir = setupClusterTestBuildDir();
     }
 
-    System.setProperty(MiniDFSCluster.PROP_TEST_BUILD_DATA,
-        this.clusterTestBuildDir.toString());
-
+    conf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, dir.toString());
     conf.setInt(DFSConfigKeys.DFS_REPLICATION_KEY, 1);
     conf.setBoolean(DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_KEY, false);
     MiniDFSCluster.Builder builder = new MiniDFSCluster.Builder(new HdfsConfiguration(conf));
@@ -514,10 +513,7 @@ public class TajoTestingCluster {
     this.clusterTestBuildDir = testBuildPath == null?
         setupClusterTestBuildDir() : new File(testBuildPath);
 
-    System.setProperty(TEST_DIRECTORY_KEY,
-        this.clusterTestBuildDir.getAbsolutePath());
-
-    startMiniDFSCluster(numDataNodes, this.clusterTestBuildDir, dataNodeHosts);
+    startMiniDFSCluster(numDataNodes, setupClusterTestBuildDir(), dataNodeHosts);
     this.dfsCluster.waitClusterUp();
 
     hbaseUtil = new HBaseTestClusterUtil(conf, clusterTestBuildDir);

http://git-wip-us.apache.org/repos/asf/tajo/blob/5ba8e383/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageManager.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageManager.java
b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageManager.java
index 3b56249..34caa80 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageManager.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/StorageManager.java
@@ -242,12 +242,13 @@ public abstract class StorageManager {
    * Close StorageManager
    * @throws java.io.IOException
    */
-  public void close() throws IOException {
+  public static void close() throws IOException {
     synchronized(storageManagers) {
       for (StorageManager eachStorageManager: storageManagers.values()) {
         eachStorageManager.closeStorageManager();
       }
     }
+    clearCache();
   }
 
   /**


Mime
View raw message