You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by en...@apache.org on 2013/02/06 20:44:58 UTC

svn commit: r1443165 - in /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver: HStore.java Store.java StoreConfigInformation.java StoreConfiguration.java compactions/CompactionConfiguration.java

Author: enis
Date: Wed Feb  6 19:44:58 2013
New Revision: 1443165

URL: http://svn.apache.org/viewvc?rev=1443165&view=rev
Log:
HBASE-7773. Rename StoreConfiguration, remove unnecessary method (Sergey Shelukhin)

Added:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreConfigInformation.java
      - copied, changed from r1443155, hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreConfiguration.java
Removed:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreConfiguration.java
Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionConfiguration.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java?rev=1443165&r1=1443164&r2=1443165&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java Wed Feb  6 19:44:58 2013
@@ -104,9 +104,8 @@ import com.google.common.collect.Lists;
  * <p>Locking and transactions are handled at a higher level.  This API should
  * not be called directly but by an HRegion manager.
  */
-//TODO: move StoreConfiguration implementation into a separate class.
 @InterfaceAudience.Private
-public class HStore implements Store, StoreConfiguration {
+public class HStore implements Store {
   static final Log LOG = LogFactory.getLog(HStore.class);
 
   protected final MemStore memstore;
@@ -293,21 +292,18 @@ public class HStore implements Store, St
     return this.fs;
   }
 
-  /* Implementation of StoreConfiguration */
+  /* Implementation of StoreConfigInformation */
+  @Override
   public long getStoreFileTtl() {
     // TTL only applies if there's no MIN_VERSIONs setting on the column.
     return (this.scanInfo.getMinVersions() == 0) ? this.ttl : Long.MAX_VALUE;
   }
 
-  public Long getMajorCompactionPeriod() {
-    String strCompactionTime = this.family.getValue(HConstants.MAJOR_COMPACTION_PERIOD);
-    return (strCompactionTime != null) ? new Long(strCompactionTime) : null;
-  }
-
+  @Override
   public long getMemstoreFlushSize() {
     return this.region.memstoreFlushSize;
   }
-  /* End implementation of StoreConfiguration */
+  /* End implementation of StoreConfigInformation */
 
   /**
    * Returns the configured bytesPerChecksum value.

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java?rev=1443165&r1=1443164&r2=1443165&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java Wed Feb  6 19:44:58 2013
@@ -41,7 +41,7 @@ import com.google.common.collect.Immutab
  */
 @InterfaceAudience.Private
 @InterfaceStability.Evolving
-public interface Store extends  HeapSize {
+public interface Store extends HeapSize, StoreConfigInformation {
 
   /* The default priority for user-specified compaction requests.
    * The user gets top priority unless we have blocking compactions. (Pri <= 0)

Copied: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreConfigInformation.java (from r1443155, hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreConfiguration.java)
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreConfigInformation.java?p2=hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreConfigInformation.java&p1=hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreConfiguration.java&r1=1443155&r2=1443165&rev=1443165&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreConfiguration.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreConfigInformation.java Wed Feb  6 19:44:58 2013
@@ -22,24 +22,17 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.classification.InterfaceStability;
 
 /**
- * The class that contains shared information about various knobs of a Store/HStore object.
- * Unlike the configuration objects that merely return the XML values, the implementations
- * should return ready-to-use applicable values for corresponding calls, after all the
- * parsing/validation/adjustment for other considerations, so that we don't have to repeat
- * this logic in multiple places.
- * TODO: move methods and logic here as necessary.
+ * A more restricted interface for HStore. Only gives the caller access to information
+ * about store configuration/settings that cannot easily be obtained from XML config object.
+ * Example user would be CompactionPolicy that doesn't need entire (H)Store, only this.
+ * Add things here as needed.
  */
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
-public interface StoreConfiguration {
-  /**
-   * Gets the cf-specific major compaction period.
-   */
-  public Long getMajorCompactionPeriod();
-
-
+public interface StoreConfigInformation {
   /**
    * Gets the Memstore flush size for the region that this store works with.
+   * TODO: remove after HBASE-7236 is fixed.
    */
   public long getMemstoreFlushSize();
 

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionConfiguration.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionConfiguration.java?rev=1443165&r1=1443164&r2=1443165&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionConfiguration.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactionConfiguration.java Wed Feb  6 19:44:58 2013
@@ -24,7 +24,7 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.regionserver.StoreConfiguration;
+import org.apache.hadoop.hbase.regionserver.StoreConfigInformation;
 
 /**
  * Compaction configuration for a particular instance of HStore.
@@ -49,7 +49,7 @@ public class CompactionConfiguration {
   private static final String CONFIG_PREFIX = "hbase.hstore.compaction.";
 
   Configuration conf;
-  StoreConfiguration storeConfig;
+  StoreConfigInformation storeConfigInfo;
 
   long maxCompactSize;
   long minCompactSize;
@@ -64,13 +64,13 @@ public class CompactionConfiguration {
   long majorCompactionPeriod;
   float majorCompactionJitter;
 
-  CompactionConfiguration(Configuration conf, StoreConfiguration storeConfig) {
+  CompactionConfiguration(Configuration conf, StoreConfigInformation storeConfigInfo) {
     this.conf = conf;
-    this.storeConfig = storeConfig;
+    this.storeConfigInfo = storeConfigInfo;
 
     maxCompactSize = conf.getLong(CONFIG_PREFIX + "max.size", Long.MAX_VALUE);
     minCompactSize = conf.getLong(CONFIG_PREFIX + "min.size",
-        storeConfig.getMemstoreFlushSize());
+        storeConfigInfo.getMemstoreFlushSize());
     minFilesToCompact = Math.max(2, conf.getInt(CONFIG_PREFIX + "min",
           /*old name*/ conf.getInt("hbase.hstore.compactionThreshold", 3)));
     maxFilesToCompact = conf.getInt(CONFIG_PREFIX + "max", 10);
@@ -89,7 +89,7 @@ public class CompactionConfiguration {
     }
 
     throttlePoint =  conf.getLong("hbase.regionserver.thread.compaction.throttle",
-          2 * maxFilesToCompact * storeConfig.getMemstoreFlushSize());
+          2 * maxFilesToCompact * storeConfigInfo.getMemstoreFlushSize());
     shouldDeleteExpired = conf.getBoolean("hbase.store.delete.expired.storefile", true);
     majorCompactionPeriod = conf.getLong(HConstants.MAJOR_COMPACTION_PERIOD, 1000*60*60*24);
     majorCompactionJitter = conf.getFloat("hbase.hregion.majorcompaction.jitter", 0.20F);
@@ -184,12 +184,6 @@ public class CompactionConfiguration {
    * Major compactions are selected periodically according to this parameter plus jitter
    */
   long getMajorCompactionPeriod() {
-    if (storeConfig != null) {
-      Long storeSpecificPeriod = storeConfig.getMajorCompactionPeriod();
-      if (storeSpecificPeriod != null) {
-        return storeSpecificPeriod;
-      }
-    }
     return majorCompactionPeriod;
   }