hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1177896 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
Date Sat, 01 Oct 2011 04:18:13 GMT
Author: stack
Date: Sat Oct  1 04:18:13 2011
New Revision: 1177896

URL: http://svn.apache.org/viewvc?rev=1177896&view=rev
Log:
HBASE-4506 [hbck] Allow HBaseFsck to be instantiated without connecting

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1177896&r1=1177895&r2=1177896&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sat Oct  1 04:18:13 2011
@@ -683,6 +683,8 @@ Release 0.90.5 - Unreleased
    HBASE-4295  rowcounter does not return the correct number of rows in
                certain circumstances (David Revell)
    HBASE-4515  User.getCurrent() can fail to initialize the current user
+   HBASE-4506  [hbck] Allow HBaseFsck to be instantiated without connecting
+               (Jonathan Hsieh)
 
   IMPROVEMENT
    HBASE-4205  Enhance HTable javadoc (Eric Charles)

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java?rev=1177896&r1=1177895&r2=1177896&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java Sat Oct  1 04:18:13
2011
@@ -106,7 +106,7 @@ public class HBaseFsck {
   // Empty regioninfo qualifiers in .META.
   private Set<Result> emptyRegionInfoQualifiers = new HashSet<Result>();
   private int numThreads = MAX_NUM_THREADS;
-  private final HBaseAdmin admin;
+  private HBaseAdmin admin;
 
   ThreadPoolExecutor executor; // threads to retrieve data from regionservers
 
@@ -117,18 +117,21 @@ public class HBaseFsck {
    * @throws MasterNotRunningException if the master is not running
    * @throws ZooKeeperConnectionException if unable to connect to zookeeper
    */
-  public HBaseFsck(Configuration conf)
-    throws MasterNotRunningException, ZooKeeperConnectionException, IOException {
+  public HBaseFsck(Configuration conf) throws MasterNotRunningException,
+      ZooKeeperConnectionException, IOException {
     this.conf = conf;
 
+    numThreads = conf.getInt("hbasefsck.numthreads", numThreads);
+    executor = new ThreadPoolExecutor(0, numThreads,
+        THREADS_KEEP_ALIVE_SECONDS, TimeUnit.SECONDS,
+        new LinkedBlockingQueue<Runnable>());
+  }
+
+  public void connect() throws MasterNotRunningException,
+      ZooKeeperConnectionException {
     admin = new HBaseAdmin(conf);
     status = admin.getMaster().getClusterStatus();
     connection = admin.getConnection();
-
-    numThreads = conf.getInt("hbasefsck.numthreads", numThreads);
-    executor = new ThreadPoolExecutor(0, numThreads,
-          THREADS_KEEP_ALIVE_SECONDS, TimeUnit.SECONDS,
-          new LinkedBlockingQueue<Runnable>());
   }
 
   /**
@@ -1337,11 +1340,11 @@ public class HBaseFsck {
    * @param args
    * @throws Exception
    */
-  public static void main(String [] args) throws Exception {
+  public static void main(String[] args) throws Exception {
 
     // create a fsck object
     Configuration conf = HBaseConfiguration.create();
-    conf.set("fs.defaultFS", conf.get("hbase.rootdir"));
+    conf.set("fs.defaultFS", conf.get(HConstants.HBASE_DIR));
     HBaseFsck fsck = new HBaseFsck(conf);
     long sleepBeforeRerun = DEFAULT_SLEEP_BEFORE_RERUN;
 
@@ -1389,6 +1392,7 @@ public class HBaseFsck {
       }
     }
     // do the real work of fsck
+    fsck.connect();
     int code = fsck.doWork();
     // If we have changed the HBase state it is better to run fsck again
     // to see if we haven't broken something else in the process.

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java?rev=1177896&r1=1177895&r2=1177896&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java Sat Oct  1 04:18:13
2011
@@ -77,6 +77,7 @@ public class TestHBaseFsck {
 
   private List<ERROR_CODE> doFsck(boolean fix) throws Exception {
     HBaseFsck fsck = new HBaseFsck(conf);
+    fsck.connect();
     fsck.displayFullReport(); // i.e. -details
     fsck.setTimeLag(0);
     fsck.setFixErrors(fix);



Mime
View raw message