HBASE-7773. Rename StoreConfiguration, remove unnecessary method (Sergey Shelukhin)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1443165 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Enis Soztutar 2013-02-06 19:44:58 +00:00
parent 7df6eff970
commit 95bd04444b
4 changed files with 18 additions and 35 deletions

View File

@ -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, StoreConfiguration {
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.

View File

@ -41,7 +41,7 @@ import com.google.common.collect.ImmutableList;
*/
@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)

View File

@ -22,24 +22,17 @@ import org.apache.hadoop.classification.InterfaceAudience;
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();

View File

@ -24,7 +24,7 @@ import org.apache.commons.logging.LogFactory;
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;
}