You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2013/01/15 05:59:13 UTC
svn commit: r1433288 -
/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Author: stack
Date: Tue Jan 15 04:59:13 2013
New Revision: 1433288
URL: http://svn.apache.org/viewvc?rev=1433288&view=rev
Log:
HBASE-7566 remove useless ctor from HRegion and move sporadic null checks earlier
Modified:
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1433288&r1=1433287&r2=1433288&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Tue Jan 15 04:59:13 2013
@@ -387,35 +387,6 @@ public class HRegion implements HeapSize
private final MetricsRegionWrapperImpl metricsRegionWrapper;
/**
- * Should only be used for testing purposes
- */
- public HRegion(){
- this.tableDir = null;
- this.blockingMemStoreSize = 0L;
- this.conf = null;
- this.rowLockWaitDuration = DEFAULT_ROWLOCK_WAIT_DURATION;
- this.rsServices = null;
- this.baseConf = null;
- this.fs = null;
- this.timestampSlop = HConstants.LATEST_TIMESTAMP;
- this.rowProcessorTimeout = DEFAULT_ROW_PROCESSOR_TIMEOUT;
- this.memstoreFlushSize = 0L;
- this.log = null;
- this.regiondir = null;
- this.regionInfo = null;
- this.htableDescriptor = null;
- this.threadWakeFrequency = 0L;
- this.coprocessorHost = null;
- this.scannerReadPoints = new ConcurrentHashMap<RegionScanner, Long>();
-
- this.metricsRegionWrapper = new MetricsRegionWrapperImpl(this);
- this.metricsRegion = new MetricsRegion(this.metricsRegionWrapper);
- this.maxBusyWaitDuration = 2 * HConstants.DEFAULT_HBASE_RPC_TIMEOUT;
- this.busyWaitDuration = DEFAULT_BUSY_WAIT_DURATION;
- this.maxBusyWaitMultiplier = 2;
- }
-
- /**
* HRegion copy constructor. Useful when reopening a closed region (normally
* for unit tests)
* @param other original object
@@ -451,6 +422,9 @@ public class HRegion implements HeapSize
public HRegion(Path tableDir, HLog log, FileSystem fs,
Configuration confParam, final HRegionInfo regionInfo,
final HTableDescriptor htd, RegionServerServices rsServices) {
+ if (htd == null) {
+ throw new IllegalArgumentException("Need table descriptor");
+ }
this.tableDir = tableDir;
this.comparator = regionInfo.getComparator();
this.log = log;
@@ -595,8 +569,7 @@ public class HRegion implements HeapSize
// initialized to -1 so that we pick up MemstoreTS from column families
long maxMemstoreTS = -1;
- if (this.htableDescriptor != null &&
- !htableDescriptor.getFamilies().isEmpty()) {
+ if (!htableDescriptor.getFamilies().isEmpty()) {
// initialize the thread pool for opening stores in parallel.
ThreadPoolExecutor storeOpenerThreadPool =
getStoreOpenAndCloseThreadPool(
@@ -652,9 +625,7 @@ public class HRegion implements HeapSize
// being split but we crashed in the middle of it all.
SplitTransaction.cleanupAnySplitDetritus(this);
FSUtils.deleteDirectory(this.fs, new Path(regiondir, MERGEDIR));
- if (this.htableDescriptor != null) {
- this.writestate.setReadOnly(this.htableDescriptor.isReadOnly());
- }
+ this.writestate.setReadOnly(this.htableDescriptor.isReadOnly());
this.writestate.flushRequested = false;
this.writestate.compacting = 0;