You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by li...@apache.org on 2013/11/28 19:13:31 UTC

svn commit: r1546431 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Author: liyin
Date: Thu Nov 28 18:13:30 2013
New Revision: 1546431

URL: http://svn.apache.org/r1546431
Log:
[HBASE-8805] Add online configeration supporting and corresponding testcases

Author: daviddeng

Summary: HRegion implements ConfigurationObserver, register/deregister from HRegionServer.configurationManager, testcases

Test Plan: Run testcase

Reviewers: gauravm, zelaine, liyintang

Reviewed By: liyintang

CC: mahesh, hbase-eng@

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

Task ID: 2977299

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1546431&r1=1546430&r2=1546431&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Thu Nov 28 18:13:30 2013
@@ -275,7 +275,8 @@ public class HRegion implements HeapSize
   final long memstoreFlushSize;
   // The maximum size a column family's memstore can grow up to,
   // before being flushed.
-  volatile long columnfamilyMemstoreFlushSize;
+  volatile long columnfamilyMemstoreFlushSize =
+      HTableDescriptor.DEFAULT_MEMSTORE_COLUMNFAMILY_FLUSH_SIZE;
   // Last flush time for each Store. Useful when we are flushing for each column
   private Map<Store, Long> lastStoreFlushTimeMap
     = new ConcurrentHashMap<Store, Long>();
@@ -549,16 +550,22 @@ public class HRegion implements HeapSize
     LOG.info("Online configuration changed!");
     this.loadDynamicConf(conf);
   }
+
+  private static void logIfChange(String varName, long orgV, long newV) {
+    if (orgV != newV) {
+      LOG.info(String.format("%s changed from %d to %d", varName, orgV, newV));
+    }
+  }
   /**
    * Load online configurable parameters from a specified Configuration
    */
   private void loadDynamicConf(Configuration conf) {
-    this.columnfamilyMemstoreFlushSize = conf.getLong(
+    long newColumnfamilyMemstoreFlushSize = conf.getLong(
         HConstants.HREGION_MEMSTORE_COLUMNFAMILY_FLUSH_SIZE,
         HTableDescriptor.DEFAULT_MEMSTORE_COLUMNFAMILY_FLUSH_SIZE);
-
-    LOG.info(String.format("columnfamilyMemstoreFlushSize is set to %d",
-        this.columnfamilyMemstoreFlushSize));
+    logIfChange("columnfamilyMemstoreFlushSize",
+        this.columnfamilyMemstoreFlushSize, newColumnfamilyMemstoreFlushSize);
+    this.columnfamilyMemstoreFlushSize = newColumnfamilyMemstoreFlushSize;
   }
 
   /**