You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by sy...@apache.org on 2016/02/09 00:13:57 UTC
[17/32] hbase git commit: HBASE-15218 On RS crash and replay of WAL,
loosing all Tags in Cells (Anoop Sam John)
HBASE-15218 On RS crash and replay of WAL, loosing all Tags in Cells (Anoop Sam John)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/779bdf19
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/779bdf19
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/779bdf19
Branch: refs/heads/hbase-12439
Commit: 779bdf19183ed182d34d8be5b0cc92c6ba93d70b
Parents: 9c83210
Author: stack <st...@apache.org>
Authored: Fri Feb 5 10:08:20 2016 -0800
Committer: stack <st...@apache.org>
Committed: Fri Feb 5 10:08:20 2016 -0800
----------------------------------------------------------------------
.../regionserver/wal/SecureWALCellCodec.java | 6 +++---
.../hbase/regionserver/wal/WALCellCodec.java | 4 ++--
...ibilityLabelsWithDefaultVisLabelService.java | 22 ++++++++++++++++++++
3 files changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/779bdf19/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureWALCellCodec.java
----------------------------------------------------------------------
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 69181e5..603496f 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.conf.Configuration;
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 class SecureWALCellCodec extends WALCellCodec {
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 @@ public class SecureWALCellCodec extends WALCellCodec {
}
- static class EncryptedKvEncoder extends KeyValueCodec.KeyValueEncoder {
+ static class EncryptedKvEncoder extends KeyValueCodecWithTags.KeyValueEncoder {
private Encryptor encryptor;
private final ThreadLocal<byte[]> iv = new ThreadLocal<byte[]>() {
http://git-wip-us.apache.org/repos/asf/hbase/blob/779bdf19/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 26e0e04..05929fa 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.classification.InterfaceAudience;
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 class WALCellCodec implements Codec {
@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
http://git-wip-us.apache.org/repos/asf/hbase/blob/779bdf19/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java
----------------------------------------------------------------------
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 7797493..a229bdb 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 java.util.concurrent.atomic.AtomicBoolean;
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 class TestVisibilityLabelsWithDefaultVisLabelService extends TestVisibili
};
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<RegionServerThread> 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);
+ }
+ }
}