diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/FlushRegionCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/FlushRegionCallable.java index b2c4a57c0c9..73bdb740ca1 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/FlushRegionCallable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/FlushRegionCallable.java @@ -20,6 +20,8 @@ package org.apache.hadoop.hbase.client; import java.io.IOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.classification.InterfaceAudience; @@ -31,7 +33,6 @@ import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.FlushRegionRequest import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.FlushRegionResponse; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; -import org.mortbay.log.Log; import com.google.protobuf.ServiceException; @@ -41,6 +42,8 @@ import com.google.protobuf.ServiceException; @InterfaceAudience.Private public class FlushRegionCallable extends RegionAdminServiceCallable { + private static final Log LOG = LogFactory.getLog(FlushRegionCallable.class); + private final byte[] regionName; private final boolean writeFlushWalMarker; private boolean reload; @@ -78,7 +81,7 @@ public class FlushRegionCallable extends RegionAdminServiceCallable> allClasses = allClassesFinder.findClasses(pkgName, false); @@ -246,7 +250,7 @@ public class TestClassFinder { final long counter = testCounter.incrementAndGet(); final String classNamePrefix = name.getMethodName(); String pkgNameSuffix = name.getMethodName(); - Log.info("Created jar " + createAndLoadJar(pkgNameSuffix, classNamePrefix, counter)); + LOG.info("Created jar " + createAndLoadJar(pkgNameSuffix, classNamePrefix, counter)); final String classNameToFilterOut = classNamePrefix + counter; final ClassFinder.FileNameFilter notThisFilter = new ClassFinder.FileNameFilter() { @Override @@ -271,7 +275,7 @@ public class TestClassFinder { final long counter = testCounter.incrementAndGet(); final String classNamePrefix = name.getMethodName(); String pkgNameSuffix = name.getMethodName(); - Log.info("Created jar " + createAndLoadJar(pkgNameSuffix, classNamePrefix, counter)); + LOG.info("Created jar " + createAndLoadJar(pkgNameSuffix, classNamePrefix, counter)); final Class clazz = makeClass(pkgNameSuffix, classNamePrefix, counter); final ClassFinder.ClassFilter notThisFilter = new ClassFinder.ClassFilter() { @Override diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/ClientSideRegionScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/ClientSideRegionScanner.java index 1ec085f31a3..dde2f100120 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/ClientSideRegionScanner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/ClientSideRegionScanner.java @@ -22,6 +22,8 @@ import java.io.IOException; import java.util.ArrayList; 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.FileSystem; import org.apache.hadoop.fs.Path; @@ -33,7 +35,6 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.client.metrics.ScanMetrics; import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.RegionScanner; -import org.mortbay.log.Log; /** * A client scanner for a region opened for read-only on the client side. Assumes region data @@ -42,6 +43,8 @@ import org.mortbay.log.Log; @InterfaceAudience.Private public class ClientSideRegionScanner extends AbstractClientScanner { + private static final Log LOG = LogFactory.getLog(ClientSideRegionScanner.class); + private HRegion region; RegionScanner scanner; List values; @@ -96,7 +99,7 @@ public class ClientSideRegionScanner extends AbstractClientScanner { this.scanner.close(); this.scanner = null; } catch (IOException ex) { - Log.warn("Exception while closing scanner", ex); + LOG.warn("Exception while closing scanner", ex); } } if (this.region != null) { @@ -105,7 +108,7 @@ public class ClientSideRegionScanner extends AbstractClientScanner { this.region.close(true); this.region = null; } catch (IOException ex) { - Log.warn("Exception while closing region", ex); + LOG.warn("Exception while closing region", ex); } } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHBaseAdminNoCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHBaseAdminNoCluster.java index 19774d74fa8..c4a7ef81b61 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHBaseAdminNoCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHBaseAdminNoCluster.java @@ -24,6 +24,8 @@ import static org.mockito.Mockito.when; import java.io.IOException; import java.util.ArrayList; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseTestingUtility; @@ -52,13 +54,15 @@ import org.mockito.Matchers; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.mortbay.log.Log; import com.google.protobuf.RpcController; import com.google.protobuf.ServiceException; @Category(SmallTests.class) public class TestHBaseAdminNoCluster { + + private static final Log LOG = LogFactory.getLog(TestHBaseAdminNoCluster.class); + /** * Verify that PleaseHoldException gets retried. * HBASE-8764 @@ -98,7 +102,7 @@ public class TestHBaseAdminNoCluster { admin.createTable(htd, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE); fail(); } catch (RetriesExhaustedException e) { - Log.info("Expected fail", e); + LOG.info("Expected fail", e); } // Assert we were called 'count' times. Mockito.verify(masterAdmin, Mockito.atLeast(count)).createTable((RpcController)Mockito.any(), @@ -316,7 +320,7 @@ public class TestHBaseAdminNoCluster { caller.call(admin); // invoke the HBaseAdmin method fail(); } catch (RetriesExhaustedException e) { - Log.info("Expected fail", e); + LOG.info("Expected fail", e); } // Assert we were called 'count' times. caller.verify(masterAdmin, count); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java index c9107e34881..1995aa4d693 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestDataBlockEncoders.java @@ -30,6 +30,8 @@ import java.util.Collection; import java.util.List; import java.util.Random; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.CategoryBasedTimeout; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; @@ -51,7 +53,6 @@ import org.junit.rules.TestRule; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; -import org.mortbay.log.Log; /** * Test all of the data block encoding algorithms for correctness. Most of the @@ -60,6 +61,9 @@ import org.mortbay.log.Log; @Category(LargeTests.class) @RunWith(Parameterized.class) public class TestDataBlockEncoders { + + private static final Log LOG = LogFactory.getLog(TestDataBlockEncoders.class); + @Rule public final TestRule timeout = CategoryBasedTimeout.builder(). withTimeout(this.getClass()).withLookingForStuckThread(true).build(); @@ -178,7 +182,7 @@ public class TestDataBlockEncoders { List encodedSeekers = new ArrayList(); for (DataBlockEncoding encoding : DataBlockEncoding.values()) { - Log.info("Encoding: " + encoding); + LOG.info("Encoding: " + encoding); // Off heap block data support not added for PREFIX_TREE DBE yet. // TODO remove this once support is added. HBASE-12298 if (encoding == DataBlockEncoding.PREFIX_TREE) continue; @@ -186,7 +190,7 @@ public class TestDataBlockEncoders { if (encoder == null) { continue; } - Log.info("Encoder: " + encoder); + LOG.info("Encoder: " + encoder); ByteBuffer encodedBuffer = encodeKeyValues(encoding, sampleKv, getEncodingContext(Compression.Algorithm.NONE, encoding)); HFileContext meta = new HFileContextBuilder() @@ -200,7 +204,7 @@ public class TestDataBlockEncoders { seeker.setCurrentBuffer(encodedBuffer); encodedSeekers.add(seeker); } - Log.info("Testing it!"); + LOG.info("Testing it!"); // test it! // try a few random seeks for (boolean seekBefore : new boolean[] { false, true }) { @@ -218,7 +222,7 @@ public class TestDataBlockEncoders { } // check edge cases - Log.info("Checking edge cases"); + LOG.info("Checking edge cases"); checkSeekingConsistency(encodedSeekers, false, sampleKv.get(0)); for (boolean seekBefore : new boolean[] { false, true }) { checkSeekingConsistency(encodedSeekers, seekBefore, sampleKv.get(sampleKv.size() - 1)); @@ -226,7 +230,7 @@ public class TestDataBlockEncoders { KeyValue lastMidKv =KeyValueUtil.createLastOnRowCol(midKv); checkSeekingConsistency(encodedSeekers, seekBefore, lastMidKv); } - Log.info("Done"); + LOG.info("Done"); } static ByteBuffer encodeKeyValues(DataBlockEncoding encoding, List kvs, diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java index 3676f934db5..05e4d705cd2 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionOnCluster.java @@ -23,6 +23,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HRegionInfo; @@ -41,7 +43,6 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.junit.Test; import org.junit.experimental.categories.Category; -import org.mortbay.log.Log; /** * Tests that need to spin up a cluster testing an {@link HRegion}. Use @@ -50,6 +51,8 @@ import org.mortbay.log.Log; */ @Category(MediumTests.class) public class TestHRegionOnCluster { + + private static final Log LOG = LogFactory.getLog(TestHRegionOnCluster.class); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); @Test (timeout=300000) @@ -74,7 +77,7 @@ public class TestHRegionOnCluster { assertTrue(hbaseAdmin.isTableAvailable(TABLENAME)); // Put data: r1->v1 - Log.info("Loading r1 to v1 into " + TABLENAME); + LOG.info("Loading r1 to v1 into " + TABLENAME); HTable table = new HTable(TEST_UTIL.getConfiguration(), TABLENAME); putDataAndVerify(table, "r1", FAMILY, "v1", 1); @@ -88,7 +91,7 @@ public class TestHRegionOnCluster { assertFalse(originServer.equals(targetServer)); TEST_UTIL.waitUntilAllRegionsAssigned(table.getName()); - Log.info("Moving " + regionInfo.getEncodedName() + " to " + targetServer.getServerName()); + LOG.info("Moving " + regionInfo.getEncodedName() + " to " + targetServer.getServerName()); hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(), Bytes.toBytes(targetServer.getServerName().getServerName())); do { @@ -96,12 +99,12 @@ public class TestHRegionOnCluster { } while (cluster.getServerWith(regionInfo.getRegionName()) == originServerNum); // Put data: r2->v2 - Log.info("Loading r2 to v2 into " + TABLENAME); + LOG.info("Loading r2 to v2 into " + TABLENAME); putDataAndVerify(table, "r2", FAMILY, "v2", 2); TEST_UTIL.waitUntilAllRegionsAssigned(table.getName()); // Move region to origin server - Log.info("Moving " + regionInfo.getEncodedName() + " to " + originServer.getServerName()); + LOG.info("Moving " + regionInfo.getEncodedName() + " to " + originServer.getServerName()); hbaseAdmin.move(regionInfo.getEncodedNameAsBytes(), Bytes.toBytes(originServer.getServerName().getServerName())); do { @@ -109,11 +112,11 @@ public class TestHRegionOnCluster { } while (cluster.getServerWith(regionInfo.getRegionName()) == targetServerNum); // Put data: r3->v3 - Log.info("Loading r3 to v3 into " + TABLENAME); + LOG.info("Loading r3 to v3 into " + TABLENAME); putDataAndVerify(table, "r3", FAMILY, "v3", 3); // Kill target server - Log.info("Killing target server " + targetServer.getServerName()); + LOG.info("Killing target server " + targetServer.getServerName()); targetServer.kill(); cluster.getRegionServerThreads().get(targetServerNum).join(); // Wait until finish processing of shutdown @@ -121,12 +124,12 @@ public class TestHRegionOnCluster { Thread.sleep(5); } // Kill origin server - Log.info("Killing origin server " + targetServer.getServerName()); + LOG.info("Killing origin server " + targetServer.getServerName()); originServer.kill(); cluster.getRegionServerThreads().get(originServerNum).join(); // Put data: r4->v4 - Log.info("Loading r4 to v4 into " + TABLENAME); + LOG.info("Loading r4 to v4 into " + TABLENAME); putDataAndVerify(table, "r4", FAMILY, "v4", 4); } finally { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerNoMaster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerNoMaster.java index d295170191a..a419b78aa1c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerNoMaster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerNoMaster.java @@ -21,6 +21,8 @@ package org.apache.hadoop.hbase.regionserver; import java.io.IOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; @@ -52,7 +54,6 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; -import org.mortbay.log.Log; import com.google.protobuf.ServiceException; @@ -63,6 +64,8 @@ import com.google.protobuf.ServiceException; @Category(MediumTests.class) public class TestRegionServerNoMaster { + private static final Log LOG = LogFactory.getLog(TestRegionServerNoMaster.class); + private static final int NB_SERVERS = 1; private static HTable table; private static final byte[] row = "ee".getBytes(); @@ -99,7 +102,7 @@ public class TestRegionServerNoMaster { ServerName masterAddr = master.getServerName(); master.stopMaster(); - Log.info("Waiting until master thread exits"); + LOG.info("Waiting until master thread exits"); while (masterThread != null && masterThread.isAlive()) { Threads.sleep(100); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWalDataLoss.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWalDataLoss.java index 92e0558f0a2..102e7bc4d9e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWalDataLoss.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitWalDataLoss.java @@ -26,6 +26,8 @@ import java.io.IOException; import java.util.Collection; import org.apache.commons.lang.mutable.MutableBoolean; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.DroppedSnapshotException; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; @@ -53,7 +55,6 @@ import org.junit.experimental.categories.Category; import org.mockito.Matchers; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.mortbay.log.Log; /** * Testcase for https://issues.apache.org/jira/browse/HBASE-13811 @@ -61,6 +62,8 @@ import org.mortbay.log.Log; @Category({ MediumTests.class }) public class TestSplitWalDataLoss { + private static final Log LOG = LogFactory.getLog(TestSplitWalDataLoss.class); + private final HBaseTestingUtility testUtil = new HBaseTestingUtility(); private NamespaceDescriptor namespace = NamespaceDescriptor.create(getClass().getSimpleName()) @@ -121,7 +124,7 @@ public class TestSplitWalDataLoss { table.put(new Put(Bytes.toBytes("row0")).addColumn(family, qualifier, Bytes.toBytes("val0"))); } long oldestSeqIdOfStore = region.getOldestSeqIdOfStore(family); - Log.info("CHANGE OLDEST " + oldestSeqIdOfStore); + LOG.info("CHANGE OLDEST " + oldestSeqIdOfStore); assertTrue(oldestSeqIdOfStore > HConstants.NO_SEQNUM); rs.cacheFlusher.requestFlush(spiedRegion, false); synchronized (flushed) {