HBASE-14904 Mark Base[En|De]coder LimitedPrivate and fix binary compat issue
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b3260423 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b3260423 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b3260423 Branch: refs/heads/hbase-12439 Commit: b3260423b1f59a0af80f5938339997569c3eb21a Parents: 51503ef Author: Enis Soztutar <e...@apache.org> Authored: Thu Dec 3 18:18:20 2015 -0800 Committer: Enis Soztutar <e...@apache.org> Committed: Thu Dec 3 18:18:20 2015 -0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/codec/BaseDecoder.java | 13 +++++++++---- .../org/apache/hadoop/hbase/codec/BaseEncoder.java | 8 +++++++- .../hbase/regionserver/wal/CompressionContext.java | 5 +++-- .../hadoop/hbase/regionserver/wal/WALCellCodec.java | 2 +- .../org/apache/hadoop/hbase/wal/WALPrettyPrinter.java | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/b3260423/hbase-common/src/main/java/org/apache/hadoop/hbase/codec/BaseDecoder.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/codec/BaseDecoder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/codec/BaseDecoder.java index 09dc37f..86f8678 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/codec/BaseDecoder.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/codec/BaseDecoder.java @@ -27,16 +27,17 @@ import javax.annotation.Nonnull; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.HBaseInterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceAudience; /** * TODO javadoc */ -@InterfaceAudience.Private +@InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience.COPROC, HBaseInterfaceAudience.PHOENIX}) public abstract class BaseDecoder implements Codec.Decoder { protected static final Log LOG = LogFactory.getLog(BaseDecoder.class); - protected final PBIS in; + protected final InputStream in; private Cell current = null; protected static class PBIS extends PushbackInputStream { @@ -60,13 +61,13 @@ public abstract class BaseDecoder implements Codec.Decoder { if (firstByte == -1) { return false; } else { - in.unread(firstByte); + ((PBIS)in).unread(firstByte); } try { this.current = parseCell(); } catch (IOException ioEx) { - in.resetBuf(1); // reset the buffer in case the underlying stream is read from upper layers + ((PBIS)in).resetBuf(1); // reset the buffer in case the underlying stream is read from upper layers rethrowEofException(ioEx); } return true; @@ -88,6 +89,10 @@ public abstract class BaseDecoder implements Codec.Decoder { throw eofEx; } + protected InputStream getInputStream() { + return in; + } + /** * Extract a Cell. * @return a parsed Cell or throws an Exception. EOFException or a generic IOException maybe http://git-wip-us.apache.org/repos/asf/hbase/blob/b3260423/hbase-common/src/main/java/org/apache/hadoop/hbase/codec/BaseEncoder.java ---------------------------------------------------------------------- diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/codec/BaseEncoder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/codec/BaseEncoder.java index 7a96abe..d3b2365 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/codec/BaseEncoder.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/codec/BaseEncoder.java @@ -21,13 +21,15 @@ import java.io.IOException; import java.io.OutputStream; import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.HBaseInterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceAudience; + /** * TODO javadoc */ -@InterfaceAudience.Private +@InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience.COPROC, HBaseInterfaceAudience.PHOENIX}) public abstract class BaseEncoder implements Codec.Encoder { protected final OutputStream out; // This encoder is 'done' once flush has been called. @@ -37,6 +39,10 @@ public abstract class BaseEncoder implements Codec.Encoder { this.out = out; } + protected OutputStream getOuputStream() { + return out; + } + @Override public abstract void write(Cell cell) throws IOException; http://git-wip-us.apache.org/repos/asf/hbase/blob/b3260423/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/CompressionContext.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/CompressionContext.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/CompressionContext.java index 12af619..ebbaf0a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/CompressionContext.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/CompressionContext.java @@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.regionserver.wal; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; +import org.apache.hadoop.hbase.HBaseInterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.io.TagCompressionContext; import org.apache.hadoop.hbase.io.util.Dictionary; @@ -28,10 +29,10 @@ import org.apache.hadoop.hbase.io.util.Dictionary; /** * Context that holds the various dictionaries for compression in WAL. */ -@InterfaceAudience.Private +@InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience.COPROC, HBaseInterfaceAudience.PHOENIX}) public class CompressionContext { - static final String ENABLE_WAL_TAGS_COMPRESSION = + static final String ENABLE_WAL_TAGS_COMPRESSION = "hbase.regionserver.wal.tags.enablecompression"; // visible only for WALKey, until we move everything into o.a.h.h.wal http://git-wip-us.apache.org/repos/asf/hbase/blob/b3260423/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java index e6daff2..26e0e04 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java @@ -22,12 +22,12 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.HBaseInterfaceAudience; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValueUtil; +import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.codec.BaseDecoder; import org.apache.hadoop.hbase.codec.BaseEncoder; import org.apache.hadoop.hbase.codec.Codec; http://git-wip-us.apache.org/repos/asf/hbase/blob/b3260423/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java index 4c55cb3..5df7394 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALPrettyPrinter.java @@ -234,7 +234,7 @@ public class WALPrettyPrinter { */ public void processFile(final Configuration conf, final Path p) throws IOException { - FileSystem fs = FileSystem.get(conf); + FileSystem fs = p.getFileSystem(conf); if (!fs.exists(p)) { throw new FileNotFoundException(p.toString()); }