hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1504224 - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/ main/java/org/apache/hadoop/hbase/regionserver/ test/java/org/apache/hadoop/hbase/regionserver/
Date Wed, 17 Jul 2013 18:22:11 GMT
Author: liyin
Date: Wed Jul 17 18:22:10 2013
New Revision: 1504224

URL: http://svn.apache.org/r1504224
Log:
[master]Add tool to update assignment plan stored in json file

Author: fan

Summary: Add tool to update assignment plan stored in json file

Test Plan:
Added a unit test to reconstruct an assignment plan from json string of current plan.

I tested download and upload functions in shadow cluster 52 through following steps:
1. Download current assignment plan.
2. Modify the plan and upload it.
3. Download new plan and diff with original one, only changes from last step should exist.
4. Upload original plan.
3. Download current plan and diff with original one, they should be the same.

The test steps have been passed.

Reviewers: liyintang, adela

Reviewed By: adela

CC: security-diffs@lists, hbase-eng@

Differential Revision: https://phabricator.fb.com/D879881

Task ID: 2547614

New observer for quorum read conf change

Summary: New observer for quorum read conf change

Test Plan: It builds...

Reviewers: gauravm

Differential Revision: https://phabricator.fb.com/D883823

Task ID: 2566822

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/HConstants.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/HConstants.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/HConstants.java?rev=1504224&r1=1504223&r2=1504224&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/HConstants.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/HConstants.java Wed Jul 17
18:22:10 2013
@@ -332,6 +332,13 @@ public final class HConstants {
    */
   public static final int DEFAULT_HDFS_QUORUM_READ_THREADS_MAX = 50;
 
+  /**
+   * If using quorum reads from HDFS, the timeout of using another region server.
+   */
+  public static final String HDFS_QUORUM_READ_TIMEOUT_MILLIS =
+    "hbase.dfsclient.quorum.reads.timeout";
+  public static final int DEFAULT_HDFS_QUORUM_READ_TIMEOUT_MILLIS = 0;
+
   /** Default maximum file size */
   public static final long DEFAULT_MAX_FILE_SIZE = 256 * 1024 * 1024;
   

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1504224&r1=1504223&r2=1504224&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Wed Jul 17 18:22:10 2013
@@ -109,6 +109,7 @@ import org.apache.hadoop.hbase.client.Sc
 import org.apache.hadoop.hbase.client.ServerConnection;
 import org.apache.hadoop.hbase.client.ServerConnectionManager;
 import org.apache.hadoop.hbase.conf.ConfigurationManager;
+import org.apache.hadoop.hbase.conf.ConfigurationObserver;
 import org.apache.hadoop.hbase.io.hfile.CacheConfig;
 import org.apache.hadoop.hbase.io.hfile.L2BucketCache;
 import org.apache.hadoop.hbase.io.hfile.LruBlockCache;
@@ -165,7 +166,7 @@ import com.google.common.base.Preconditi
  * the HMaster. There are many HRegionServers in a single HBase deployment.
  */
 public class HRegionServer implements HRegionInterface,
-    HBaseRPCErrorHandler, Runnable, Watcher {
+    HBaseRPCErrorHandler, Runnable, Watcher, ConfigurationObserver {
   public static final Log LOG = LogFactory.getLog(HRegionServer.class);
   private static final HMsg REPORT_EXITING = new HMsg(Type.MSG_REPORT_EXITING);
   private static final HMsg REPORT_RESTARTING = new HMsg(
@@ -1019,6 +1020,9 @@ public class HRegionServer implements HR
     // So, shutdown the MemstoreFlusher and LogRoller
     this.stopRequestedAtStageTwo.set(true);
 
+    // Stop listening to configuration update event
+    configurationManager.deregisterObserver(this);
+
     // shutdown thriftserver
     if (thriftServer != null) {
       thriftServer.shutdown();
@@ -1194,6 +1198,9 @@ public class HRegionServer implements HR
         thriftServer.start();
         LOG.info("Started Thrift API from Region Server.");
       }
+
+      // Register configuration update event for handling it on the fly
+      configurationManager.registerObserver(this);
     } catch (Throwable e) {
       this.isOnline = false;
       this.stopRequestedAtStageOne.set(true);
@@ -3837,4 +3844,13 @@ public class HRegionServer implements HR
     }
     return 0;
   }
+
+  @Override
+  public void notifyOnChange(Configuration conf) {
+    this.setNumHDFSQuorumReadThreads(conf.getInt(
+        HConstants.HDFS_QUORUM_READ_THREADS_MAX, HConstants.DEFAULT_HDFS_QUORUM_READ_THREADS_MAX));
+
+    this.setHDFSQuorumReadTimeoutMillis(conf.getInt(
+        HConstants.HDFS_QUORUM_READ_TIMEOUT_MILLIS, HConstants.DEFAULT_HDFS_QUORUM_READ_TIMEOUT_MILLIS));
+  }
 }

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java?rev=1504224&r1=1504223&r2=1504224&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java
(original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerOnlineConfigChange.java
Wed Jul 17 18:22:10 2013
@@ -216,5 +216,24 @@ public class TestRegionServerOnlineConfi
     assertEquals(newMajorCompactionJitter,
             s.compactionManager.comConf.getMajorCompactionJitter(), 0.00001);
   }
+
+  /**
+   * Check if quorum read settings change online properly
+   */
+  public void testQuorumReadConfigurationChange() {
+    int threads = conf.getInt(
+        HConstants.HDFS_QUORUM_READ_THREADS_MAX, 0);
+    int timeout = conf.getInt(
+        HConstants.HDFS_QUORUM_READ_TIMEOUT_MILLIS, 0);
+    threads += 1;
+    timeout += 1;
+    conf.setInt(HConstants.HDFS_QUORUM_READ_THREADS_MAX, threads);
+    conf.setInt(HConstants.HDFS_QUORUM_READ_TIMEOUT_MILLIS, timeout);
+    HRegionServer.configurationManager.notifyAllObservers(conf);
+    assertEquals(threads,
+        conf.getInt(HConstants.HDFS_QUORUM_READ_THREADS_MAX, 0));
+    assertEquals(timeout,
+        conf.getInt(HConstants.HDFS_QUORUM_READ_TIMEOUT_MILLIS, 0));
+  }
 }
 



Mime
View raw message