diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreFlusher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreFlusher.java index 44387f5a8a2..608f4e2d91f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreFlusher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreFlusher.java @@ -31,7 +31,6 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.KeyValue; -import org.apache.hadoop.hbase.KeyValueUtil; import org.apache.hadoop.hbase.Tag; import org.apache.hadoop.hbase.TagType; import org.apache.hadoop.hbase.monitoring.MonitoredTask; @@ -175,19 +174,18 @@ public class DefaultMobStoreFlusher extends DefaultStoreFlusher { // If we know that this KV is going to be included always, then let us // set its memstoreTS to 0. This will help us save space when writing to // disk. - KeyValue kv = KeyValueUtil.ensureKeyValue(c); - if (kv.getValueLength() <= mobCellValueSizeThreshold || MobUtils.isMobReferenceCell(kv) - || kv.getTypeByte() != KeyValue.Type.Put.getCode()) { - writer.append(kv); + if (c.getValueLength() <= mobCellValueSizeThreshold || MobUtils.isMobReferenceCell(c) + || c.getTypeByte() != KeyValue.Type.Put.getCode()) { + writer.append(c); } else { // append the original keyValue in the mob file. - mobFileWriter.append(kv); - mobSize += kv.getValueLength(); + mobFileWriter.append(c); + mobSize += c.getValueLength(); mobCount++; // append the tags to the KeyValue. // The key is same, the value is the filename of the mob file - KeyValue reference = MobUtils.createMobRefKeyValue(kv, fileName, tableNameTag); + KeyValue reference = MobUtils.createMobRefKeyValue(c, fileName, tableNameTag); writer.append(reference); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/filecompactions/PartitionedMobFileCompactor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/filecompactions/PartitionedMobFileCompactor.java index f02da482f01..e8729ced0fe 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/filecompactions/PartitionedMobFileCompactor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/filecompactions/PartitionedMobFileCompactor.java @@ -361,12 +361,10 @@ public class PartitionedMobFileCompactor extends MobFileCompactor { do { hasMore = scanner.next(cells, scannerContext); for (Cell cell : cells) { - // TODO remove this after the new code are introduced. - KeyValue kv = KeyValueUtil.ensureKeyValue(cell); // write the mob cell to the mob file. - writer.append(kv); + writer.append(cell); // write the new reference cell to the store file. - KeyValue reference = MobUtils.createMobRefKeyValue(kv, fileName, tableNameTag); + KeyValue reference = MobUtils.createMobRefKeyValue(cell, fileName, tableNameTag); refFileWriter.append(reference); mobCells++; } @@ -468,9 +466,7 @@ public class PartitionedMobFileCompactor extends MobFileCompactor { do { hasMore = scanner.next(cells, scannerContext); for (Cell cell : cells) { - // TODO remove this after the new code are introduced. - KeyValue kv = KeyValueUtil.ensureKeyValue(cell); - writer.append(kv); + writer.append(cell); } cells.clear(); } while (hasMore); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/mapreduce/MemStoreWrapper.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/mapreduce/MemStoreWrapper.java index 37d4461fce8..38b4d6f6c8a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/mapreduce/MemStoreWrapper.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/mapreduce/MemStoreWrapper.java @@ -34,9 +34,7 @@ import org.apache.hadoop.hbase.KeyValueUtil; import org.apache.hadoop.hbase.Tag; import org.apache.hadoop.hbase.TagType; import org.apache.hadoop.hbase.client.BufferedMutator; -import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Put; -import org.apache.hadoop.hbase.client.Table; import org.apache.hadoop.hbase.io.hfile.CacheConfig; import org.apache.hadoop.hbase.mob.MobConstants; import org.apache.hadoop.hbase.mob.MobUtils; @@ -140,8 +138,7 @@ public class MemStoreWrapper { KeyValueScanner scanner = snapshot.getScanner(); Cell cell = null; while (null != (cell = scanner.next())) { - KeyValue kv = KeyValueUtil.ensureKeyValue(cell); - mobFileWriter.append(kv); + mobFileWriter.append(cell); } scanner.close(); // Write out the log sequence number that corresponds to this output diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/mapreduce/SweepReducer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/mapreduce/SweepReducer.java index f1060ba30fd..787b2424012 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/mapreduce/SweepReducer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/mapreduce/SweepReducer.java @@ -73,8 +73,8 @@ import org.apache.zookeeper.KeeperException; * This reducer merges the small mob files into bigger ones, and write visited * names of mob files to a sequence file which is used by the sweep job to delete * the unused mob files. - * The key of the input is a file name, the value is a collection of KeyValue where - * the KeyValue is the actual cell (its format is valueLength + fileName) in HBase. + * The key of the input is a file name, the value is a collection of KeyValues + * (the value format of KeyValue is valueLength + fileName) in HBase. * In this reducer, we could know how many cells exist in HBase for a mob file. * If the existCellSize/mobFileSize < compactionRatio, this mob * file needs to be merged.