hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject [1/3] hbase git commit: HBASE-14047 - Cleanup deprecated APIs from Cell class (Ashish Singhi)
Date Mon, 13 Jul 2015 16:37:21 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 951ec7a0b -> a3d30892b


http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
index 23f5e48..56a9d4b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
@@ -3973,8 +3973,8 @@ public class TestHRegion {
             if (previousKV != null) {
               if (Bytes.compareTo(CellUtil.cloneValue(previousKV), thisValue) != 0) {
                 LOG.warn("These two KV should have the same value." + " Previous KV:" + previousKV
-                    + "(memStoreTS:" + previousKV.getMvccVersion() + ")" + ", New KV: " + kv
-                    + "(memStoreTS:" + kv.getMvccVersion() + ")");
+                    + "(memStoreTS:" + previousKV.getSequenceId() + ")" + ", New KV: " + kv
+                    + "(memStoreTS:" + kv.getSequenceId() + ")");
                 assertEquals(0, Bytes.compareTo(CellUtil.cloneValue(previousKV), thisValue));
               }
             }
@@ -5132,17 +5132,20 @@ public class TestHRegion {
       List<Cell> currRow = new ArrayList<Cell>();
       boolean hasNext = scanner.next(currRow);
       assertEquals(2, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowC));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowC, 0, rowC.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowB));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowB, 0, rowB.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowA));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowA, 0, rowA.length));
       assertFalse(hasNext);
       scanner.close();
     } finally {
@@ -5189,17 +5192,20 @@ public class TestHRegion {
       InternalScanner scanner = region.getScanner(scan);
       boolean hasNext = scanner.next(currRow);
       assertEquals(2, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowC));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowC, 0, rowC.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowB));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowB, 0, rowB.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowA));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowA, 0, rowA.length));
       assertFalse(hasNext);
       scanner.close();
     } finally {
@@ -5243,17 +5249,20 @@ public class TestHRegion {
       InternalScanner scanner = region.getScanner(scan);
       boolean hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowC));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowC, 0, rowC.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowB));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowB, 0, rowB.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowA));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowA, 0, rowA.length));
       assertFalse(hasNext);
       scanner.close();
     } finally {
@@ -5311,17 +5320,20 @@ public class TestHRegion {
       InternalScanner scanner = region.getScanner(scan);
       boolean hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowD));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowD, 0, rowD.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowC));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowC, 0, rowC.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowB));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowB, 0, rowB.length));
       assertFalse(hasNext);
       scanner.close();
 
@@ -5332,7 +5344,8 @@ public class TestHRegion {
       scanner = region.getScanner(scan);
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowD));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowD, 0, rowD.length));
       scanner.close();
     } finally {
       HBaseTestingUtility.closeRegionAndWAL(this.region);
@@ -5391,17 +5404,20 @@ public class TestHRegion {
       InternalScanner scanner = region.getScanner(scan);
       boolean hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowD));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowD, 0, rowD.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowC));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowC, 0, rowC.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowB));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowB, 0, rowB.length));
       assertFalse(hasNext);
       scanner.close();
 
@@ -5412,7 +5428,8 @@ public class TestHRegion {
       scanner = region.getScanner(scan);
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), rowD));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), rowD, 0, rowD.length));
       scanner.close();
     } finally {
       HBaseTestingUtility.closeRegionAndWAL(this.region);
@@ -5536,42 +5553,49 @@ public class TestHRegion {
       // "row4" takes 2 next() calls since batch=3
       hasNext = scanner.next(currRow);
       assertEquals(3, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row4));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), row4, 0, row4.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(2, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row4));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow.get(0).getRowLength(), row4, 0,
+        row4.length));
       assertTrue(hasNext);
       // 2. scan out "row3" (2 kv)
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(2, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row3));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), row3, 0, row3.length));
       assertTrue(hasNext);
       // 3. scan out "row2" (4 kvs)
       // "row2" takes 2 next() calls since batch=3
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(3, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row2));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), row2, 0, row2.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row2));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), row2, 0, row2.length));
       assertTrue(hasNext);
       // 4. scan out "row1" (2 kv)
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(2, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row1));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), row1, 0, row1.length));
       assertTrue(hasNext);
       // 5. scan out "row0" (1 kv)
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row0));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), row0, 0, row0.length));
       assertFalse(hasNext);
 
       scanner.close();
@@ -5632,22 +5656,26 @@ public class TestHRegion {
       List<Cell> currRow = new ArrayList<Cell>();
       boolean hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row4));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), row4, 0, row4.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row3));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), row3, 0, row3.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row2));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), row2, 0, row2.length));
       assertTrue(hasNext);
       currRow.clear();
       hasNext = scanner.next(currRow);
       assertEquals(1, currRow.size());
-      assertTrue(Bytes.equals(currRow.get(0).getRow(), row1));
+      assertTrue(Bytes.equals(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(), currRow
+          .get(0).getRowLength(), row1, 0, row1.length));
       assertFalse(hasNext);
     } finally {
       HBaseTestingUtility.closeRegionAndWAL(this.region);
@@ -5699,7 +5727,8 @@ public class TestHRegion {
       int verify = startRow + 2 * numRows - 1;
       do {
         more = scanner.next(currRow);
-        assertEquals(Bytes.toString(currRow.get(0).getRow()), verify + "");
+        assertEquals(Bytes.toString(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(),
+          currRow.get(0).getRowLength()), verify + "");
         verify--;
         currRow.clear();
       } while(more);
@@ -5712,7 +5741,8 @@ public class TestHRegion {
       verify = startRow + 2 * numRows - 1;
       do {
         more = scanner.next(currRow);
-        assertEquals(Bytes.toString(currRow.get(0).getRow()), verify + "");
+        assertEquals(Bytes.toString(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(),
+          currRow.get(0).getRowLength()), verify + "");
         verify--;
         currRow.clear();
       } while(more);
@@ -5725,7 +5755,8 @@ public class TestHRegion {
       verify = startRow + numRows - 1;
       do {
         more = scanner.next(currRow);
-        assertEquals(Bytes.toString(currRow.get(0).getRow()), verify + "");
+        assertEquals(Bytes.toString(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(),
+          currRow.get(0).getRowLength()), verify + "");
         verify--;
         currRow.clear();
       } while(more);
@@ -5738,7 +5769,8 @@ public class TestHRegion {
       verify = startRow + numRows - 1;
       do {
         more = scanner.next(currRow);
-        assertEquals(Bytes.toString(currRow.get(0).getRow()), verify + "");
+        assertEquals(Bytes.toString(currRow.get(0).getRowArray(), currRow.get(0).getRowOffset(),
+          currRow.get(0).getRowLength()), verify + "");
         verify--;
         currRow.clear();
       } while(more);

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
index 70ae657..c065ee7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java
@@ -279,7 +279,7 @@ public class TestHRegionReplayEvents {
     if (WALEdit.isMetaEditFamily(entry.getEdit().getCells().get(0))) {
       return 0; // handled elsewhere
     }
-    Put put = new Put(entry.getEdit().getCells().get(0).getRow());
+    Put put = new Put(CellUtil.cloneRow(entry.getEdit().getCells().get(0)));
     for (Cell cell : entry.getEdit().getCells()) put.add(cell);
     put.setDurability(Durability.SKIP_WAL);
     MutationReplay mutation = new MutationReplay(MutationType.PUT, put, 0, 0);

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMajorCompaction.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMajorCompaction.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMajorCompaction.java
index c463a23..aaf20da 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMajorCompaction.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMajorCompaction.java
@@ -76,7 +76,7 @@ public class TestMajorCompaction {
   private static final Log LOG = LogFactory.getLog(TestMajorCompaction.class.getName());
   private static final HBaseTestingUtility UTIL = HBaseTestingUtility.createLocalHTU();
   protected Configuration conf = UTIL.getConfiguration();
-  
+
   private Region r = null;
   private HTableDescriptor htd = null;
   private static final byte [] COLUMN_FAMILY = fam1;
@@ -355,7 +355,7 @@ public class TestMajorCompaction {
       HFileScanner scanner = f.getReader().getScanner(false, false);
       scanner.seekTo();
       do {
-        byte [] row = scanner.getCell().getRow();
+        byte [] row = CellUtil.cloneRow(scanner.getCell());
         if (Bytes.equals(row, STARTROW)) {
           count1++;
         } else if(Bytes.equals(row, secondRowBytes)) {
@@ -434,7 +434,7 @@ public class TestMajorCompaction {
     assertNotNull("Expected to receive a compaction request", request);
     assertEquals(
       "User-requested major compaction should always occur, even if there are too many store files",
-      true, 
+      true,
       request.isMajor());
   }
 
@@ -457,7 +457,7 @@ public class TestMajorCompaction {
       List<Cell> results = new ArrayList<Cell>();
       boolean result = s.next(results);
       assertTrue(!results.isEmpty());
-      r.delete(new Delete(results.get(0).getRow()));
+      r.delete(new Delete(CellUtil.cloneRow(results.get(0))));
       if (!result) break;
     } while (true);
     s.close();

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java
index ef7f105..33ae07b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestScannerWithBulkload.java
@@ -21,38 +21,38 @@ import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 
-import junit.framework.Assert;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.RegionLocator;
-import org.apache.hadoop.hbase.client.Table;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.TableNotFoundException;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.RegionLocator;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.io.hfile.HFile;
 import org.apache.hadoop.hbase.io.hfile.HFileContext;
 import org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import junit.framework.Assert;
+
 @Category({RegionServerTests.class, MediumTests.class})
 public class TestScannerWithBulkload {
   private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
@@ -100,11 +100,16 @@ public class TestScannerWithBulkload {
     while (result != null) {
       List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
       for (Cell _c : cells) {
-        if (Bytes.toString(_c.getRow()).equals("row1")) {
-          System.out.println(Bytes.toString(_c.getRow()));
-          System.out.println(Bytes.toString(_c.getQualifier()));
-          System.out.println(Bytes.toString(_c.getValue()));
-          Assert.assertEquals("version3", Bytes.toString(_c.getValue()));
+        if (Bytes.toString(_c.getRowArray(), _c.getRowOffset(), _c.getRowLength())
+            .equals("row1")) {
+          System.out
+              .println(Bytes.toString(_c.getRowArray(), _c.getRowOffset(), _c.getRowLength()));
+          System.out.println(Bytes.toString(_c.getQualifierArray(), _c.getQualifierOffset(),
+            _c.getQualifierLength()));
+          System.out.println(
+            Bytes.toString(_c.getValueArray(), _c.getValueOffset(), _c.getValueLength()));
+          Assert.assertEquals("version3",
+            Bytes.toString(_c.getValueArray(), _c.getValueOffset(), _c.getValueLength()));
         }
       }
       result = scanner.next();
@@ -118,11 +123,16 @@ public class TestScannerWithBulkload {
     while (result != null) {
       List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
       for (Cell _c : cells) {
-        if (Bytes.toString(_c.getRow()).equals("row1")) {
-          System.out.println(Bytes.toString(_c.getRow()));
-          System.out.println(Bytes.toString(_c.getQualifier()));
-          System.out.println(Bytes.toString(_c.getValue()));
-          Assert.assertEquals(expctedVal, Bytes.toString(_c.getValue()));
+        if (Bytes.toString(_c.getRowArray(), _c.getRowOffset(), _c.getRowLength())
+            .equals("row1")) {
+          System.out
+              .println(Bytes.toString(_c.getRowArray(), _c.getRowOffset(), _c.getRowLength()));
+          System.out.println(Bytes.toString(_c.getQualifierArray(), _c.getQualifierOffset(),
+            _c.getQualifierLength()));
+          System.out.println(
+            Bytes.toString(_c.getValueArray(), _c.getValueOffset(), _c.getValueLength()));
+          Assert.assertEquals(expctedVal,
+            Bytes.toString(_c.getValueArray(), _c.getValueOffset(), _c.getValueLength()));
         }
       }
       result = scanner.next();
@@ -191,7 +201,9 @@ public class TestScannerWithBulkload {
     Result result = scanner.next();
     List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
     Assert.assertEquals(1, cells.size());
-    Assert.assertEquals("version1", Bytes.toString(cells.get(0).getValue()));
+    Cell _c = cells.get(0);
+    Assert.assertEquals("version1",
+      Bytes.toString(_c.getValueArray(), _c.getValueOffset(), _c.getValueLength()));
     scanner.close();
     return table;
   }
@@ -270,11 +282,16 @@ public class TestScannerWithBulkload {
     while (result != null) {
       List<Cell> cells = result.getColumnCells(Bytes.toBytes("col"), Bytes.toBytes("q"));
       for (Cell _c : cells) {
-        if (Bytes.toString(_c.getRow()).equals("row1")) {
-          System.out.println(Bytes.toString(_c.getRow()));
-          System.out.println(Bytes.toString(_c.getQualifier()));
-          System.out.println(Bytes.toString(_c.getValue()));
-          Assert.assertEquals("version3", Bytes.toString(_c.getValue()));
+        if (Bytes.toString(_c.getRowArray(), _c.getRowOffset(), _c.getRowLength())
+            .equals("row1")) {
+          System.out
+              .println(Bytes.toString(_c.getRowArray(), _c.getRowOffset(), _c.getRowLength()));
+          System.out.println(Bytes.toString(_c.getQualifierArray(), _c.getQualifierOffset(),
+            _c.getQualifierLength()));
+          System.out.println(
+            Bytes.toString(_c.getValueArray(), _c.getValueOffset(), _c.getValueLength()));
+          Assert.assertEquals("version3",
+            Bytes.toString(_c.getValueArray(), _c.getValueOffset(), _c.getValueLength()));
         }
       }
       result = scanner.next();

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java
index 36d3b2d..b763a22 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreFile.java
@@ -34,14 +34,13 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HBaseTestCase;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.KeyValueUtil;
-import org.apache.hadoop.hbase.testclassification.RegionServerTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.io.HFileLink;
@@ -54,6 +53,8 @@ import org.apache.hadoop.hbase.io.hfile.HFileContextBuilder;
 import org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder;
 import org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoderImpl;
 import org.apache.hadoop.hbase.io.hfile.HFileScanner;
+import org.apache.hadoop.hbase.testclassification.RegionServerTests;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
 import org.apache.hadoop.hbase.util.BloomFilterFactory;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.ChecksumType;
@@ -171,9 +172,9 @@ public class TestStoreFile extends HBaseTestCase {
     // may be in middle of row.  Create new one with empty column and
     // timestamp.
     Cell kv = reader.midkey();
-    byte [] midRow = kv.getRow();
+    byte [] midRow = CellUtil.cloneRow(kv);
     kv = reader.getLastKey();
-    byte [] finalRow = kv.getRow();
+    byte [] finalRow = CellUtil.cloneRow(kv);
     // Make a reference
     HRegionInfo splitHri = new HRegionInfo(hri.getTable(), null, midRow);
     Path refPath = splitStoreFile(regionFs, splitHri, TEST_FAMILY, hsf, midRow, true);
@@ -186,11 +187,13 @@ public class TestStoreFile extends HBaseTestCase {
       ByteBuffer bb = ByteBuffer.wrap(((KeyValue) s.getKey()).getKey());
       kv = KeyValueUtil.createKeyValueFromKey(bb);
       if (first) {
-        assertTrue(Bytes.equals(kv.getRow(), midRow));
+        assertTrue(Bytes.equals(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength(), midRow, 0,
+          midRow.length));
         first = false;
       }
     }
-    assertTrue(Bytes.equals(kv.getRow(), finalRow));
+    assertTrue(Bytes.equals(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength(), finalRow, 0,
+      finalRow.length));
   }
 
   @Test
@@ -301,7 +304,7 @@ public class TestStoreFile extends HBaseTestCase {
     // Now confirm that I can read from the ref to link
     HFileScanner sB = hsfB.createReader().getScanner(false, false);
     sB.seekTo();
-    
+
     //count++ as seekTo() will advance the scanner
     count++;
     while (sB.next()) {
@@ -316,7 +319,7 @@ public class TestStoreFile extends HBaseTestCase {
       throws IOException {
     Cell midkey = f.createReader().midkey();
     KeyValue midKV = (KeyValue)midkey;
-    byte [] midRow = midKV.getRow();
+    byte [] midRow = CellUtil.cloneRow(midKV);
     // Create top split.
     HRegionInfo topHri = new HRegionInfo(regionFs.getRegionInfo().getTable(),
         null, midRow);
@@ -384,9 +387,9 @@ public class TestStoreFile extends HBaseTestCase {
       assertTrue(fs.exists(f.getPath()));
       topPath = splitStoreFile(regionFs, topHri, TEST_FAMILY, f, badmidkey, true);
       bottomPath = splitStoreFile(regionFs, bottomHri, TEST_FAMILY, f, badmidkey, false);
-      
+
       assertNull(bottomPath);
-      
+
       top = new StoreFile(this.fs, topPath, conf, cacheConf, BloomType.NONE).createReader();
       // Now read from the top.
       first = true;
@@ -402,7 +405,8 @@ public class TestStoreFile extends HBaseTestCase {
           first = false;
           KeyValue keyKV = KeyValueUtil.createKeyValueFromKey(key);
           LOG.info("First top when key < bottom: " + keyKV);
-          String tmp = Bytes.toString(keyKV.getRow());
+          String tmp =
+              Bytes.toString(keyKV.getRowArray(), keyKV.getRowOffset(), keyKV.getRowLength());
           for (int i = 0; i < tmp.length(); i++) {
             assertTrue(tmp.charAt(i) == 'a');
           }
@@ -410,7 +414,7 @@ public class TestStoreFile extends HBaseTestCase {
       }
       KeyValue keyKV = KeyValueUtil.createKeyValueFromKey(key);
       LOG.info("Last top when key < bottom: " + keyKV);
-      String tmp = Bytes.toString(keyKV.getRow());
+      String tmp = Bytes.toString(keyKV.getRowArray(), keyKV.getRowOffset(), keyKV.getRowLength());
       for (int i = 0; i < tmp.length(); i++) {
         assertTrue(tmp.charAt(i) == 'z');
       }
@@ -434,7 +438,7 @@ public class TestStoreFile extends HBaseTestCase {
           first = false;
           keyKV = KeyValueUtil.createKeyValueFromKey(key);
           LOG.info("First bottom when key > top: " + keyKV);
-          tmp = Bytes.toString(keyKV.getRow());
+          tmp = Bytes.toString(keyKV.getRowArray(), keyKV.getRowOffset(), keyKV.getRowLength());
           for (int i = 0; i < tmp.length(); i++) {
             assertTrue(tmp.charAt(i) == 'a');
           }
@@ -443,7 +447,8 @@ public class TestStoreFile extends HBaseTestCase {
       keyKV = KeyValueUtil.createKeyValueFromKey(key);
       LOG.info("Last bottom when key > top: " + keyKV);
       for (int i = 0; i < tmp.length(); i++) {
-        assertTrue(Bytes.toString(keyKV.getRow()).charAt(i) == 'z');
+        assertTrue(Bytes.toString(keyKV.getRowArray(), keyKV.getRowOffset(), keyKV.getRowLength())
+            .charAt(i) == 'z');
       }
     } finally {
       if (top != null) {
@@ -500,7 +505,7 @@ public class TestStoreFile extends HBaseTestCase {
         + ", expected no more than " + maxFalsePos + ")",
         falsePos <= maxFalsePos);
   }
-  
+
   private static final int BLOCKSIZE_SMALL = 8192;
 
   @Test
@@ -909,7 +914,7 @@ public class TestStoreFile extends HBaseTestCase {
       KeyValue keyv1 = KeyValueUtil.ensureKeyValue(kv1);
       KeyValue keyv2 = KeyValueUtil.ensureKeyValue(kv2);
       assertTrue(Bytes.compareTo(
-          keyv1.getBuffer(), keyv1.getKeyOffset(), keyv1.getKeyLength(), 
+          keyv1.getBuffer(), keyv1.getKeyOffset(), keyv1.getKeyLength(),
           keyv2.getBuffer(), keyv2.getKeyOffset(), keyv2.getKeyLength()) == 0);
       assertTrue(Bytes.compareTo(
           kv1.getValueArray(), kv1.getValueOffset(), kv1.getValueLength(),

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStripeCompactor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStripeCompactor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStripeCompactor.java
index 3c247a9..eef229f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStripeCompactor.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStripeCompactor.java
@@ -43,6 +43,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellComparator;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -175,7 +176,7 @@ public class TestStripeCompactor {
     List<byte[]> boundaries = new ArrayList<byte[]>();
     boundaries.add(left);
     for (int i = 1; i < output.length; ++i) {
-      boundaries.add(output[i][0].getRow());
+      boundaries.add(CellUtil.cloneRow(output[i][0]));
     }
     boundaries.add(right);
     writers.verifyBoundaries(boundaries.toArray(new byte[][] {}));

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java
index 9c99a43..32e5855 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java
@@ -34,14 +34,11 @@ import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.KeyValueUtil;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.Tag;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Append;
 import org.apache.hadoop.hbase.client.Durability;
-import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Increment;
 import org.apache.hadoop.hbase.client.Mutation;
 import org.apache.hadoop.hbase.client.Put;
@@ -56,6 +53,8 @@ import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
 import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState;
 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.After;
 import org.junit.AfterClass;
@@ -568,15 +567,16 @@ public class TestTags {
           for (Cell cell : edits) {
             KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
             if (cf == null) {
-              cf = kv.getFamily();
+              cf = CellUtil.cloneFamily(kv);
             }
             Tag tag = new Tag((byte) 1, attribute);
             List<Tag> tagList = new ArrayList<Tag>();
             tagList.add(tag);
 
-            KeyValue newKV = new KeyValue(kv.getRow(), 0, kv.getRowLength(), kv.getFamily(), 0,
-                kv.getFamilyLength(), kv.getQualifier(), 0, kv.getQualifierLength(),
-                kv.getTimestamp(), KeyValue.Type.codeToType(kv.getType()), kv.getValue(), 0,
+            KeyValue newKV = new KeyValue(CellUtil.cloneRow(kv), 0, kv.getRowLength(),
+                CellUtil.cloneFamily(kv), 0, kv.getFamilyLength(), CellUtil.cloneQualifier(kv), 0,
+                kv.getQualifierLength(), kv.getTimestamp(),
+                KeyValue.Type.codeToType(kv.getTypeByte()), CellUtil.cloneValue(kv), 0,
                 kv.getValueLength(), tagList);
             ((List<Cell>) updatedCells).add(newKV);
           }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
index 2c75f23..651f7b2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java
@@ -510,7 +510,8 @@ public class TestLogRolling  {
           while ((entry = reader.next()) != null) {
             LOG.debug("#"+entry.getKey().getLogSeqNum()+": "+entry.getEdit().getCells());
             for (Cell cell : entry.getEdit().getCells()) {
-              loggedRows.add(Bytes.toStringBinary(cell.getRow()));
+              loggedRows.add(Bytes.toStringBinary(cell.getRowArray(), cell.getRowOffset(),
+                cell.getRowLength()));
             }
           }
         } catch (EOFException e) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestProtobufLog.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestProtobufLog.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestProtobufLog.java
index c1df225..e6237f8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestProtobufLog.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestProtobufLog.java
@@ -26,12 +26,11 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
@@ -62,8 +61,6 @@ import org.junit.rules.TestName;
  */
 @Category({RegionServerTests.class, MediumTests.class})
 public class TestProtobufLog {
-  private static final Log LOG = LogFactory.getLog(TestProtobufLog.class);
-
   protected final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
 
   protected FileSystem fs;
@@ -189,9 +186,10 @@ public class TestProtobufLog {
         assertEquals(tableName, entry.getKey().getTablename());
         int idx = 0;
         for (Cell val : entry.getEdit().getCells()) {
-          assertTrue(Bytes.equals(row, val.getRow()));
+          assertTrue(Bytes.equals(row, 0, row.length, val.getRowArray(), val.getRowOffset(),
+            val.getRowLength()));
           String value = i + "" + idx;
-          assertArrayEquals(Bytes.toBytes(value), val.getValue());
+          assertArrayEquals(Bytes.toBytes(value), CellUtil.cloneValue(val));
           idx++;
         }
       }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWithTags.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWithTags.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWithTags.java
index f1e956c..7f5b59c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWithTags.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationWithTags.java
@@ -29,6 +29,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
@@ -43,8 +44,6 @@ import org.apache.hadoop.hbase.client.Connection;
 import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.Table;
@@ -208,15 +207,16 @@ public class TestReplicationWithTags {
           for (Cell cell : edits) {
             KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
             if (cf == null) {
-              cf = kv.getFamily();
+              cf = CellUtil.cloneFamily(kv);
             }
             Tag tag = new Tag(TAG_TYPE, attribute);
             List<Tag> tagList = new ArrayList<Tag>();
             tagList.add(tag);
 
-            KeyValue newKV = new KeyValue(kv.getRow(), 0, kv.getRowLength(), kv.getFamily(), 0,
-                kv.getFamilyLength(), kv.getQualifier(), 0, kv.getQualifierLength(),
-                kv.getTimestamp(), KeyValue.Type.codeToType(kv.getType()), kv.getValue(), 0,
+            KeyValue newKV = new KeyValue(CellUtil.cloneRow(kv), 0, kv.getRowLength(),
+                CellUtil.cloneFamily(kv), 0, kv.getFamilyLength(), CellUtil.cloneQualifier(kv), 0,
+                kv.getQualifierLength(), kv.getTimestamp(),
+                KeyValue.Type.codeToType(kv.getTypeByte()), CellUtil.cloneValue(kv), 0,
                 kv.getValueLength(), tagList);
             ((List<Cell>) updatedCells).add(newKV);
           }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java
index fe21070..08479be 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java
@@ -19,7 +19,7 @@ package org.apache.hadoop.hbase.replication.regionserver;
 
 import static org.apache.hadoop.hbase.regionserver.TestRegionServerNoMaster.closeRegion;
 import static org.apache.hadoop.hbase.regionserver.TestRegionServerNoMaster.openRegion;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -28,9 +28,9 @@ import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.atomic.AtomicLong;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -39,7 +39,6 @@ import org.apache.hadoop.hbase.RegionLocations;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.ClusterConnection;
 import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.RegionLocator;
 import org.apache.hadoop.hbase.client.RpcRetryingCallerFactory;
 import org.apache.hadoop.hbase.client.Table;
@@ -49,12 +48,9 @@ import org.apache.hadoop.hbase.coprocessor.ObserverContext;
 import org.apache.hadoop.hbase.coprocessor.WALCoprocessorEnvironment;
 import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
 import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.ReplicateWALEntryResponse;
-import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.regionserver.Region;
 import org.apache.hadoop.hbase.regionserver.TestRegionServerNoMaster;
-import org.apache.hadoop.hbase.wal.WAL.Entry;
-import org.apache.hadoop.hbase.wal.WALKey;
 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
 import org.apache.hadoop.hbase.replication.ReplicationEndpoint;
 import org.apache.hadoop.hbase.replication.ReplicationEndpoint.ReplicateContext;
@@ -65,6 +61,8 @@ import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.testclassification.ReplicationTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.ServerRegionReplicaUtil;
+import org.apache.hadoop.hbase.wal.WAL.Entry;
+import org.apache.hadoop.hbase.wal.WALKey;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -82,9 +80,6 @@ import com.google.common.collect.Lists;
 @Category({ReplicationTests.class, MediumTests.class})
 public class TestRegionReplicaReplicationEndpointNoMaster {
 
-  private static final Log LOG = LogFactory.getLog(
-    TestRegionReplicaReplicationEndpointNoMaster.class);
-
   private static final int NB_SERVERS = 2;
   private static TableName tableName = TableName.valueOf(
     TestRegionReplicaReplicationEndpointNoMaster.class.getSimpleName());
@@ -193,7 +188,7 @@ public class TestRegionReplicaReplicationEndpointNoMaster {
       throws IOException, RuntimeException {
     Entry entry;
     while ((entry = entries.poll()) != null) {
-      byte[] row = entry.getEdit().getCells().get(0).getRow();
+      byte[] row = CellUtil.cloneRow(entry.getEdit().getCells().get(0));
       RegionLocations locations = connection.locateRegion(tableName, row, true, true);
       RegionReplicaReplayCallable callable = new RegionReplicaReplayCallable(connection,
         RpcControllerFactory.instantiate(connection.getConfiguration()),
@@ -298,7 +293,9 @@ public class TestRegionReplicaReplicationEndpointNoMaster {
 
     Assert.assertEquals(1000, entries.size());
     for (Entry e: entries) {
-      if (Integer.parseInt(Bytes.toString(e.getEdit().getCells().get(0).getValue())) % 2 == 0) {
+      Cell _c = e.getEdit().getCells().get(0);
+      if (Integer.parseInt(
+        Bytes.toString(_c.getValueArray(), _c.getValueOffset(), _c.getValueLength())) % 2 == 0) {
         e.getKey().setOrigLogSeqNum(1); // simulate dist log replay by setting orig seq id
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestDefaultScanLabelGeneratorStack.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestDefaultScanLabelGeneratorStack.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestDefaultScanLabelGeneratorStack.java
index 3487d15..39b7f1b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestDefaultScanLabelGeneratorStack.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestDefaultScanLabelGeneratorStack.java
@@ -137,20 +137,26 @@ public class TestDefaultScanLabelGeneratorStack {
           Cell current = cellScanner.current();
           assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
               current.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current.getQualifier(), Q1));
-          assertTrue(Bytes.equals(current.getValue(), value1));
+          assertTrue(Bytes.equals(current.getQualifierArray(), current.getQualifierOffset(),
+            current.getQualifierLength(), Q1, 0, Q1.length));
+          assertTrue(Bytes.equals(current.getValueArray(), current.getValueOffset(),
+            current.getValueLength(), value1, 0, value1.length));
           cellScanner.advance();
           current = cellScanner.current();
           assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
-              current.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current.getQualifier(), Q2));
-          assertTrue(Bytes.equals(current.getValue(), value2));
+            current.getRowLength(), ROW_1, 0, ROW_1.length));
+          assertTrue(Bytes.equals(current.getQualifierArray(), current.getQualifierOffset(),
+            current.getQualifierLength(), Q2, 0, Q2.length));
+          assertTrue(Bytes.equals(current.getValueArray(), current.getValueOffset(),
+            current.getValueLength(), value2, 0, value2.length));
           cellScanner.advance();
           current = cellScanner.current();
           assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
-              current.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current.getQualifier(), Q3));
-          assertTrue(Bytes.equals(current.getValue(), value3));
+            current.getRowLength(), ROW_1, 0, ROW_1.length));
+          assertTrue(Bytes.equals(current.getQualifierArray(), current.getQualifierOffset(),
+            current.getQualifierLength(), Q3, 0, Q3.length));
+          assertTrue(Bytes.equals(current.getValueArray(), current.getValueOffset(),
+            current.getValueLength(), value3, 0, value3.length));
 
           return null;
         }
@@ -173,15 +179,19 @@ public class TestDefaultScanLabelGeneratorStack {
           // test user can see value2 (CONFIDENTIAL) and value3 (no label)
           assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
               current.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current.getQualifier(), Q2));
-          assertTrue(Bytes.equals(current.getValue(), value2));
+          assertTrue(Bytes.equals(current.getQualifierArray(), current.getQualifierOffset(),
+            current.getQualifierLength(), Q2, 0, Q2.length));
+          assertTrue(Bytes.equals(current.getValueArray(), current.getValueOffset(),
+            current.getValueLength(), value2, 0, value2.length));
           cellScanner.advance();
           current = cellScanner.current();
           // test user can see value2 (CONFIDENTIAL) and value3 (no label)
           assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
               current.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current.getQualifier(), Q3));
-          assertTrue(Bytes.equals(current.getValue(), value3));
+          assertTrue(Bytes.equals(current.getQualifierArray(), current.getQualifierOffset(),
+            current.getQualifierLength(), Q3, 0, Q3.length));
+          assertTrue(Bytes.equals(current.getValueArray(), current.getValueOffset(),
+            current.getValueLength(), value3, 0, value3.length));
 
           // Test scan with correct auth attribute for test user
           Scan s1 = new Scan();
@@ -198,15 +208,19 @@ public class TestDefaultScanLabelGeneratorStack {
           // test user can see value2 (CONFIDENTIAL) and value3 (no label)
           assertTrue(Bytes.equals(current1.getRowArray(), current1.getRowOffset(),
             current1.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current1.getQualifier(), Q2));
-          assertTrue(Bytes.equals(current1.getValue(), value2));
+          assertTrue(Bytes.equals(current1.getQualifierArray(), current1.getQualifierOffset(),
+            current1.getQualifierLength(), Q2, 0, Q2.length));
+          assertTrue(Bytes.equals(current1.getValueArray(), current1.getValueOffset(),
+            current1.getValueLength(), value2, 0, value2.length));
           cellScanner1.advance();
           current1 = cellScanner1.current();
           // test user can see value2 (CONFIDENTIAL) and value3 (no label)
           assertTrue(Bytes.equals(current1.getRowArray(), current1.getRowOffset(),
             current1.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current1.getQualifier(), Q3));
-          assertTrue(Bytes.equals(current1.getValue(), value3));
+          assertTrue(Bytes.equals(current1.getQualifierArray(), current1.getQualifierOffset(),
+            current1.getQualifierLength(), Q3, 0, Q3.length));
+          assertTrue(Bytes.equals(current1.getValueArray(), current1.getValueOffset(),
+            current1.getValueLength(), value3, 0, value3.length));
 
           // Test scan with incorrect auth attribute for test user
           Scan s2 = new Scan();
@@ -221,8 +235,10 @@ public class TestDefaultScanLabelGeneratorStack {
           // This scan will only see value3 (no label)
           assertTrue(Bytes.equals(current2.getRowArray(), current2.getRowOffset(),
             current2.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current2.getQualifier(), Q3));
-          assertTrue(Bytes.equals(current2.getValue(), value3));
+          assertTrue(Bytes.equals(current2.getQualifierArray(), current2.getQualifierOffset(),
+            current2.getQualifierLength(), Q3, 0, Q3.length));
+          assertTrue(Bytes.equals(current2.getValueArray(), current2.getValueOffset(),
+            current2.getValueLength(), value3, 0, value3.length));
 
           assertFalse(cellScanner2.advance());
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
index a945a9e..7fa240e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
@@ -50,7 +50,6 @@ import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
-import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
@@ -406,7 +405,7 @@ public class TestVisibilityLabelsReplication {
           for (Cell cell : edits) {
             KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
             if (cf == null) {
-              cf = kv.getFamily();
+              cf = CellUtil.cloneFamily(kv);
             }
             Tag tag = new Tag((byte) NON_VIS_TAG_TYPE, attribute);
             List<Tag> tagList = new ArrayList<Tag>();
@@ -414,10 +413,6 @@ public class TestVisibilityLabelsReplication {
             tagList.addAll(kv.getTags());
             byte[] fromList = Tag.fromList(tagList);
             TagRewriteCell newcell = new TagRewriteCell(kv, fromList);
-            KeyValue newKV = new KeyValue(kv.getRow(), 0, kv.getRowLength(), kv.getFamily(), 0,
-                kv.getFamilyLength(), kv.getQualifier(), 0, kv.getQualifierLength(),
-                kv.getTimestamp(), KeyValue.Type.codeToType(kv.getType()), kv.getValue(), 0,
-                kv.getValueLength(), tagList);
             ((List<Cell>) updatedCells).add(newcell);
           }
         }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLablesWithGroups.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLablesWithGroups.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLablesWithGroups.java
index 76ea96c..6c1a47b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLablesWithGroups.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLablesWithGroups.java
@@ -151,20 +151,26 @@ public class TestVisibilityLablesWithGroups {
           Cell current = cellScanner.current();
           assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
               current.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current.getQualifier(), Q1));
-          assertTrue(Bytes.equals(current.getValue(), value1));
+          assertTrue(Bytes.equals(current.getQualifierArray(), current.getQualifierOffset(),
+            current.getQualifierLength(), Q1, 0, Q1.length));
+          assertTrue(Bytes.equals(current.getValueArray(), current.getValueOffset(),
+            current.getValueLength(), value1, 0, value1.length));
           cellScanner.advance();
           current = cellScanner.current();
           assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
               current.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current.getQualifier(), Q2));
-          assertTrue(Bytes.equals(current.getValue(), value2));
+          assertTrue(Bytes.equals(current.getQualifierArray(), current.getQualifierOffset(),
+            current.getQualifierLength(), Q2, 0, Q2.length));
+          assertTrue(Bytes.equals(current.getValueArray(), current.getValueOffset(),
+            current.getValueLength(), value2, 0, value2.length));
           cellScanner.advance();
           current = cellScanner.current();
           assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
               current.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current.getQualifier(), Q3));
-          assertTrue(Bytes.equals(current.getValue(), value3));
+          assertTrue(Bytes.equals(current.getQualifierArray(), current.getQualifierOffset(),
+            current.getQualifierLength(), Q3, 0, Q3.length));
+          assertTrue(Bytes.equals(current.getValueArray(), current.getValueOffset(),
+            current.getValueLength(), value3, 0, value3.length));
         }
         return null;
       }
@@ -206,15 +212,19 @@ public class TestVisibilityLablesWithGroups {
           // test user can see value2 (CONFIDENTIAL) and value3 (no label)
           assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
               current.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current.getQualifier(), Q2));
-          assertTrue(Bytes.equals(current.getValue(), value2));
+          assertTrue(Bytes.equals(current.getQualifierArray(), current.getQualifierOffset(),
+            current.getQualifierLength(), Q2, 0, Q2.length));
+          assertTrue(Bytes.equals(current.getValueArray(), current.getValueOffset(),
+            current.getValueLength(), value2, 0, value2.length));
           cellScanner.advance();
           current = cellScanner.current();
           // test user can see value2 (CONFIDENTIAL) and value3 (no label)
           assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
               current.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current.getQualifier(), Q3));
-          assertTrue(Bytes.equals(current.getValue(), value3));
+          assertTrue(Bytes.equals(current.getQualifierArray(), current.getQualifierOffset(),
+            current.getQualifierLength(), Q3, 0, Q3.length));
+          assertTrue(Bytes.equals(current.getValueArray(), current.getValueOffset(),
+            current.getValueLength(), value3, 0, value3.length));
 
           // Test scan with correct auth attribute for test user
           Scan s1 = new Scan();
@@ -231,15 +241,19 @@ public class TestVisibilityLablesWithGroups {
           // test user can see value2 (CONFIDENTIAL) and value3 (no label)
           assertTrue(Bytes.equals(current1.getRowArray(), current1.getRowOffset(),
             current1.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current1.getQualifier(), Q2));
-          assertTrue(Bytes.equals(current1.getValue(), value2));
+          assertTrue(Bytes.equals(current1.getQualifierArray(), current1.getQualifierOffset(),
+            current1.getQualifierLength(), Q2, 0, Q2.length));
+          assertTrue(Bytes.equals(current1.getValueArray(), current1.getValueOffset(),
+            current1.getValueLength(), value2, 0, value2.length));
           cellScanner1.advance();
           current1 = cellScanner1.current();
           // test user can see value2 (CONFIDENTIAL) and value3 (no label)
           assertTrue(Bytes.equals(current1.getRowArray(), current1.getRowOffset(),
             current1.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current1.getQualifier(), Q3));
-          assertTrue(Bytes.equals(current1.getValue(), value3));
+          assertTrue(Bytes.equals(current1.getQualifierArray(), current1.getQualifierOffset(),
+            current1.getQualifierLength(), Q3, 0, Q3.length));
+          assertTrue(Bytes.equals(current1.getValueArray(), current1.getValueOffset(),
+            current1.getValueLength(), value3, 0, value3.length));
 
           // Test scan with incorrect auth attribute for test user
           Scan s2 = new Scan();
@@ -254,8 +268,10 @@ public class TestVisibilityLablesWithGroups {
           // This scan will only see value3 (no label)
           assertTrue(Bytes.equals(current2.getRowArray(), current2.getRowOffset(),
             current2.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current2.getQualifier(), Q3));
-          assertTrue(Bytes.equals(current2.getValue(), value3));
+          assertTrue(Bytes.equals(current2.getQualifierArray(), current2.getQualifierOffset(),
+            current2.getQualifierLength(), Q3, 0, Q3.length));
+          assertTrue(Bytes.equals(current2.getValueArray(), current2.getValueOffset(),
+            current2.getValueLength(), value3, 0, value3.length));
 
           assertFalse(cellScanner2.advance());
         }
@@ -315,8 +331,10 @@ public class TestVisibilityLablesWithGroups {
           // test user can only see value3 (no label)
           assertTrue(Bytes.equals(current1.getRowArray(), current1.getRowOffset(),
             current1.getRowLength(), ROW_1, 0, ROW_1.length));
-          assertTrue(Bytes.equals(current1.getQualifier(), Q3));
-          assertTrue(Bytes.equals(current1.getValue(), value3));
+          assertTrue(Bytes.equals(current1.getQualifierArray(), current1.getQualifierOffset(),
+            current1.getQualifierLength(), Q3, 0, Q3.length));
+          assertTrue(Bytes.equals(current1.getValueArray(), current1.getValueOffset(),
+            current1.getValueLength(), value3, 0, value3.length));
 
           assertFalse(cellScanner1.advance());
         }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
index 866382d..451ccee 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
@@ -29,24 +29,22 @@ import java.util.List;
 import java.util.Map;
 import java.util.NavigableSet;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.KeyValueUtil;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.Get;
-import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.IsolationLevel;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.Scan;
-import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
@@ -55,9 +53,9 @@ import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.regionserver.HStore;
 import org.apache.hadoop.hbase.regionserver.InternalScanner;
 import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.regionserver.ScanInfo;
 import org.apache.hadoop.hbase.regionserver.ScanType;
 import org.apache.hadoop.hbase.regionserver.Store;
-import org.apache.hadoop.hbase.regionserver.ScanInfo;
 import org.apache.hadoop.hbase.regionserver.StoreScanner;
 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
@@ -66,7 +64,6 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
@@ -74,7 +71,6 @@ import org.junit.runners.Parameterized.Parameters;
 @Category({MiscTests.class, MediumTests.class})
 @RunWith(Parameterized.class)
 public class TestCoprocessorScanPolicy {
-  private static final Log LOG = LogFactory.getLog(TestCoprocessorScanPolicy.class);
   protected final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
   private static final byte[] F = Bytes.toBytes("fam");
   private static final byte[] Q = Bytes.toBytes("qual");
@@ -229,12 +225,16 @@ public class TestCoprocessorScanPolicy {
       if (put.getAttribute("ttl") != null) {
         Cell cell = put.getFamilyCellMap().values().iterator().next().get(0);
         KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
-        ttls.put(TableName.valueOf(kv.getQualifier()), Bytes.toLong(kv.getValue()));
+        ttls.put(TableName.valueOf(
+          Bytes.toString(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength())),
+          Bytes.toLong(CellUtil.cloneValue(kv)));
         c.bypass();
       } else if (put.getAttribute("versions") != null) {
         Cell cell = put.getFamilyCellMap().values().iterator().next().get(0);
         KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
-        versions.put(TableName.valueOf(kv.getQualifier()), Bytes.toInt(kv.getValue()));
+        versions.put(TableName.valueOf(
+          Bytes.toString(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength())),
+          Bytes.toInt(CellUtil.cloneValue(kv)));
         c.bypass();
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestSecureWAL.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestSecureWAL.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestSecureWAL.java
index 6ae8ee1..847b206 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestSecureWAL.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestSecureWAL.java
@@ -39,19 +39,16 @@ import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.io.crypto.KeyProviderForTesting;
+import org.apache.hadoop.hbase.regionserver.wal.SecureProtobufLogReader;
+import org.apache.hadoop.hbase.regionserver.wal.SecureProtobufLogWriter;
+import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.log4j.Level;
-
-// imports for things that haven't moved from regionserver.wal yet.
-import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
-import org.apache.hadoop.hbase.regionserver.wal.SecureProtobufLogReader;
-import org.apache.hadoop.hbase.regionserver.wal.SecureProtobufLogWriter;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -123,12 +120,12 @@ public class TestSecureWAL {
       List<Cell> cells = entry.getEdit().getCells();
       assertTrue("Should be one KV per WALEdit", cells.size() == 1);
       for (Cell cell: cells) {
-        byte[] thisRow = cell.getRow();
-        assertTrue("Incorrect row", Bytes.equals(thisRow, row));
-        byte[] thisFamily = cell.getFamily();
-        assertTrue("Incorrect family", Bytes.equals(thisFamily, family));
-        byte[] thisValue = cell.getValue();
-        assertTrue("Incorrect value", Bytes.equals(thisValue, value));
+        assertTrue("Incorrect row", Bytes.equals(cell.getRowArray(), cell.getRowOffset(),
+          cell.getRowLength(), row, 0, row.length));
+        assertTrue("Incorrect family", Bytes.equals(cell.getFamilyArray(), cell.getFamilyOffset(),
+          cell.getFamilyLength(), family, 0, family.length));
+        assertTrue("Incorrect value", Bytes.equals(cell.getValueArray(), cell.getValueOffset(),
+          cell.getValueLength(), value, 0, value.length));
       }
     }
     assertEquals("Should have read back as many KVs as written", total, count);

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFactory.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFactory.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFactory.java
index c847945..e393c13 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFactory.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALFactory.java
@@ -41,6 +41,7 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
 import org.apache.hadoop.hbase.Coprocessor;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HColumnDescriptor;
@@ -51,6 +52,12 @@ import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
 import org.apache.hadoop.hbase.coprocessor.SampleRegionWALObserver;
+import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
+import org.apache.hadoop.hbase.regionserver.wal.SequenceFileLogReader;
+import org.apache.hadoop.hbase.regionserver.wal.SequenceFileLogWriter;
+import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener;
+import org.apache.hadoop.hbase.regionserver.wal.WALCoprocessorHost;
+import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.util.Bytes;
@@ -68,14 +75,6 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
 
-// imports for things that haven't moved from regionserver.wal yet.
-import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
-import org.apache.hadoop.hbase.regionserver.wal.SequenceFileLogReader;
-import org.apache.hadoop.hbase.regionserver.wal.SequenceFileLogWriter;
-import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener;
-import org.apache.hadoop.hbase.regionserver.wal.WALCoprocessorHost;
-import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
-
 /**
  * WAL tests that can be reused across providers.
  */
@@ -521,8 +520,9 @@ public class TestWALFactory {
         assertTrue(Bytes.equals(info.getEncodedNameAsBytes(), key.getEncodedRegionName()));
         assertTrue(htd.getTableName().equals(key.getTablename()));
         Cell cell = val.getCells().get(0);
-        assertTrue(Bytes.equals(row, cell.getRow()));
-        assertEquals((byte)(i + '0'), cell.getValue()[0]);
+        assertTrue(Bytes.equals(row, 0, row.length, cell.getRowArray(), cell.getRowOffset(),
+          cell.getRowLength()));
+        assertEquals((byte)(i + '0'), CellUtil.cloneValue(cell)[0]);
         System.out.println(key + " " + val);
       }
     } finally {
@@ -574,8 +574,9 @@ public class TestWALFactory {
         assertTrue(Bytes.equals(hri.getEncodedNameAsBytes(),
           entry.getKey().getEncodedRegionName()));
         assertTrue(htd.getTableName().equals(entry.getKey().getTablename()));
-        assertTrue(Bytes.equals(row, val.getRow()));
-        assertEquals((byte)(idx + '0'), val.getValue()[0]);
+        assertTrue(Bytes.equals(row, 0, row.length, val.getRowArray(), val.getRowOffset(),
+          val.getRowLength()));
+        assertEquals((byte) (idx + '0'), CellUtil.cloneValue(val)[0]);
         System.out.println(entry.getKey() + " " + val);
         idx++;
       }
@@ -687,9 +688,10 @@ public class TestWALFactory {
         assertEquals(tableName, entry.getKey().getTablename());
         int idx = 0;
         for (Cell val : entry.getEdit().getCells()) {
-          assertTrue(Bytes.equals(row, val.getRow()));
+          assertTrue(Bytes.equals(row, 0, row.length, val.getRowArray(), val.getRowOffset(),
+            val.getRowLength()));
           String value = i + "" + idx;
-          assertArrayEquals(Bytes.toBytes(value), val.getValue());
+          assertArrayEquals(Bytes.toBytes(value), CellUtil.cloneValue(val));
           idx++;
         }
       }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALSplit.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALSplit.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALSplit.java
index e263cdb..0fd44f5 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALSplit.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALSplit.java
@@ -41,13 +41,6 @@ import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.impl.Log4JLogger;
-import org.apache.hadoop.hbase.testclassification.RegionServerTests;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.log4j.Level;
-import org.apache.hadoop.hdfs.server.datanode.DataNode;
-import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
-import org.apache.hadoop.hdfs.server.namenode.LeaseManager;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FSDataOutputStream;
@@ -62,18 +55,24 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
+import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.SplitLogTask.RecoveryMode;
 import org.apache.hadoop.hbase.regionserver.HRegion;
-import org.apache.hadoop.hbase.wal.WAL.Entry;
-import org.apache.hadoop.hbase.wal.WAL.Reader;
-import org.apache.hadoop.hbase.wal.WALProvider.Writer;
-import org.apache.hadoop.hbase.wal.WALSplitter.CorruptedLogFileException;
+import org.apache.hadoop.hbase.regionserver.wal.FaultySequenceFileLogReader;
+import org.apache.hadoop.hbase.regionserver.wal.InstrumentedLogWriter;
+import org.apache.hadoop.hbase.regionserver.wal.ProtobufLogReader;
+import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
 import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.hbase.testclassification.LargeTests;
+import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.CancelableProgressable;
 import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.hadoop.hbase.util.Threads;
+import org.apache.hadoop.hbase.wal.WAL.Entry;
+import org.apache.hadoop.hbase.wal.WAL.Reader;
+import org.apache.hadoop.hbase.wal.WALProvider.Writer;
+import org.apache.hadoop.hbase.wal.WALSplitter.CorruptedLogFileException;
 import org.apache.hadoop.hdfs.DFSTestUtil;
 import org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException;
 import org.apache.hadoop.ipc.RemoteException;
@@ -82,9 +81,9 @@ import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Rule;
-import org.junit.rules.TestName;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
 import org.mockito.Mockito;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
@@ -92,12 +91,6 @@ import org.mockito.stubbing.Answer;
 import com.google.common.base.Joiner;
 import com.google.common.collect.ImmutableList;
 
-// imports for things that haven't moved from regionserver.wal yet.
-import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
-import org.apache.hadoop.hbase.regionserver.wal.InstrumentedLogWriter;
-import org.apache.hadoop.hbase.regionserver.wal.ProtobufLogReader;
-import org.apache.hadoop.hbase.regionserver.wal.FaultySequenceFileLogReader;
-
 /**
  * Testing {@link WAL} splitting code.
  */
@@ -187,7 +180,7 @@ public class TestWALSplit {
     REGIONS.clear();
     Collections.addAll(REGIONS, "bbb", "ccc");
     InstrumentedLogWriter.activateFailure = false;
-    this.mode = (conf.getBoolean(HConstants.DISTRIBUTED_LOG_REPLAY_KEY, false) ? 
+    this.mode = (conf.getBoolean(HConstants.DISTRIBUTED_LOG_REPLAY_KEY, false) ?
         RecoveryMode.LOG_REPLAY : RecoveryMode.LOG_SPLITTING);
     wals = new WALFactory(conf, null, name.getMethodName());
     WALDIR = new Path(HBASEDIR, DefaultWALProvider.getWALDirectoryName(name.getMethodName()));
@@ -957,7 +950,8 @@ public class TestWALSplit {
             Cell cell = cells.get(0);
 
             // Check that the edits come in the right order.
-            assertEquals(expectedIndex, Bytes.toInt(cell.getRow()));
+            assertEquals(expectedIndex, Bytes.toInt(cell.getRowArray(), cell.getRowOffset(), 
+              cell.getRowLength()));
             expectedIndex++;
             return null;
           }

http://git-wip-us.apache.org/repos/asf/hbase/blob/a3d30892/hbase-shell/src/main/ruby/hbase/table.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb
index 5d0d8cf..15bebcd 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -224,7 +224,8 @@ EOF
 
       # Fetch cell value
       cell = result.listCells[0]
-      org.apache.hadoop.hbase.util.Bytes::toLong(cell.getValue)
+      org.apache.hadoop.hbase.util.Bytes::toLong(cell.getValueArray, 
+        cell.getValueOffset, cell.getValueLength)
     end
 
     #----------------------------------------------------------------------------------------------
@@ -371,8 +372,10 @@ EOF
       # Print out results.  Result can be Cell or RowResult.
       res = {}
       result.listCells.each do |c|
-        family = String.from_java_bytes(c.getFamily)
-        qualifier = org.apache.hadoop.hbase.util.Bytes::toStringBinary(c.getQualifier)
+        family = org.apache.hadoop.hbase.util.Bytes::toStringBinary(c.getFamilyArray,
+          c.getFamilyOffset, c.getFamilyLength)
+        qualifier = org.apache.hadoop.hbase.util.Bytes::toStringBinary(c.getQualifierArray,
+          c.getQualifierOffset, c.getQualifierLength)
 
         column = "#{family}:#{qualifier}"
         value = to_string(column, c, maxlength)
@@ -403,7 +406,8 @@ EOF
 
       # Fetch cell value
       cell = result.listCells[0]
-      org.apache.hadoop.hbase.util.Bytes::toLong(cell.getValue)
+      org.apache.hadoop.hbase.util.Bytes::toLong(cell.getValueArray, 
+        cell.getValueOffset, cell.getValueLength)
     end
 
     def _hash_to_scan(args)
@@ -505,8 +509,10 @@ EOF
         key = org.apache.hadoop.hbase.util.Bytes::toStringBinary(row.getRow)
 
         row.listCells.each do |c|
-          family = String.from_java_bytes(c.getFamily)
-          qualifier = org.apache.hadoop.hbase.util.Bytes::toStringBinary(c.getQualifier)
+          family = org.apache.hadoop.hbase.util.Bytes::toStringBinary(c.getFamilyArray,
+            c.getFamilyOffset, c.getFamilyLength)
+          qualifier = org.apache.hadoop.hbase.util.Bytes::toStringBinary(c.getQualifierArray,
+            c.getQualifierOffset, c.getQualifierLength)
 
           column = "#{family}:#{qualifier}"
           cell = to_string(column, c, maxlength)
@@ -640,14 +646,17 @@ EOF
     def to_string(column, kv, maxlength = -1)
       if is_meta_table?
         if column == 'info:regioninfo' or column == 'info:splitA' or column == 'info:splitB'
-          hri = org.apache.hadoop.hbase.HRegionInfo.parseFromOrNull(kv.getValue)
+          hri = org.apache.hadoop.hbase.HRegionInfo.parseFromOrNull(kv.getValueArray,
+            kv.getValueOffset, kv.getValueLength)
           return "timestamp=%d, value=%s" % [kv.getTimestamp, hri.toString]
         end
         if column == 'info:serverstartcode'
           if kv.getValue.length > 0
-            str_val = org.apache.hadoop.hbase.util.Bytes.toLong(kv.getValue)
+            str_val = org.apache.hadoop.hbase.util.Bytes.toLong(kv.getValueArray, 
+              kv.getValueOffset, kv.getValueLength)
           else
-            str_val = org.apache.hadoop.hbase.util.Bytes.toStringBinary(kv.getValue)
+            str_val = org.apache.hadoop.hbase.util.Bytes.toStringBinary(kv.getValueArray,
+              kv.getValueOffset, kv.getValueLength)
           end
           return "timestamp=%d, value=%s" % [kv.getTimestamp, str_val]
         end
@@ -679,7 +688,7 @@ EOF
         end
       end
       method = eval(klazz_name).method(converter)
-      return method.call(kv.getValue) # apply the converter
+      return method.call(org.apache.hadoop.hbase.CellUtil.cloneValue(kv)) # apply the converter
     end
 
     # if the column spec contains CONVERTER information, to get rid of :CONVERTER info from column pair.


Mime
View raw message