[2/3] hbase git commit: HBASE-18183 Region interface cleanup for CP expose.

2017-10-11 Thread anoopsamjohn
http://git-wip-us.apache.org/repos/asf/hbase/blob/b212bf93/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
index e3ba2fa..7d72b88 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
@@ -22,13 +22,12 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellComparator;
 import org.apache.hadoop.hbase.CompareOperator;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
-import org.apache.hadoop.hbase.HDFSBlocksDistribution;
 import org.apache.hadoop.hbase.client.Append;
+import org.apache.hadoop.hbase.client.CompactionState;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Increment;
@@ -41,34 +40,17 @@ import org.apache.hadoop.hbase.client.RowMutations;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.conf.ConfigurationObserver;
-import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
+import org.apache.hadoop.hbase.coprocessor.RegionCoprocessor;
 import org.apache.hadoop.hbase.filter.ByteArrayComparable;
 import 
org.apache.hadoop.hbase.regionserver.compactions.CompactionLifeCycleTracker;
 import org.apache.hadoop.hbase.security.User;
-import org.apache.hadoop.hbase.util.Pair;
-import org.apache.hadoop.hbase.wal.WALSplitter.MutationReplay;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.yetus.audience.InterfaceStability;
 
-import 
org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
-import org.apache.hadoop.hbase.shaded.com.google.protobuf.Service;
-import 
org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState;
-import 
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CoprocessorServiceCall;
-
 /**
- * Regions store data for a certain region of a table.  It stores all columns
- * for each row. A given table consists of one or more Regions.
- *
- * An Region is defined by its table and its key extent.
- *
- * Locking at the Region level serves only one purpose: preventing the
- * region from being closed (and consequently split) while other operations
- * are ongoing. Each row level operation obtains both a row lock and a region
- * read lock for the duration of the operation. While a scanner is being
- * constructed, getScanner holds a read lock. If the scanner is successfully
- * constructed, it holds a read lock until it is closed. A close takes out a
- * write lock and consequently will block for ongoing operations and will block
- * new operations from starting while the close is in progress.
+ * Region is a subset of HRegion with operations required for the {@link 
RegionCoprocessor
+ * Coprocessors}. The operations include ability to do mutations, requesting 
compaction, getting
+ * different counters/sizes, locking rows and getting access to {@linkplain 
Store}s.
  */
 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
 @InterfaceStability.Evolving
@@ -131,24 +113,11 @@ public interface Region extends ConfigurationObserver {
*/
   boolean refreshStoreFiles() throws IOException;
 
-  /** @return the latest sequence number that was read from storage when this 
region was opened */
-  long getOpenSeqNum();
-
   /** @return the max sequence id of flushed data on this region; no edit in 
memory will have
* a sequence id that is less that what is returned here.
*/
   long getMaxFlushedSeqId();
 
-  /** @return the oldest flushed sequence id for the given family; can be 
beyond
-   * {@link #getMaxFlushedSeqId()} in case where we've flushed a subset of a 
regions column
-   * families
-   * @deprecated Since version 1.2.0. Exposes too much about our internals; 
shutting it down.
-   * Do not use.
-   */
-  @VisibleForTesting
-  @Deprecated
-  public long getOldestSeqIdOfStore(byte[] familyName);
-
   /**
* This can be used to determine the last time all files of this region were 
major compacted.
* @param majorCompactionOnly Only consider HFile that are the result of 
major compaction
@@ -162,20 +131,10 @@ public interface Region extends ConfigurationObserver {
*/
   public Map getMaxStoreSeqId();
 
-  /** @return true if loading column families on demand by default */
-  boolean isLoadingCfsOnDemandDefault();
-
   /** @return readpoint considering given IsolationLevel; pass null for 
default*/
   long getReadPoint(IsolationLevel isolationLevel);
 
   /**
-   * @retur

[2/3] hbase git commit: HBASE-18183 Region interface cleanup for CP expose.

2017-10-11 Thread anoopsamjohn
http://git-wip-us.apache.org/repos/asf/hbase/blob/b4ed1300/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
--
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
index e3ba2fa..7d72b88 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java
@@ -22,13 +22,12 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellComparator;
 import org.apache.hadoop.hbase.CompareOperator;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
-import org.apache.hadoop.hbase.HDFSBlocksDistribution;
 import org.apache.hadoop.hbase.client.Append;
+import org.apache.hadoop.hbase.client.CompactionState;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Increment;
@@ -41,34 +40,17 @@ import org.apache.hadoop.hbase.client.RowMutations;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.client.TableDescriptor;
 import org.apache.hadoop.hbase.conf.ConfigurationObserver;
-import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
+import org.apache.hadoop.hbase.coprocessor.RegionCoprocessor;
 import org.apache.hadoop.hbase.filter.ByteArrayComparable;
 import 
org.apache.hadoop.hbase.regionserver.compactions.CompactionLifeCycleTracker;
 import org.apache.hadoop.hbase.security.User;
-import org.apache.hadoop.hbase.util.Pair;
-import org.apache.hadoop.hbase.wal.WALSplitter.MutationReplay;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.yetus.audience.InterfaceStability;
 
-import 
org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
-import org.apache.hadoop.hbase.shaded.com.google.protobuf.Service;
-import 
org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState;
-import 
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.CoprocessorServiceCall;
-
 /**
- * Regions store data for a certain region of a table.  It stores all columns
- * for each row. A given table consists of one or more Regions.
- *
- * An Region is defined by its table and its key extent.
- *
- * Locking at the Region level serves only one purpose: preventing the
- * region from being closed (and consequently split) while other operations
- * are ongoing. Each row level operation obtains both a row lock and a region
- * read lock for the duration of the operation. While a scanner is being
- * constructed, getScanner holds a read lock. If the scanner is successfully
- * constructed, it holds a read lock until it is closed. A close takes out a
- * write lock and consequently will block for ongoing operations and will block
- * new operations from starting while the close is in progress.
+ * Region is a subset of HRegion with operations required for the {@link 
RegionCoprocessor
+ * Coprocessors}. The operations include ability to do mutations, requesting 
compaction, getting
+ * different counters/sizes, locking rows and getting access to {@linkplain 
Store}s.
  */
 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
 @InterfaceStability.Evolving
@@ -131,24 +113,11 @@ public interface Region extends ConfigurationObserver {
*/
   boolean refreshStoreFiles() throws IOException;
 
-  /** @return the latest sequence number that was read from storage when this 
region was opened */
-  long getOpenSeqNum();
-
   /** @return the max sequence id of flushed data on this region; no edit in 
memory will have
* a sequence id that is less that what is returned here.
*/
   long getMaxFlushedSeqId();
 
-  /** @return the oldest flushed sequence id for the given family; can be 
beyond
-   * {@link #getMaxFlushedSeqId()} in case where we've flushed a subset of a 
regions column
-   * families
-   * @deprecated Since version 1.2.0. Exposes too much about our internals; 
shutting it down.
-   * Do not use.
-   */
-  @VisibleForTesting
-  @Deprecated
-  public long getOldestSeqIdOfStore(byte[] familyName);
-
   /**
* This can be used to determine the last time all files of this region were 
major compacted.
* @param majorCompactionOnly Only consider HFile that are the result of 
major compaction
@@ -162,20 +131,10 @@ public interface Region extends ConfigurationObserver {
*/
   public Map getMaxStoreSeqId();
 
-  /** @return true if loading column families on demand by default */
-  boolean isLoadingCfsOnDemandDefault();
-
   /** @return readpoint considering given IsolationLevel; pass null for 
default*/
   long getReadPoint(IsolationLevel isolationLevel);
 
   /**
-   * @retur