hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject svn commit: r1513964 - in /hbase/trunk: hbase-common/src/main/java/org/apache/hadoop/hbase/ hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/ hbase-common/src/main/java/org/apache/hadoop/hbase/util/test/ hbase-common/src/test/java/org/apa...
Date Wed, 14 Aug 2013 17:00:46 GMT
Author: jmhsieh
Date: Wed Aug 14 17:00:45 2013
New Revision: 1513964

URL: http://svn.apache.org/r1513964
Log:
HBASE-9196 Remove dead code related to KeyValue

Modified:
    hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
    hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
    hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/util/test/RedundantKVGenerator.java
    hbase/trunk/hbase-common/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java
    hbase/trunk/hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/PrefixTreeCodec.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterV2.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFlusher.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java

Modified: hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java (original)
+++ hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java Wed Aug 14
17:00:45 2013
@@ -69,9 +69,6 @@ import com.google.common.primitives.Long
 public class KeyValue implements Cell, HeapSize, Cloneable {
   static final Log LOG = LogFactory.getLog(KeyValue.class);
 
-  private static final int META_LENGTH =
-      TableName.META_TABLE_NAME.getName().length; // 'hbase.meta' length
-
   // TODO: Group Key-only comparators and operations into a Key class, just
   // for neatness sake, if can figure what to call it.
 
@@ -107,18 +104,6 @@ public class KeyValue implements Cell, H
   public static final KeyComparator META_KEY_COMPARATOR = new MetaKeyComparator();
 
   /**
-   * A {@link KVComparator} for <code>-ROOT-</code> catalog table
-   * {@link KeyValue}s.
-   */
-  public static final KVComparator ROOT_COMPARATOR = new RootComparator();
-
-  /**
-   * A {@link KVComparator} for <code>-ROOT-</code> catalog table
-   * {@link KeyValue} keys.
-   */
-  public static final KeyComparator ROOT_KEY_COMPARATOR = new RootKeyComparator();
-
-  /**
    * Get the appropriate row comparator for the specified table.
    *
    * Hopefully we can get rid of this, I added this here because it's replacing
@@ -128,10 +113,7 @@ public class KeyValue implements Cell, H
    * @return The comparator.
    */
   public static KeyComparator getRowComparator(TableName tableName) {
-    if(TableName.ROOT_TABLE_NAME.equals(tableName)) {
-      return ROOT_COMPARATOR.getRawComparator();
-    }
-    if(TableName.META_TABLE_NAME.equals(tableName)) {
+     if(TableName.META_TABLE_NAME.equals(tableName)) {
       return META_COMPARATOR.getRawComparator();
     }
     return COMPARATOR.getRawComparator();
@@ -1783,23 +1765,6 @@ public class KeyValue implements Cell, H
   }
 
   /**
-   * A {@link KVComparator} for <code>-ROOT-</code> catalog table
-   * {@link KeyValue}s.
-   */
-  public static class RootComparator extends MetaComparator {
-    private final KeyComparator rawcomparator = new RootKeyComparator();
-
-    public KeyComparator getRawComparator() {
-      return this.rawcomparator;
-    }
-
-    @Override
-    protected Object clone() throws CloneNotSupportedException {
-      return new RootComparator();
-    }
-  }
-
-  /**
    * A {@link KVComparator} for <code>.META.</code> catalog table
    * {@link KeyValue}s.
    */
@@ -1840,7 +1805,7 @@ public class KeyValue implements Cell, H
           right.getKeyLength());
       if (ret != 0) return ret;
       // Negate this comparison so later edits show up first
-      return -Longs.compare(left.getMemstoreTS(), right.getMemstoreTS());
+      return -Longs.compare(left.getMvccVersion(), right.getMvccVersion());
     }
 
     public int compareTimestamps(final KeyValue left, final KeyValue right) {
@@ -2000,33 +1965,6 @@ public class KeyValue implements Cell, H
       return new KVComparator();
     }
 
-    /**
-     * @return Comparator that ignores timestamps; useful counting versions.
-     */
-    public KVComparator getComparatorIgnoringTimestamps() {
-      KVComparator c = null;
-      try {
-        c = (KVComparator)this.clone();
-        c.getRawComparator().ignoreTimestamp = true;
-      } catch (CloneNotSupportedException e) {
-        LOG.error("Not supported", e);
-      }
-      return c;
-    }
-
-    /**
-     * @return Comparator that ignores key type; useful checking deletes
-     */
-    public KVComparator getComparatorIgnoringType() {
-      KVComparator c = null;
-      try {
-        c = (KVComparator)this.clone();
-        c.getRawComparator().ignoreType = true;
-      } catch (CloneNotSupportedException e) {
-        LOG.error("Not supported", e);
-      }
-      return c;
-    }
   }
 
   /**
@@ -2394,49 +2332,6 @@ public class KeyValue implements Cell, H
   }
 
   /**
-   * Compare key portion of a {@link KeyValue} for keys in <code>-ROOT-<code>
-   * table.
-   */
-  public static class RootKeyComparator extends MetaKeyComparator {
-    public int compareRows(byte [] left, int loffset, int llength,
-        byte [] right, int roffset, int rlength) {
-      // Rows look like this: .META.,ROW_FROM_META,RID
-      //        LOG.info("ROOT " + Bytes.toString(left, loffset, llength) +
-      //          "---" + Bytes.toString(right, roffset, rlength));
-      int lmetaOffsetPlusDelimiter = loffset + META_LENGTH + 1;
-      int leftFarDelimiter = getDelimiterInReverse(left,
-          lmetaOffsetPlusDelimiter,
-          llength - META_LENGTH - 1, HConstants.DELIMITER);
-      int rmetaOffsetPlusDelimiter = roffset + META_LENGTH + 1;
-      int rightFarDelimiter = getDelimiterInReverse(right,
-          rmetaOffsetPlusDelimiter, rlength - META_LENGTH - 1,
-          HConstants.DELIMITER);
-      if (leftFarDelimiter < 0 && rightFarDelimiter >= 0) {
-        // Nothing between .META. and regionid.  Its first key.
-        return -1;
-      } else if (rightFarDelimiter < 0 && leftFarDelimiter >= 0) {
-        return 1;
-      } else if (leftFarDelimiter < 0 && rightFarDelimiter < 0) {
-        return 0;
-      }
-      int result = super.compareRows(left, lmetaOffsetPlusDelimiter,
-          leftFarDelimiter - lmetaOffsetPlusDelimiter,
-          right, rmetaOffsetPlusDelimiter,
-          rightFarDelimiter - rmetaOffsetPlusDelimiter);
-      if (result != 0) {
-        return result;
-      }
-      // Compare last part of row, the rowid.
-      leftFarDelimiter++;
-      rightFarDelimiter++;
-      result = compareRowid(left, leftFarDelimiter,
-          llength - (leftFarDelimiter - loffset),
-          right, rightFarDelimiter, rlength - (rightFarDelimiter - roffset));
-      return result;
-    }
-  }
-
-  /**
    * Comparator that compares row component only of a KeyValue.
    */
   public static class RowComparator implements Comparator<KeyValue> {
@@ -2532,8 +2427,6 @@ public class KeyValue implements Cell, H
    */
   public static class KeyComparator
       implements RawComparator<byte []>, SamePrefixComparator<byte[]> {
-    volatile boolean ignoreTimestamp = false;
-    volatile boolean ignoreType = false;
 
     public int compare(byte[] left, int loffset, int llength, byte[] right,
         int roffset, int rlength) {
@@ -2672,26 +2565,21 @@ public class KeyValue implements Cell, H
     private int compareTimestampAndType(byte[] left, int loffset, int llength,
         byte[] right, int roffset, int rlength, byte ltype, byte rtype) {
       int compare;
-      if (!this.ignoreTimestamp) {
-        // Get timestamps.
-        long ltimestamp = Bytes.toLong(left,
-            loffset + (llength - TIMESTAMP_TYPE_SIZE));
-        long rtimestamp = Bytes.toLong(right,
-            roffset + (rlength - TIMESTAMP_TYPE_SIZE));
-        compare = compareTimestamps(ltimestamp, rtimestamp);
-        if (compare != 0) {
-          return compare;
-        }
+      // Get timestamps.
+      long ltimestamp = Bytes.toLong(left,
+          loffset + (llength - TIMESTAMP_TYPE_SIZE));
+      long rtimestamp = Bytes.toLong(right,
+          roffset + (rlength - TIMESTAMP_TYPE_SIZE));
+      compare = compareTimestamps(ltimestamp, rtimestamp);
+      if (compare != 0) {
+        return compare;
       }
 
-      if (!this.ignoreType) {
-        // Compare types. Let the delete types sort ahead of puts; i.e. types
-        // of higher numbers sort before those of lesser numbers. Maximum (255)
-        // appears ahead of everything, and minimum (0) appears after
-        // everything.
-        return (0xff & rtype) - (0xff & ltype);
-      }
-      return 0;
+      // Compare types. Let the delete types sort ahead of puts; i.e. types
+      // of higher numbers sort before those of lesser numbers. Maximum (255)
+      // appears ahead of everything, and minimum (0) appears after
+      // everything.
+      return (0xff & rtype) - (0xff & ltype);
     }
 
     public int compare(byte[] left, byte[] right) {

Modified: hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
(original)
+++ hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java
Wed Aug 14 17:00:45 2013
@@ -167,7 +167,7 @@ abstract class BufferedDataBlockEncoder 
     public KeyValue getKeyValue() {
       ByteBuffer kvBuf = getKeyValueBuffer();
       KeyValue kv = new KeyValue(kvBuf.array(), kvBuf.arrayOffset());
-      kv.setMemstoreTS(current.memstoreTS);
+      kv.setMvccVersion(current.memstoreTS);
       return kv;
     }
 

Modified: hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/util/test/RedundantKVGenerator.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/util/test/RedundantKVGenerator.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/util/test/RedundantKVGenerator.java
(original)
+++ hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/util/test/RedundantKVGenerator.java
Wed Aug 14 17:00:45 2013
@@ -284,7 +284,7 @@ public class RedundantKVGenerator {
     for (KeyValue kv : keyValues) {
       totalSize += kv.getLength();
       if (includesMemstoreTS) {
-        totalSize += WritableUtils.getVIntSize(kv.getMemstoreTS());
+        totalSize += WritableUtils.getVIntSize(kv.getMvccVersion());
       }
     }
 
@@ -292,7 +292,7 @@ public class RedundantKVGenerator {
     for (KeyValue kv : keyValues) {
       result.put(kv.getBuffer(), kv.getOffset(), kv.getLength());
       if (includesMemstoreTS) {
-        ByteBufferUtils.writeVLong(result, kv.getMemstoreTS());
+        ByteBufferUtils.writeVLong(result, kv.getMvccVersion());
       }
     }
 

Modified: hbase/trunk/hbase-common/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-common/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-common/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java (original)
+++ hbase/trunk/hbase-common/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java Wed Aug
14 17:00:45 2013
@@ -128,28 +128,14 @@ public class TestKeyValue extends TestCa
   }
 
   public void testMoreComparisons() throws Exception {
-    // Root compares
     long now = System.currentTimeMillis();
-    KeyValue a = new KeyValue(
-        Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",,99999999999999"), now);
-    KeyValue b = new KeyValue(
-        Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",,1"), now);
-    KVComparator c = new KeyValue.RootComparator();
-    assertTrue(c.compare(b, a) < 0);
-    KeyValue aa = new KeyValue(
-        Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",,1"), now);
-    KeyValue bb = new KeyValue(
-        Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",,1"),
-        Bytes.toBytes("info"), Bytes.toBytes("regioninfo"), 1235943454602L,
-        (byte[])null);
-    assertTrue(c.compare(aa, bb) < 0);
 
     // Meta compares
     KeyValue aaa = new KeyValue(
         Bytes.toBytes("TestScanMultipleVersions,row_0500,1236020145502"), now);
     KeyValue bbb = new KeyValue(
         Bytes.toBytes("TestScanMultipleVersions,,99999999999999"), now);
-    c = new KeyValue.MetaComparator();
+    KVComparator c = new KeyValue.MetaComparator();
     assertTrue(c.compare(bbb, aaa) < 0);
 
     KeyValue aaaa = new KeyValue(Bytes.toBytes("TestScanMultipleVersions,,1236023996656"),
@@ -166,7 +152,6 @@ public class TestKeyValue extends TestCa
     assertTrue(c.compare(x, y) < 0);
     comparisons(new KeyValue.MetaComparator());
     comparisons(new KeyValue.KVComparator());
-    metacomparisons(new KeyValue.RootComparator());
     metacomparisons(new KeyValue.MetaComparator());
   }
 
@@ -217,13 +202,6 @@ public class TestKeyValue extends TestCa
         Bytes.toBytes("fam"), Bytes.toBytes(""), Long.MAX_VALUE, (byte[])null);
     assertTrue(KeyValue.META_COMPARATOR.compare(rowA, rowB) < 0);
 
-    rowA = new KeyValue(
-        Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",testtable,www.hbase.org/,1234,4321"),
-        Bytes.toBytes("fam"), Bytes.toBytes(""), Long.MAX_VALUE, (byte[])null);
-    rowB = new KeyValue(
-        Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",testtable,www.hbase.org/%20,99999,99999"),
-        Bytes.toBytes("fam"), Bytes.toBytes(""), Long.MAX_VALUE, (byte[])null);
-    assertTrue(KeyValue.ROOT_COMPARATOR.compare(rowA, rowB) < 0);
   }
 
   private void metacomparisons(final KeyValue.MetaComparator c) {
@@ -296,41 +274,6 @@ public class TestKeyValue extends TestCa
     for (KeyValue k: set) {
       assertTrue(count++ == k.getTimestamp());
     }
-    // Make up -ROOT- table keys.
-    KeyValue [] rootKeys = {
-        new KeyValue(Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",aaaaa,\u0000\u0000,0,2"),
fam, qf, 2, nb),
-        new KeyValue(Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",aaaaa,\u0001,0,3"),
fam, qf, 3, nb),
-        new KeyValue(Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",aaaaa,,0,1"),
fam, qf, 1, nb),
-        new KeyValue(Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",aaaaa,\u1000,0,5"),
fam, qf, 5, nb),
-        new KeyValue(Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",aaaaa,a,0,4"),
fam, qf, 4, nb),
-        new KeyValue(Bytes.toBytes(TableName.META_TABLE_NAME.getNameAsString()+",,0"), fam,
qf, 0, nb),
-      };
-    // This will output the keys incorrectly.
-    set = new TreeSet<KeyValue>(new KeyValue.MetaComparator());
-    // Add to set with bad comparator
-    for (int i = 0; i < keys.length; i++) {
-      set.add(rootKeys[i]);
-    }
-    assertion = false;
-    count = 0;
-    try {
-      for (KeyValue k: set) {
-        assertTrue(count++ == k.getTimestamp());
-      }
-    } catch (junit.framework.AssertionFailedError e) {
-      // Expected
-      assertion = true;
-    }
-    // Now with right comparator
-    set = new TreeSet<KeyValue>(new KeyValue.RootComparator());
-    // Add to set with bad comparator
-    for (int i = 0; i < keys.length; i++) {
-      set.add(rootKeys[i]);
-    }
-    count = 0;
-    for (KeyValue k: set) {
-      assertTrue(count++ == k.getTimestamp());
-    }
   }
 
   public void testStackedUpKeyValue() {
@@ -559,14 +502,10 @@ public class TestKeyValue extends TestCa
     assertTrue(newKeyValue.getTimestamp() == HConstants.LATEST_TIMESTAMP);
     assertTrue(newKeyValue.getType() == Type.Maximum.getCode());
 
-    //verify root/metaKeyComparator's getShortMidpointKey output
-    final KeyComparator rootKeyComparator = new KeyValue.RootKeyComparator();
+    //verify metaKeyComparator's getShortMidpointKey output
     final KeyComparator metaKeyComparator = new KeyValue.MetaKeyComparator();
     kv1 = new KeyValue(Bytes.toBytes("ilovehbase123"), family, qualA, 5, Type.Put);
     kv2 = new KeyValue(Bytes.toBytes("ilovehbase234"), family, qualA, 0, Type.Put);
-    newKey = rootKeyComparator.getShortMidpointKey(kv1.getKey(), kv2.getKey());
-    assertTrue(rootKeyComparator.compare(kv1.getKey(), newKey) < 0);
-    assertTrue(rootKeyComparator.compare(newKey, kv2.getKey()) == 0);
     newKey = metaKeyComparator.getShortMidpointKey(kv1.getKey(), kv2.getKey());
     assertTrue(metaKeyComparator.compare(kv1.getKey(), newKey) < 0);
     assertTrue(metaKeyComparator.compare(newKey, kv2.getKey()) == 0);

Modified: hbase/trunk/hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/PrefixTreeCodec.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/PrefixTreeCodec.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/PrefixTreeCodec.java
(original)
+++ hbase/trunk/hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/PrefixTreeCodec.java
Wed Aug 14 17:00:45 2013
@@ -27,7 +27,6 @@ import org.apache.hadoop.classification.
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.KeyValue.KeyComparator;
 import org.apache.hadoop.hbase.KeyValue.MetaKeyComparator;
-import org.apache.hadoop.hbase.KeyValue.RootKeyComparator;
 import org.apache.hadoop.hbase.KeyValueUtil;
 import org.apache.hadoop.hbase.codec.prefixtree.decode.DecoderFactory;
 import org.apache.hadoop.hbase.codec.prefixtree.decode.PrefixTreeArraySearcher;
@@ -198,10 +197,6 @@ public class PrefixTreeCodec implements 
       throw new IllegalArgumentException("DataBlockEncoding.PREFIX_TREE not compatible with
META "
           +"table");
     }
-    if(comparator instanceof RootKeyComparator){
-      throw new IllegalArgumentException("DataBlockEncoding.PREFIX_TREE not compatible with
ROOT "
-          +"table");
-    }
 
     return new PrefixTreeSeeker(includesMvccVersion);
   }

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
Wed Aug 14 17:00:45 2013
@@ -612,7 +612,7 @@ public class HFileReaderV2 extends Abstr
           KEY_VALUE_LEN_SIZE + currKeyLen + currValueLen,
           currKeyLen);
       if (this.reader.shouldIncludeMemstoreTS()) {
-        ret.setMemstoreTS(currMemstoreTS);
+        ret.setMvccVersion(currMemstoreTS);
       }
       return ret;
     }

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterV2.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterV2.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterV2.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterV2.java
Wed Aug 14 17:00:45 2013
@@ -290,9 +290,9 @@ public class HFileWriterV2 extends Abstr
    */
   @Override
   public void append(final KeyValue kv) throws IOException {
-    append(kv.getMemstoreTS(), kv.getBuffer(), kv.getKeyOffset(), kv.getKeyLength(),
+    append(kv.getMvccVersion(), kv.getBuffer(), kv.getKeyOffset(), kv.getKeyLength(),
         kv.getBuffer(), kv.getValueOffset(), kv.getValueLength());
-    this.maxMemstoreTS = Math.max(this.maxMemstoreTS, kv.getMemstoreTS());
+    this.maxMemstoreTS = Math.max(this.maxMemstoreTS, kv.getMvccVersion());
   }
 
   /**

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Wed Aug 14 17:00:45 2013
@@ -2623,7 +2623,7 @@ public class HRegion implements HeapSize
         Store store = getStore(family);
         for (Cell cell: cells) {
           KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
-          kv.setMemstoreTS(localizedWriteEntry.getWriteNumber());
+          kv.setMvccVersion(localizedWriteEntry.getWriteNumber());
           size += store.add(kv);
         }
       }
@@ -4514,7 +4514,7 @@ public class HRegion implements HeapSize
           writeEntry = mvcc.beginMemstoreInsert();
           // 6. Apply to memstore
           for (KeyValue kv : mutations) {
-            kv.setMemstoreTS(writeEntry.getWriteNumber());
+            kv.setMvccVersion(writeEntry.getWriteNumber());
             byte[] family = kv.getFamily();
             checkFamily(family);
             addedSize += stores.get(family).add(kv);
@@ -4730,7 +4730,7 @@ public class HRegion implements HeapSize
                   newKV.getBuffer(), newKV.getQualifierOffset(),
                   kv.getQualifierLength());
   
-              newKV.setMemstoreTS(w.getWriteNumber());
+              newKV.setMvccVersion(w.getWriteNumber());
               kvs.add(newKV);
   
               // Append update to WAL
@@ -4880,7 +4880,7 @@ public class HRegion implements HeapSize
               // Append new incremented KeyValue to list
               KeyValue newKV =
                 new KeyValue(row, family.getKey(), qualifier, now, Bytes.toBytes(amount));
-              newKV.setMemstoreTS(w.getWriteNumber());
+              newKV.setMvccVersion(w.getWriteNumber());
               kvs.add(newKV);
   
               // Prepare WAL updates

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
Wed Aug 14 17:00:45 2013
@@ -82,12 +82,6 @@ public class MemStore implements HeapSiz
 
   final KeyValue.KVComparator comparator;
 
-  // Used comparing versions -- same r/c and ts but different type.
-  final KeyValue.KVComparator comparatorIgnoreType;
-
-  // Used comparing versions -- same r/c and type but different timestamp.
-  final KeyValue.KVComparator comparatorIgnoreTimestamp;
-
   // Used to track own heapSize
   final AtomicLong size;
 
@@ -101,8 +95,6 @@ public class MemStore implements HeapSiz
   volatile MemStoreLAB allocator;
   volatile MemStoreLAB snapshotAllocator;
 
-
-
   /**
    * Default constructor. Used for tests.
    */
@@ -118,9 +110,6 @@ public class MemStore implements HeapSiz
                   final KeyValue.KVComparator c) {
     this.conf = conf;
     this.comparator = c;
-    this.comparatorIgnoreTimestamp =
-      this.comparator.getComparatorIgnoringTimestamps();
-    this.comparatorIgnoreType = this.comparator.getComparatorIgnoringType();
     this.kvset = new KeyValueSkipListSet(c);
     this.snapshot = new KeyValueSkipListSet(c);
     timeRangeTracker = new TimeRangeTracker();
@@ -288,7 +277,7 @@ public class MemStore implements HeapSiz
     assert alloc != null && alloc.getData() != null;
     System.arraycopy(kv.getBuffer(), kv.getOffset(), alloc.getData(), alloc.getOffset(),
len);
     KeyValue newKv = new KeyValue(alloc.getData(), alloc.getOffset(), len);
-    newKv.setMemstoreTS(kv.getMemstoreTS());
+    newKv.setMvccVersion(kv.getMvccVersion());
     return newKv;
   }
 
@@ -309,12 +298,12 @@ public class MemStore implements HeapSiz
       // yet started because Store.flush() waits for all rwcc transactions to
       // commit before starting the flush to disk.
       KeyValue found = this.snapshot.get(kv);
-      if (found != null && found.getMemstoreTS() == kv.getMemstoreTS()) {
+      if (found != null && found.getMvccVersion() == kv.getMvccVersion()) {
         this.snapshot.remove(kv);
       }
       // If the key is in the memstore, delete it. Update this.size.
       found = this.kvset.get(kv);
-      if (found != null && found.getMemstoreTS() == kv.getMemstoreTS()) {
+      if (found != null && found.getMvccVersion() == kv.getMvccVersion()) {
         removeFromKVSet(kv);
         long s = heapSizeChange(kv, true);
         this.size.addAndGet(-s);
@@ -623,7 +612,7 @@ public class MemStore implements HeapSiz
       // check that this is the row and column we are interested in, otherwise bail
       if (kv.matchingRow(cur) && kv.matchingQualifier(cur)) {
         // only remove Puts that concurrent scanners cannot possibly see
-        if (cur.getType() == KeyValue.Type.Put.getCode() && cur.getMemstoreTS() <=
readpoint) {
+        if (cur.getType() == KeyValue.Type.Put.getCode() && cur.getMvccVersion()
<= readpoint) {
           if (versionsVisible > 1) {
             // if we get here we have seen at least one version visible to the oldest scanner,
             // which means we can prove that no scanner will see this version
@@ -785,7 +774,7 @@ public class MemStore implements HeapSiz
       try {
         while (it.hasNext()) {
           v = it.next();
-          if (v.getMemstoreTS() <= readPoint) {
+          if (v.getMvccVersion() <= readPoint) {
             return v;
           }
         }
@@ -969,7 +958,7 @@ public class MemStore implements HeapSiz
   }
 
   public final static long FIXED_OVERHEAD = ClassSize.align(
-      ClassSize.OBJECT + (13 * ClassSize.REFERENCE) + Bytes.SIZEOF_LONG);
+      ClassSize.OBJECT + (11 * ClassSize.REFERENCE) + Bytes.SIZEOF_LONG);
 
   public final static long DEEP_OVERHEAD = ClassSize.align(FIXED_OVERHEAD +
       ClassSize.REENTRANT_LOCK + ClassSize.ATOMIC_LONG +

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
Wed Aug 14 17:00:45 2013
@@ -316,14 +316,14 @@ public class ScanQueryMatcher {
             tr.withinTimeRange(timestamp) :
             tr.withinOrAfterTimeRange(timestamp);
         if (includeDeleteMarker
-            && kv.getMemstoreTS() <= maxReadPointToTrackVersions) {
+            && kv.getMvccVersion() <= maxReadPointToTrackVersions) {
           this.deletes.add(bytes, offset, qualLength, timestamp, type);
         }
         // Can't early out now, because DelFam come before any other keys
       }
       if (retainDeletesInOutput
           || (!isUserScan && (EnvironmentEdgeManager.currentTimeMillis() - timestamp)
<= timeToPurgeDeletes)
-          || kv.getMemstoreTS() > maxReadPointToTrackVersions) {
+          || kv.getMvccVersion() > maxReadPointToTrackVersions) {
         // always include or it is not time yet to check whether it is OK
         // to purge deltes or not
         if (!isUserScan) {
@@ -390,7 +390,7 @@ public class ScanQueryMatcher {
     }
 
     MatchCode colChecker = columns.checkColumn(bytes, offset, qualLength,
-        timestamp, type, kv.getMemstoreTS() > maxReadPointToTrackVersions);
+        timestamp, type, kv.getMvccVersion() > maxReadPointToTrackVersions);
     /*
      * According to current implementation, colChecker can only be
      * SEEK_NEXT_COL, SEEK_NEXT_ROW, SKIP or INCLUDE. Therefore, always return

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
Wed Aug 14 17:00:45 2013
@@ -183,7 +183,7 @@ public class StoreFileScanner implements
     // readPoint
     while(enforceMVCC
         && cur != null
-        && (cur.getMemstoreTS() > readPoint)) {
+        && (cur.getMvccVersion() > readPoint)) {
       hfs.next();
       cur = hfs.getKeyValue();
     }
@@ -199,8 +199,8 @@ public class StoreFileScanner implements
     // older KV which was not reset to 0 (because it was
     // not old enough during flush). Make sure that we set it correctly now,
     // so that the comparision order does not change.
-    if (cur.getMemstoreTS() <= readPoint) {
-      cur.setMemstoreTS(0);
+    if (cur.getMvccVersion() <= readPoint) {
+      cur.setMvccVersion(0);
     }
     return true;
   }

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFlusher.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFlusher.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFlusher.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFlusher.java
Wed Aug 14 17:00:45 2013
@@ -126,11 +126,11 @@ s   */
           // 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.
-          if (kv.getMemstoreTS() <= smallestReadPoint) {
+          if (kv.getMvccVersion() <= smallestReadPoint) {
             // let us not change the original KV. It could be in the memstore
             // changing its memstoreTS could affect other threads/scanners.
             kv = kv.shallowCopy();
-            kv.setMemstoreTS(0);
+            kv.setMvccVersion(0);
           }
           sink.append(kv);
           flushed += MemStore.heapSizeChange(kv, true);

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java
Wed Aug 14 17:00:45 2013
@@ -205,8 +205,8 @@ public abstract class Compactor {
       hasMore = scanner.next(kvs, compactionKVMax);
       // output to writer:
       for (KeyValue kv : kvs) {
-        if (kv.getMemstoreTS() <= smallestReadPoint) {
-          kv.setMemstoreTS(0);
+        if (kv.getMvccVersion() <= smallestReadPoint) {
+          kv.setMvccVersion(0);
         }
         writer.append(kv);
         ++progress.currentCompactedKVs;

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java
Wed Aug 14 17:00:45 2013
@@ -3213,9 +3213,9 @@ public class TestHRegion extends HBaseTe
               if (Bytes.compareTo(previousKV.getValue(), thisValue) != 0) {
                 LOG.warn("These two KV should have the same value." +
                     " Previous KV:" +
-                    previousKV + "(memStoreTS:" + previousKV.getMemstoreTS() + ")" +
+                    previousKV + "(memStoreTS:" + previousKV.getMvccVersion() + ")" +
                     ", New KV: " +
-                    kv + "(memStoreTS:" + kv.getMemstoreTS() + ")"
+                    kv + "(memStoreTS:" + kv.getMvccVersion() + ")"
                     );
                 assertEquals(0, Bytes.compareTo(previousKV.getValue(), thisValue));
               }

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java?rev=1513964&r1=1513963&r2=1513964&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStore.java
Wed Aug 14 17:00:45 2013
@@ -238,7 +238,7 @@ public class TestMemStore extends TestCa
         mvcc.beginMemstoreInsert();
 
     KeyValue kv1 = new KeyValue(row, f, q1, v);
-    kv1.setMemstoreTS(w.getWriteNumber());
+    kv1.setMvccVersion(w.getWriteNumber());
     memstore.add(kv1);
 
     MultiVersionConsistencyControl.resetThreadReadPoint(mvcc);
@@ -253,7 +253,7 @@ public class TestMemStore extends TestCa
 
     w = mvcc.beginMemstoreInsert();
     KeyValue kv2 = new KeyValue(row, f, q2, v);
-    kv2.setMemstoreTS(w.getWriteNumber());
+    kv2.setMvccVersion(w.getWriteNumber());
     memstore.add(kv2);
 
     MultiVersionConsistencyControl.resetThreadReadPoint(mvcc);
@@ -286,11 +286,11 @@ public class TestMemStore extends TestCa
         mvcc.beginMemstoreInsert();
 
     KeyValue kv11 = new KeyValue(row, f, q1, v1);
-    kv11.setMemstoreTS(w.getWriteNumber());
+    kv11.setMvccVersion(w.getWriteNumber());
     memstore.add(kv11);
 
     KeyValue kv12 = new KeyValue(row, f, q2, v1);
-    kv12.setMemstoreTS(w.getWriteNumber());
+    kv12.setMvccVersion(w.getWriteNumber());
     memstore.add(kv12);
     mvcc.completeMemstoreInsert(w);
 
@@ -302,11 +302,11 @@ public class TestMemStore extends TestCa
     // START INSERT 2: Write both columns val2
     w = mvcc.beginMemstoreInsert();
     KeyValue kv21 = new KeyValue(row, f, q1, v2);
-    kv21.setMemstoreTS(w.getWriteNumber());
+    kv21.setMvccVersion(w.getWriteNumber());
     memstore.add(kv21);
 
     KeyValue kv22 = new KeyValue(row, f, q2, v2);
-    kv22.setMemstoreTS(w.getWriteNumber());
+    kv22.setMvccVersion(w.getWriteNumber());
     memstore.add(kv22);
 
     // BEFORE COMPLETING INSERT 2, SEE FIRST KVS
@@ -341,11 +341,11 @@ public class TestMemStore extends TestCa
         mvcc.beginMemstoreInsert();
 
     KeyValue kv11 = new KeyValue(row, f, q1, v1);
-    kv11.setMemstoreTS(w.getWriteNumber());
+    kv11.setMvccVersion(w.getWriteNumber());
     memstore.add(kv11);
 
     KeyValue kv12 = new KeyValue(row, f, q2, v1);
-    kv12.setMemstoreTS(w.getWriteNumber());
+    kv12.setMvccVersion(w.getWriteNumber());
     memstore.add(kv12);
     mvcc.completeMemstoreInsert(w);
 
@@ -358,7 +358,7 @@ public class TestMemStore extends TestCa
     w = mvcc.beginMemstoreInsert();
     KeyValue kvDel = new KeyValue(row, f, q2, kv11.getTimestamp(),
         KeyValue.Type.DeleteColumn);
-    kvDel.setMemstoreTS(w.getWriteNumber());
+    kvDel.setMvccVersion(w.getWriteNumber());
     memstore.add(kvDel);
 
     // BEFORE COMPLETING DELETE, SEE FIRST KVS
@@ -418,7 +418,7 @@ public class TestMemStore extends TestCa
         byte[] v = Bytes.toBytes(i);
 
         KeyValue kv = new KeyValue(row, f, q1, i, v);
-        kv.setMemstoreTS(w.getWriteNumber());
+        kv.setMvccVersion(w.getWriteNumber());
         memstore.add(kv);
         mvcc.completeMemstoreInsert(w);
 
@@ -492,38 +492,6 @@ public class TestMemStore extends TestCa
         m.kvset.size(), m.kvset.size() == 3);
   }
 
-  public void testBinary() {
-    MemStore mc = new MemStore(new Configuration(), KeyValue.ROOT_COMPARATOR);
-    final int start = 43;
-    final int end = 46;
-    for (int k = start; k <= end; k++) {
-      byte [] kk = Bytes.toBytes(k);
-      byte [] row =
-        Bytes.toBytes(TableName.META_TABLE_NAME+",table," + Bytes.toString(kk) + ",1," +
k);
-      KeyValue key = new KeyValue(row, CONTENTS, BASIC,
-        System.currentTimeMillis(),
-        Bytes.toBytes(CONTENTSTR + k));
-      mc.add(key);
-      System.out.println(key);
-//      key = new KeyValue(row, Bytes.toBytes(ANCHORNUM + k),
-//        System.currentTimeMillis(),
-//        Bytes.toBytes(ANCHORSTR + k));
-//      mc.add(key);
-//      System.out.println(key);
-    }
-    int index = start;
-    for (KeyValue kv: mc.kvset) {
-      System.out.println(kv);
-      byte [] b = kv.getRow();
-      // Hardcoded offsets into String
-      String str = Bytes.toString(b, TableName.META_TABLE_NAME.getName().length+7, 4);
-      byte [] bb = Bytes.toBytes(index);
-      String bbStr = Bytes.toString(bb);
-      assertEquals(str, bbStr);
-      index++;
-    }
-  }
-
   //////////////////////////////////////////////////////////////////////////////
   // Get tests
   //////////////////////////////////////////////////////////////////////////////



Mime
View raw message