diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureWALCellCodec.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureWALCellCodec.java index 69181e5e94d6..603496f7d2ee 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureWALCellCodec.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureWALCellCodec.java @@ -30,7 +30,7 @@ import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValueUtil; -import org.apache.hadoop.hbase.codec.KeyValueCodec; +import org.apache.hadoop.hbase.codec.KeyValueCodecWithTags; import org.apache.hadoop.hbase.io.crypto.Decryptor; import org.apache.hadoop.hbase.io.crypto.Encryption; import org.apache.hadoop.hbase.io.crypto.Encryptor; @@ -60,7 +60,7 @@ public SecureWALCellCodec(Configuration conf, Decryptor decryptor) { this.decryptor = decryptor; } - static class EncryptedKvDecoder extends KeyValueCodec.KeyValueDecoder { + static class EncryptedKvDecoder extends KeyValueCodecWithTags.KeyValueDecoder { private Decryptor decryptor; private byte[] iv; @@ -142,7 +142,7 @@ protected Cell parseCell() throws IOException { } - static class EncryptedKvEncoder extends KeyValueCodec.KeyValueEncoder { + static class EncryptedKvEncoder extends KeyValueCodecWithTags.KeyValueEncoder { private Encryptor encryptor; private final ThreadLocal iv = new ThreadLocal() { 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 26e0e04336e7..05929fa6078e 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 @@ -31,7 +31,7 @@ import org.apache.hadoop.hbase.codec.BaseDecoder; import org.apache.hadoop.hbase.codec.BaseEncoder; import org.apache.hadoop.hbase.codec.Codec; -import org.apache.hadoop.hbase.codec.KeyValueCodec; +import org.apache.hadoop.hbase.codec.KeyValueCodecWithTags; import org.apache.hadoop.hbase.io.util.Dictionary; import org.apache.hadoop.hbase.io.util.StreamUtils; import org.apache.hadoop.hbase.util.Bytes; @@ -344,7 +344,7 @@ public void write(Cell cell) throws IOException { @Override public Decoder getDecoder(InputStream is) { return (compression == null) - ? new KeyValueCodec.KeyValueDecoder(is) : new CompressedKvDecoder(is, compression); + ? new KeyValueCodecWithTags.KeyValueDecoder(is) : new CompressedKvDecoder(is, compression); } @Override diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java index 7797493e600c..a229bdbbd2de 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java @@ -32,6 +32,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.client.Result; @@ -219,4 +220,25 @@ public ListLabelsResponse run() throws Exception { }; SUPERUSER.runAs(action); } + + @Test(timeout = 60 * 1000) + public void testVisibilityLabelsOnWALReplay() throws Exception { + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + try (Table table = createTableAndWriteDataWithLabels(tableName, + "(" + SECRET + "|" + CONFIDENTIAL + ")", PRIVATE);) { + List regionServerThreads = TEST_UTIL.getHBaseCluster() + .getRegionServerThreads(); + for (RegionServerThread rsThread : regionServerThreads) { + rsThread.getRegionServer().abort("Aborting "); + } + // Start one new RS + RegionServerThread rs = TEST_UTIL.getHBaseCluster().startRegionServer(); + waitForLabelsRegionAvailability(rs.getRegionServer()); + Scan s = new Scan(); + s.setAuthorizations(new Authorizations(SECRET)); + ResultScanner scanner = table.getScanner(s); + Result[] next = scanner.next(3); + assertTrue(next.length == 1); + } + } }