Guest User

Untitled

a guest
Sep 25th, 2014
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. 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/Secur
  2. index 4ee3738..a516fef 100644
  3. --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureWALCellCodec.java
  4. +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SecureWALCellCodec.java
  5. @@ -46,6 +46,10 @@ public class SecureWALCellCodec extends WALCellCodec {
  6. private Encryptor encryptor;
  7. private Decryptor decryptor;
  8.  
  9. + public SecureWALCellCodec(Configuration conf, CompressionContext compression) {
  10. + super(conf, compression);
  11. + }
  12. +
  13. public SecureWALCellCodec(Configuration conf, Encryptor encryptor) {
  14. super(conf, null);
  15. this.encryptor = encryptor;
  16. @@ -68,11 +72,16 @@ public class SecureWALCellCodec extends WALCellCodec {
  17. public EncryptedKvDecoder(InputStream in, Decryptor decryptor) {
  18. super(in);
  19. this.decryptor = decryptor;
  20. - this.iv = new byte[decryptor.getIvLength()];
  21. + if (decryptor != null) {
  22. + this.iv = new byte[decryptor.getIvLength()];
  23. + }
  24. }
  25.  
  26. @Override
  27. protected Cell parseCell() throws IOException {
  28. + if (this.iv == null) {
  29. + return super.parseCell();
  30. + }
  31. int ivLength = 0;
  32. try {
  33. ivLength = StreamUtils.readRawVarint32(in);
  34. @@ -171,6 +180,10 @@ public class SecureWALCellCodec extends WALCellCodec {
  35. @Override
  36. public void write(Cell cell) throws IOException {
  37. if (!(cell instanceof KeyValue)) throw new IOException("Cannot write non-KV cells to WAL");
  38. + if (encryptor == null) {
  39. + super.write(cell);
  40. + return;
  41. + }
  42.  
  43. KeyValue kv = (KeyValue)cell;
  44. byte[] kvBuffer = kv.getBuffer();
Advertisement
Add Comment
Please, Sign In to add comment