You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2017/06/30 14:51:09 UTC

[1/2] hbase git commit: HBASE-17995 improve log messages during snapshot tests.

Repository: hbase
Updated Branches:
  refs/heads/master 3caeba079 -> 0d4245c99


HBASE-17995 improve log messages during snapshot tests.

Signed-off-by: Michael Stack <st...@apache.org>


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

Branch: refs/heads/master
Commit: fc973d0918156ce92e63e67c433c0b59252908c5
Parents: 3caeba0
Author: Sean Busbey <bu...@apache.org>
Authored: Thu May 4 11:17:51 2017 -0500
Committer: Sean Busbey <bu...@apache.org>
Committed: Fri Jun 30 09:42:14 2017 -0500

----------------------------------------------------------------------
 .../mapreduce/TableSnapshotInputFormatTestBase.java | 12 +++++++++---
 .../mapreduce/TestTableSnapshotInputFormat.java     |  8 +++++++-
 .../hadoop/hbase/snapshot/SnapshotTestingUtils.java | 16 ++++++++++------
 3 files changed, 26 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/fc973d09/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatTestBase.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatTestBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatTestBase.java
index ed4175b..fa47253 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatTestBase.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatTestBase.java
@@ -18,6 +18,8 @@
 
 package org.apache.hadoop.hbase.mapreduce;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -49,6 +51,7 @@ import java.io.IOException;
 import java.util.Arrays;
 
 public abstract class TableSnapshotInputFormatTestBase {
+  private static final Log LOG = LogFactory.getLog(TableSnapshotInputFormatTestBase.class);
   @Rule public final TestRule timeout = CategoryBasedTimeout.builder().
       withTimeout(this.getClass()).withLookingForStuckThread(true).build();
   protected final HBaseTestingUtility UTIL = new HBaseTestingUtility();
@@ -191,11 +194,13 @@ public abstract class TableSnapshotInputFormatTestBase {
     String snapshotName, byte[] startRow, byte[] endRow, int numRegions)
     throws Exception {
     try {
+      LOG.debug("Ensuring table doesn't exist.");
       util.deleteTable(tableName);
     } catch(Exception ex) {
       // ignore
     }
 
+    LOG.info("creating table '" + tableName + "'");
     if (numRegions > 1) {
       util.createTable(tableName, FAMILIES, 1, startRow, endRow, numRegions);
     } else {
@@ -203,21 +208,22 @@ public abstract class TableSnapshotInputFormatTestBase {
     }
     Admin admin = util.getAdmin();
 
-    // put some stuff in the table
+    LOG.info("put some stuff in the table");
     Table table = util.getConnection().getTable(tableName);
     util.loadTable(table, FAMILIES);
 
     Path rootDir = FSUtils.getRootDir(util.getConfiguration());
     FileSystem fs = rootDir.getFileSystem(util.getConfiguration());
 
+    LOG.info("snapshot");
     SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
       Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);
 
-    // load different values
+    LOG.info("load different values");
     byte[] value = Bytes.toBytes("after_snapshot_value");
     util.loadTable(table, FAMILIES, value);
 
-    // cause flush to create new files in the region
+    LOG.info("cause flush to create new files in the region");
     admin.flush(tableName);
     table.close();
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/fc973d09/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSnapshotInputFormat.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSnapshotInputFormat.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSnapshotInputFormat.java
index 3b91d3b..96584c5 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSnapshotInputFormat.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSnapshotInputFormat.java
@@ -24,6 +24,8 @@ import static org.mockito.Mockito.when;
 import java.io.IOException;
 import java.util.List;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.CategoryBasedTimeout;
@@ -65,6 +67,7 @@ import org.apache.hadoop.hbase.util.FSUtils;
 
 @Category({VerySlowMapReduceTests.class, LargeTests.class})
 public class TestTableSnapshotInputFormat extends TableSnapshotInputFormatTestBase {
+  private static final Log LOG = LogFactory.getLog(TestTableSnapshotInputFormat.class);
   @Rule public final TestRule timeout = CategoryBasedTimeout.builder().
       withTimeout(this.getClass()).withLookingForStuckThread(true).build();
 
@@ -343,10 +346,13 @@ public class TestTableSnapshotInputFormat extends TableSnapshotInputFormatTestBa
       String snapshotName, byte[] startRow, byte[] endRow, Path tableDir, int numRegions,
       int expectedNumSplits, boolean shutdownCluster) throws Exception {
 
-    //create the table and snapshot
+    LOG.info("testing with MapReduce");
+
+    LOG.info("create the table and snapshot");
     createTableAndSnapshot(util, tableName, snapshotName, startRow, endRow, numRegions);
 
     if (shutdownCluster) {
+      LOG.info("shutting down hbase cluster.");
       util.shutdownMiniHBaseCluster();
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/fc973d09/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
index b8438ca..dab55f6 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
@@ -209,7 +209,7 @@ public final class SnapshotTestingUtils {
     // check snapshot dir
     Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(
         snapshotDescriptor, rootDir);
-    assertTrue(fs.exists(snapshotDir));
+    assertTrue("target snapshot directory, '"+ snapshotDir +"', doesn't exist.", fs.exists(snapshotDir));
 
     SnapshotProtos.SnapshotDescription desc = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
 
@@ -232,14 +232,14 @@ public final class SnapshotTestingUtils {
     // Verify that there are store files in the specified families
     if (nonEmptyTestFamilies != null) {
       for (final byte[] familyName: nonEmptyTestFamilies) {
-        assertTrue(snapshotFamilies.contains(familyName));
+        assertTrue("Expected snapshot to contain family '" + Bytes.toString(familyName) + "', but it does not.", snapshotFamilies.contains(familyName));
       }
     }
 
     // Verify that there are no store files in the specified families
     if (emptyTestFamilies != null) {
       for (final byte[] familyName: emptyTestFamilies) {
-        assertFalse(snapshotFamilies.contains(familyName));
+        assertFalse("Expected snapshot to skip empty family '" + Bytes.toString(familyName) + "', but it is present.", snapshotFamilies.contains(familyName));
       }
     }
 
@@ -250,7 +250,7 @@ public final class SnapshotTestingUtils {
     boolean hasMob = regionManifests.containsKey(MobUtils.getMobRegionInfo(tableName)
         .getEncodedName());
     if (hasMob) {
-      assertEquals(regions.size(), regionManifests.size() - 1);
+      assertEquals("Wrong number of regions.", regions.size(), regionManifests.size() - 1);
     } else {
       // if create snapshot when table splitting, parent region will be included to the snapshot
       // region manifest. we should exclude the parent regions.
@@ -262,13 +262,13 @@ public final class SnapshotTestingUtils {
         }
         regionCountExclusiveSplitParent++;
       }
-      assertEquals(regions.size(), regionCountExclusiveSplitParent);
+      assertEquals("Wrong number of regions.", regions.size(), regionCountExclusiveSplitParent);
     }
 
     // Verify Regions (redundant check, see MasterSnapshotVerifier)
     for (HRegionInfo info : regions) {
       String regionName = info.getEncodedName();
-      assertTrue(regionManifests.containsKey(regionName));
+      assertTrue("Missing region name: '" + regionName + "'", regionManifests.containsKey(regionName));
     }
   }
 
@@ -403,20 +403,24 @@ public final class SnapshotTestingUtils {
         throws Exception {
     if (!onlineSnapshot) {
       try {
+        LOG.info("prepping for offline snapshot.");
         admin.disableTable(tableName);
       } catch (TableNotEnabledException tne) {
         LOG.info("In attempting to disable " + tableName + " it turns out that the this table is " +
             "already disabled.");
       }
     }
+    LOG.info("taking snapshot.");
     admin.snapshot(snapshotNameString, tableName);
 
+    LOG.info("Confirming snapshot exists.");
     List<SnapshotDescription> snapshots =
         SnapshotTestingUtils.assertExistsMatchingSnapshot(admin, snapshotNameString, tableName);
     if (snapshots == null || snapshots.size() != 1) {
       Assert.fail("Incorrect number of snapshots for table " + tableName);
     }
 
+    LOG.info("validating snapshot.");
     SnapshotTestingUtils.confirmSnapshotValid(
       ProtobufUtil.createHBaseProtosSnapshotDesc(snapshots.get(0)), tableName, nonEmptyFamilyNames,
       emptyFamilyNames, rootDir, admin, fs);


[2/2] hbase git commit: HBASE-18293 Only add the spotbugs dependency when jdk8 is active

Posted by bu...@apache.org.
HBASE-18293 Only add the spotbugs dependency when jdk8 is active

Signed-off-by: Sean Busbey <bu...@apache.org>


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

Branch: refs/heads/master
Commit: 0d4245c99e5e0a326d384af643ec268cc312513a
Parents: fc973d0
Author: Chia-Ping Tsai <ch...@gmail.com>
Authored: Thu Jun 29 13:16:40 2017 +0800
Committer: Sean Busbey <bu...@apache.org>
Committed: Fri Jun 30 09:43:02 2017 -0500

----------------------------------------------------------------------
 pom.xml | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0d4245c9/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index adb487b..c64033c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -667,13 +667,6 @@
             <xmlOutput>true</xmlOutput>
             <effort>Max</effort>
           </configuration>
-          <dependencies>
-            <dependency>
-              <groupId>com.github.spotbugs</groupId>
-              <artifactId>spotbugs</artifactId>
-              <version>${spotbugs.version}</version>
-            </dependency>
-          </dependencies>
         </plugin>
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
@@ -2079,6 +2072,25 @@
                 <additionalparam>-Xdoclint:none</additionalparam>
               </configuration>
             </plugin>
+            <plugin>
+              <groupId>org.codehaus.mojo</groupId>
+              <artifactId>findbugs-maven-plugin</artifactId>
+              <version>3.0.0</version>
+              <!--NOTE: Findbugs 3.0.0 requires jdk7-->
+              <configuration>
+                <excludeFilterFile>${project.basedir}/../dev-support/findbugs-exclude.xml</excludeFilterFile>
+                <findbugsXmlOutput>true</findbugsXmlOutput>
+                <xmlOutput>true</xmlOutput>
+                <effort>Max</effort>
+              </configuration>
+              <dependencies>
+                <dependency>
+                  <groupId>com.github.spotbugs</groupId>
+                  <artifactId>spotbugs</artifactId>
+                  <version>${spotbugs.version}</version>
+                </dependency>
+              </dependencies>
+            </plugin>
           </plugins>
         </pluginManagement>
       </build>