[10/26] hbase git commit: HBASE-19589 New regions should always be added with state CLOSED (followup of HBASE-19530)

2017-12-22 Thread zhangduo
HBASE-19589 New regions should always be added with state CLOSED (followup of 
HBASE-19530)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8ec0aa0d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8ec0aa0d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8ec0aa0d

Branch: refs/heads/HBASE-19397
Commit: 8ec0aa0d709ced78331dd61d28c79f3433198227
Parents: 070c2ee
Author: Apekshit Sharma 
Authored: Thu Dec 21 17:14:25 2017 -0800
Committer: Apekshit Sharma 
Committed: Thu Dec 21 22:57:53 2017 -0800

--
 .../apache/hadoop/hbase/MetaTableAccessor.java  | 247 +--
 .../procedure/CloneSnapshotProcedure.java   |   2 +
 .../hbase/snapshot/RestoreSnapshotHelper.java   |   2 +-
 .../hadoop/hbase/HBaseTestingUtility.java   |   2 +-
 .../hadoop/hbase/util/BaseTestHBaseFsck.java|  17 --
 .../util/hbck/OfflineMetaRebuildTestCore.java   |   2 +-
 6 files changed, 73 insertions(+), 199 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/8ec0aa0d/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
--
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
index 4f14192..f75472b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
@@ -1314,16 +1314,14 @@ public class MetaTableAccessor {
   /**
* Generates and returns a Put containing the region into for the catalog 
table
*/
-  public static Put makePutFromRegionInfo(RegionInfo regionInfo)
-throws IOException {
+  public static Put makePutFromRegionInfo(RegionInfo regionInfo) throws 
IOException {
 return makePutFromRegionInfo(regionInfo, 
EnvironmentEdgeManager.currentTime());
   }
 
   /**
* Generates and returns a Put containing the region into for the catalog 
table
*/
-  public static Put makePutFromRegionInfo(RegionInfo regionInfo, long ts)
-throws IOException {
+  public static Put makePutFromRegionInfo(RegionInfo regionInfo, long ts) 
throws IOException {
 Put put = new Put(regionInfo.getRegionName(), ts);
 addRegionInfo(put, regionInfo);
 return put;
@@ -1448,9 +1446,7 @@ public class MetaTableAccessor {
*/
   private static void put(final Table t, final List puts) throws 
IOException {
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(puts));
-  }
+  debugLogMutations(puts);
   t.put(puts);
 } finally {
   t.close();
@@ -1467,9 +1463,7 @@ public class MetaTableAccessor {
 throws IOException {
 Table t = getMetaHTable(connection);
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(ps));
-  }
+  debugLogMutations(ps);
   t.put(ps);
 } finally {
   t.close();
@@ -1499,9 +1493,7 @@ public class MetaTableAccessor {
 throws IOException {
 Table t = getMetaHTable(connection);
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(deletes));
-  }
+  debugLogMutations(deletes);
   t.delete(deletes);
 } finally {
   t.close();
@@ -1546,9 +1538,7 @@ public class MetaTableAccessor {
 throws IOException {
 Table t = getMetaHTable(connection);
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(mutations));
-  }
+  debugLogMutations(mutations);
   t.batch(mutations, null);
 } catch (InterruptedException e) {
   InterruptedIOException ie = new InterruptedIOException(e.getMessage());
@@ -1559,33 +1549,7 @@ public class MetaTableAccessor {
 }
   }
 
-  /**
-   * Adds a hbase:meta row for the specified new region.
-   * @param connection connection we're using
-   * @param regionInfo region information
-   * @throws IOException if problem connecting or updating meta
-   */
-  @VisibleForTesting
-  static void addRegionToMeta(Connection connection,
- RegionInfo regionInfo)
-throws IOException {
-putToMetaTable(connection, makePutFromRegionInfo(regionInfo));
-LOG.info("Added " + regionInfo.getRegionNameAsString());
-  }
-
-  /**
-   * Adds a hbase:meta row for the specified new region to the given catalog 
table. The
-   * Table is not flushed or closed.
-   * @param meta the Table for META
-   * @param regionInfo region information
-   * @throws IOException if problem connecting or updating meta
-   */
-  public static void addRegionToMeta(Table meta, RegionInfo regionInfo) throws 
IOException {
-addRegionToMeta(meta, regionInfo, 

hbase git commit: HBASE-19589 New regions should always be added with state CLOSED (followup of HBASE-19530)

2017-12-21 Thread appy
Repository: hbase
Updated Branches:
  refs/heads/branch-2 c89cfd340 -> 11ea19a10


HBASE-19589 New regions should always be added with state CLOSED (followup of 
HBASE-19530)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/11ea19a1
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/11ea19a1
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/11ea19a1

Branch: refs/heads/branch-2
Commit: 11ea19a1015a73904ebf7fcabfed763a90889ef1
Parents: c89cfd3
Author: Apekshit Sharma 
Authored: Thu Dec 21 17:14:25 2017 -0800
Committer: Apekshit Sharma 
Committed: Thu Dec 21 22:58:28 2017 -0800

--
 .../apache/hadoop/hbase/MetaTableAccessor.java  | 247 +--
 .../procedure/CloneSnapshotProcedure.java   |   2 +
 .../hbase/snapshot/RestoreSnapshotHelper.java   |   2 +-
 .../hadoop/hbase/HBaseTestingUtility.java   |   2 +-
 .../hadoop/hbase/util/BaseTestHBaseFsck.java|  17 --
 .../util/hbck/OfflineMetaRebuildTestCore.java   |   2 +-
 6 files changed, 73 insertions(+), 199 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/11ea19a1/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
--
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
index 4f14192..f75472b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
@@ -1314,16 +1314,14 @@ public class MetaTableAccessor {
   /**
* Generates and returns a Put containing the region into for the catalog 
table
*/
-  public static Put makePutFromRegionInfo(RegionInfo regionInfo)
-throws IOException {
+  public static Put makePutFromRegionInfo(RegionInfo regionInfo) throws 
IOException {
 return makePutFromRegionInfo(regionInfo, 
EnvironmentEdgeManager.currentTime());
   }
 
   /**
* Generates and returns a Put containing the region into for the catalog 
table
*/
-  public static Put makePutFromRegionInfo(RegionInfo regionInfo, long ts)
-throws IOException {
+  public static Put makePutFromRegionInfo(RegionInfo regionInfo, long ts) 
throws IOException {
 Put put = new Put(regionInfo.getRegionName(), ts);
 addRegionInfo(put, regionInfo);
 return put;
@@ -1448,9 +1446,7 @@ public class MetaTableAccessor {
*/
   private static void put(final Table t, final List puts) throws 
IOException {
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(puts));
-  }
+  debugLogMutations(puts);
   t.put(puts);
 } finally {
   t.close();
@@ -1467,9 +1463,7 @@ public class MetaTableAccessor {
 throws IOException {
 Table t = getMetaHTable(connection);
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(ps));
-  }
+  debugLogMutations(ps);
   t.put(ps);
 } finally {
   t.close();
@@ -1499,9 +1493,7 @@ public class MetaTableAccessor {
 throws IOException {
 Table t = getMetaHTable(connection);
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(deletes));
-  }
+  debugLogMutations(deletes);
   t.delete(deletes);
 } finally {
   t.close();
@@ -1546,9 +1538,7 @@ public class MetaTableAccessor {
 throws IOException {
 Table t = getMetaHTable(connection);
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(mutations));
-  }
+  debugLogMutations(mutations);
   t.batch(mutations, null);
 } catch (InterruptedException e) {
   InterruptedIOException ie = new InterruptedIOException(e.getMessage());
@@ -1559,33 +1549,7 @@ public class MetaTableAccessor {
 }
   }
 
-  /**
-   * Adds a hbase:meta row for the specified new region.
-   * @param connection connection we're using
-   * @param regionInfo region information
-   * @throws IOException if problem connecting or updating meta
-   */
-  @VisibleForTesting
-  static void addRegionToMeta(Connection connection,
- RegionInfo regionInfo)
-throws IOException {
-putToMetaTable(connection, makePutFromRegionInfo(regionInfo));
-LOG.info("Added " + regionInfo.getRegionNameAsString());
-  }
-
-  /**
-   * Adds a hbase:meta row for the specified new region to the given catalog 
table. The
-   * Table is not flushed or closed.
-   * @param meta the Table for META
-   * @param regionInfo region information
-   * @throws IOException if problem connecting or updating meta
-   */
-  public static void addRegionToMeta(Table meta, 

hbase git commit: HBASE-19589 New regions should always be added with state CLOSED (followup of HBASE-19530)

2017-12-21 Thread appy
Repository: hbase
Updated Branches:
  refs/heads/master 070c2ee7d -> 8ec0aa0d7


HBASE-19589 New regions should always be added with state CLOSED (followup of 
HBASE-19530)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8ec0aa0d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8ec0aa0d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8ec0aa0d

Branch: refs/heads/master
Commit: 8ec0aa0d709ced78331dd61d28c79f3433198227
Parents: 070c2ee
Author: Apekshit Sharma 
Authored: Thu Dec 21 17:14:25 2017 -0800
Committer: Apekshit Sharma 
Committed: Thu Dec 21 22:57:53 2017 -0800

--
 .../apache/hadoop/hbase/MetaTableAccessor.java  | 247 +--
 .../procedure/CloneSnapshotProcedure.java   |   2 +
 .../hbase/snapshot/RestoreSnapshotHelper.java   |   2 +-
 .../hadoop/hbase/HBaseTestingUtility.java   |   2 +-
 .../hadoop/hbase/util/BaseTestHBaseFsck.java|  17 --
 .../util/hbck/OfflineMetaRebuildTestCore.java   |   2 +-
 6 files changed, 73 insertions(+), 199 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/8ec0aa0d/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
--
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
index 4f14192..f75472b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
@@ -1314,16 +1314,14 @@ public class MetaTableAccessor {
   /**
* Generates and returns a Put containing the region into for the catalog 
table
*/
-  public static Put makePutFromRegionInfo(RegionInfo regionInfo)
-throws IOException {
+  public static Put makePutFromRegionInfo(RegionInfo regionInfo) throws 
IOException {
 return makePutFromRegionInfo(regionInfo, 
EnvironmentEdgeManager.currentTime());
   }
 
   /**
* Generates and returns a Put containing the region into for the catalog 
table
*/
-  public static Put makePutFromRegionInfo(RegionInfo regionInfo, long ts)
-throws IOException {
+  public static Put makePutFromRegionInfo(RegionInfo regionInfo, long ts) 
throws IOException {
 Put put = new Put(regionInfo.getRegionName(), ts);
 addRegionInfo(put, regionInfo);
 return put;
@@ -1448,9 +1446,7 @@ public class MetaTableAccessor {
*/
   private static void put(final Table t, final List puts) throws 
IOException {
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(puts));
-  }
+  debugLogMutations(puts);
   t.put(puts);
 } finally {
   t.close();
@@ -1467,9 +1463,7 @@ public class MetaTableAccessor {
 throws IOException {
 Table t = getMetaHTable(connection);
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(ps));
-  }
+  debugLogMutations(ps);
   t.put(ps);
 } finally {
   t.close();
@@ -1499,9 +1493,7 @@ public class MetaTableAccessor {
 throws IOException {
 Table t = getMetaHTable(connection);
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(deletes));
-  }
+  debugLogMutations(deletes);
   t.delete(deletes);
 } finally {
   t.close();
@@ -1546,9 +1538,7 @@ public class MetaTableAccessor {
 throws IOException {
 Table t = getMetaHTable(connection);
 try {
-  if (METALOG.isDebugEnabled()) {
-METALOG.debug(mutationsToString(mutations));
-  }
+  debugLogMutations(mutations);
   t.batch(mutations, null);
 } catch (InterruptedException e) {
   InterruptedIOException ie = new InterruptedIOException(e.getMessage());
@@ -1559,33 +1549,7 @@ public class MetaTableAccessor {
 }
   }
 
-  /**
-   * Adds a hbase:meta row for the specified new region.
-   * @param connection connection we're using
-   * @param regionInfo region information
-   * @throws IOException if problem connecting or updating meta
-   */
-  @VisibleForTesting
-  static void addRegionToMeta(Connection connection,
- RegionInfo regionInfo)
-throws IOException {
-putToMetaTable(connection, makePutFromRegionInfo(regionInfo));
-LOG.info("Added " + regionInfo.getRegionNameAsString());
-  }
-
-  /**
-   * Adds a hbase:meta row for the specified new region to the given catalog 
table. The
-   * Table is not flushed or closed.
-   * @param meta the Table for META
-   * @param regionInfo region information
-   * @throws IOException if problem connecting or updating meta
-   */
-  public static void addRegionToMeta(Table meta,