From f7bcf3df6bb439888e2d47d941149dcb8aeadd17 Mon Sep 17 00:00:00 2001 From: Enis Soztutar Date: Tue, 9 Sep 2014 12:05:43 -0700 Subject: [PATCH] HBASE-11921 Minor fixups that come of testing branch-1 (Stack) --- .../hadoop/hbase/client/AsyncProcess.java | 6 +++--- .../hadoop/hbase/client/RetryingCallable.java | 1 - .../client/ScannerCallableWithReplicas.java | 17 +++++++++-------- .../apache/hadoop/hbase/util/ChecksumType.java | 6 +++--- .../org/apache/hadoop/hbase/io/hfile/HFile.java | 1 + .../hbase/regionserver/HRegionServer.java | 2 +- .../hadoop/hbase/regionserver/StoreFile.java | 5 ----- .../hadoop/hbase/io/hfile/TestChecksum.java | 2 -- .../hadoop/hbase/io/hfile/TestHFileBlock.java | 4 ---- .../hbase/io/hfile/TestHFileBlockIndex.java | 1 - 10 files changed, 17 insertions(+), 28 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java index 34136e92cf1..f8cdb576e52 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java @@ -1204,7 +1204,7 @@ class AsyncProcess { .append("/").append(numTries).append(" "); if (failureCount > 0 || error != null){ - sb.append("failed ").append(failureCount).append(" ops").append(", last exception: "). + sb.append("failed=").append(failureCount).append("ops").append(", last exception: "). append(error == null ? "null" : error); } else { sb.append("succeeded"); @@ -1213,8 +1213,8 @@ class AsyncProcess { sb.append(" on ").append(sn).append(", tracking started ").append(startTime); if (willRetry) { - sb.append(", retrying after ").append(backOffTime).append(" ms"). - append(", replay ").append(replaySize).append(" ops"); + sb.append(", retrying after=").append(backOffTime).append("ms"). + append(", replay=").append(replaySize).append("ops"); } else if (failureCount > 0) { if (stopped > 0) { sb.append("; not retrying ").append(stopped).append(" due to success from other replica"); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallable.java index 5bc6c1a57b0..29c58af9316 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallable.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetryingCallable.java @@ -20,7 +20,6 @@ package org.apache.hadoop.hbase.client; import java.io.IOException; -import java.util.concurrent.Callable; import org.apache.hadoop.classification.InterfaceAudience; diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java index fc7c34770a8..6e1e8f72d5d 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ScannerCallableWithReplicas.java @@ -53,7 +53,6 @@ import org.apache.hadoop.hbase.util.Pair; * in which case, the other replicas are queried (as in (3) above). * */ - @InterfaceAudience.Private class ScannerCallableWithReplicas implements RetryingCallable { private final Log LOG = LogFactory.getLog(this.getClass()); @@ -115,8 +114,8 @@ class ScannerCallableWithReplicas implements RetryingCallable { if (currentScannerCallable != null && currentScannerCallable.closed) { // For closing we target that exact scanner (and not do replica fallback like in // the case of normal reads) - if (LOG.isDebugEnabled()) { - LOG.debug("Closing scanner " + currentScannerCallable.scannerId); + if (LOG.isTraceEnabled()) { + LOG.trace("Closing scanner id=" + currentScannerCallable.scannerId); } Result[] r = currentScannerCallable.call(timeout); currentScannerCallable = null; @@ -211,15 +210,17 @@ class ScannerCallableWithReplicas implements RetryingCallable { // store where to start the replica scanner from if we need to. if (result != null && result.length != 0) this.lastResult = result[result.length - 1]; if (LOG.isTraceEnabled()) { - LOG.trace("Setting current scanner as " + currentScannerCallable.scannerId + - " associated with " + currentScannerCallable.getHRegionInfo().getReplicaId()); + LOG.trace("Setting current scanner as id=" + currentScannerCallable.scannerId + + " associated with replica=" + currentScannerCallable.getHRegionInfo().getReplicaId()); } // close all outstanding replica scanners but the one we heard back from outstandingCallables.remove(scanner); for (ScannerCallable s : outstandingCallables) { - if (LOG.isDebugEnabled()) { - LOG.debug("Closing scanner " + s.scannerId + - " because this was slow and another replica succeeded"); + if (LOG.isTraceEnabled()) { + LOG.trace("Closing scanner id=" + s.scannerId + + ", replica=" + s.getHRegionInfo().getRegionId() + + " because slow and replica=" + + this.currentScannerCallable.getHRegionInfo().getReplicaId() + " succeeded"); } // Submit the "close" to the pool since this might take time, and we don't // want to wait for the "close" to happen yet. The "wait" will happen when diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ChecksumType.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ChecksumType.java index 7de74bdc6d7..86af5e77a8f 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ChecksumType.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ChecksumType.java @@ -65,7 +65,7 @@ public enum ChecksumType { // check if hadoop library is available try { ctor = ChecksumFactory.newConstructor(PURECRC32); - LOG.debug("Checksum using " + PURECRC32); + LOG.debug(PURECRC32 + " available"); } catch (Exception e) { LOG.trace(PURECRC32 + " not available."); } @@ -74,7 +74,7 @@ public enum ChecksumType { // This is available on all JVMs. if (ctor == null) { ctor = ChecksumFactory.newConstructor(JDKCRC); - LOG.debug("Checksum can use " + JDKCRC); + LOG.debug(JDKCRC + " available"); } } catch (Exception e) { LOG.trace(JDKCRC + " not available."); @@ -108,7 +108,7 @@ public enum ChecksumType { LOG = LogFactory.getLog(ChecksumType.class); try { ctor = ChecksumFactory.newConstructor(PURECRC32C); - LOG.debug("Checksum can use " + PURECRC32C); + LOG.debug(PURECRC32C + " available"); } catch (Exception e) { LOG.trace(PURECRC32C + " not available."); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java index c0dd672f5cf..209bd27a5c4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java @@ -180,6 +180,7 @@ public class HFile { * The number of bytes per checksum. */ public static final int DEFAULT_BYTES_PER_CHECKSUM = 16 * 1024; + // TODO: This define is done in three places. Fix. public static final ChecksumType DEFAULT_CHECKSUM_TYPE = ChecksumType.CRC32; // For measuring number of checksum failures diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 7947c4a6c55..c5cdacfa802 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -870,7 +870,7 @@ public class HRegionServer extends HasThread implements } // so callers waiting for meta without timeout can stop - metaTableLocator.stop(); + if (this.metaTableLocator != null) this.metaTableLocator.stop(); if (this.shortCircuitConnection != null && !shortCircuitConnection.isClosed()) { try { this.shortCircuitConnection.close(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java index 6a45c47e83b..26e007aad54 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFile.java @@ -56,7 +56,6 @@ import org.apache.hadoop.hbase.util.BloomFilter; import org.apache.hadoop.hbase.util.BloomFilterFactory; import org.apache.hadoop.hbase.util.BloomFilterWriter; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.hadoop.hbase.util.ChecksumType; import org.apache.hadoop.hbase.util.Writables; import org.apache.hadoop.io.WritableUtils; @@ -704,10 +703,6 @@ public class StoreFile { private KeyValue lastDeleteFamilyKV = null; private long deleteFamilyCnt = 0; - - /** Checksum type */ - protected ChecksumType checksumType; - /** Bytes per Checksum */ protected int bytesPerChecksum; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestChecksum.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestChecksum.java index 020a293a8cf..20a450c92cf 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestChecksum.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestChecksum.java @@ -93,7 +93,6 @@ public class TestChecksum { .withCompression(algo) .withIncludesMvcc(true) .withIncludesTags(useTags) - .withChecksumType(HFile.DEFAULT_CHECKSUM_TYPE) .withBytesPerCheckSum(HFile.DEFAULT_BYTES_PER_CHECKSUM) .build(); HFileBlock.Writer hbw = new HFileBlock.Writer(null, meta); @@ -202,7 +201,6 @@ public class TestChecksum { .withIncludesTags(useTags) .withHBaseCheckSum(true) .withBytesPerCheckSum(bytesPerChecksum) - .withChecksumType(HFile.DEFAULT_CHECKSUM_TYPE) .build(); HFileBlock.Writer hbw = new HFileBlock.Writer(null, meta); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlock.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlock.java index 09561cb6b57..bc09c88d249 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlock.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlock.java @@ -205,7 +205,6 @@ public class TestHFileBlock { .withIncludesMvcc(includesMemstoreTS) .withIncludesTags(includesTag) .withBytesPerCheckSum(HFile.DEFAULT_BYTES_PER_CHECKSUM) - .withChecksumType(HFile.DEFAULT_CHECKSUM_TYPE) .build(); HFileBlock.Writer hbw = new HFileBlock.Writer(null, meta); DataOutputStream dos = hbw.startWriting(blockType); @@ -289,7 +288,6 @@ public class TestHFileBlock { .withIncludesMvcc(includesMemstoreTS) .withIncludesTags(includesTag) .withBytesPerCheckSum(HFile.DEFAULT_BYTES_PER_CHECKSUM) - .withChecksumType(HFile.DEFAULT_CHECKSUM_TYPE) .build(); HFileBlock.Writer hbw = new HFileBlock.Writer(null, meta); @@ -372,7 +370,6 @@ public class TestHFileBlock { .withIncludesMvcc(includesMemstoreTS) .withIncludesTags(includesTag) .withBytesPerCheckSum(HFile.DEFAULT_BYTES_PER_CHECKSUM) - .withChecksumType(HFile.DEFAULT_CHECKSUM_TYPE) .build(); HFileBlock.Writer hbw = new HFileBlock.Writer(dataBlockEncoder, meta); long totalSize = 0; @@ -722,7 +719,6 @@ public class TestHFileBlock { .withIncludesTags(includesTag) .withCompression(compressAlgo) .withBytesPerCheckSum(HFile.DEFAULT_BYTES_PER_CHECKSUM) - .withChecksumType(HFile.DEFAULT_CHECKSUM_TYPE) .build(); HFileBlock.Writer hbw = new HFileBlock.Writer(null, meta); Map prevOffsetByType = new HashMap(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.java index f3e2f517bbd..1e0d9e666c1 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.java @@ -251,7 +251,6 @@ public class TestHFileBlockIndex { .withIncludesMvcc(includesMemstoreTS) .withIncludesTags(useTags) .withCompression(compr) - .withChecksumType(HFile.DEFAULT_CHECKSUM_TYPE) .withBytesPerCheckSum(HFile.DEFAULT_BYTES_PER_CHECKSUM) .build(); HFileBlock.Writer hbw = new HFileBlock.Writer(null,