hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r810668 - in /hadoop/hbase/trunk: ./ src/java/org/apache/hadoop/hbase/ src/java/org/apache/hadoop/hbase/client/ src/java/org/apache/hadoop/hbase/regionserver/ src/test/org/apache/hadoop/hbase/regionserver/
Date Wed, 02 Sep 2009 18:57:00 GMT
Author: stack
Date: Wed Sep  2 18:56:59 2009
New Revision: 810668

URL: http://svn.apache.org/viewvc?rev=810668&view=rev
Log:
HBASE-1804 Puts are permitted (and stored) when including an appended colon

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/KeyValue.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
    hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/regionserver/TestHRegion.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=810668&r1=810667&r2=810668&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Wed Sep  2 18:56:59 2009
@@ -365,6 +365,7 @@
    HBASE-1809  NPE thrown in BoundedRangeFileInputStream
    HBASE-1810  ConcurrentModificationException in region assignment
                (Mathias Herberts via Stack)
+   HBASE-1804  Puts are permitted (and stored) when including an appended colon
 
   IMPROVEMENTS
    HBASE-1089  Add count of regions on filesystem to master UI; add percentage

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java?rev=810668&r1=810667&r2=810668&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HTableDescriptor.java Wed Sep  2 18:56:59
2009
@@ -101,7 +101,7 @@
 
   // Key is hash of the family name.
   public final Map<byte [], HColumnDescriptor> families =
-    new TreeMap<byte [], HColumnDescriptor>(KeyValue.FAMILY_COMPARATOR);
+    new TreeMap<byte [], HColumnDescriptor>(Bytes.BYTES_RAWCOMPARATOR);
    
   /**
    * Private constructor used internally creating table descriptors for 

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/KeyValue.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/KeyValue.java?rev=810668&r1=810667&r2=810668&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/KeyValue.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/KeyValue.java Wed Sep  2 18:56:59
2009
@@ -69,7 +69,8 @@
    */
   public static final char COLUMN_FAMILY_DELIMITER = ':';
 
-  public static final byte[] COLUMN_FAMILY_DELIM_ARRAY = new byte[]{COLUMN_FAMILY_DELIMITER};
+  public static final byte[] COLUMN_FAMILY_DELIM_ARRAY =
+    new byte[]{COLUMN_FAMILY_DELIMITER};
   
   /**
    * Comparator for plain key/values; i.e. non-catalog table key/values.
@@ -107,30 +108,6 @@
   public static KeyComparator ROOT_KEY_COMPARATOR = new RootKeyComparator();
 
   /**
-   * Comparator that compares the family portion of columns only.
-   * Use this making NavigableMaps of Stores or when you need to compare
-   * column family portion only of two column names.
-   */
-  public static final RawComparator<byte []> FAMILY_COMPARATOR =
-    new RawComparator<byte []> () {
-      public int compare(byte [] a, int ao, int al, byte [] b, int bo, int bl) {
-        int indexa = KeyValue.getDelimiter(a, ao, al, COLUMN_FAMILY_DELIMITER);
-        if (indexa < 0) {
-          indexa = al;
-        }
-        int indexb = KeyValue.getDelimiter(b, bo, bl, COLUMN_FAMILY_DELIMITER);
-        if (indexb < 0) {
-          indexb = bl;
-        }
-        return Bytes.compareTo(a, ao, indexa, b, bo, indexb);
-      }
-
-      public int compare(byte[] a, byte[] b) {
-        return compare(a, 0, a.length, b, 0, b.length);
-      }
-    };
-
-  /**
    * Get the appropriate row comparator for the specified table.
    * 
    * Hopefully we can get rid of this, I added this here because it's replacing

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java?rev=810668&r1=810667&r2=810668&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/client/HTable.java Wed Sep  2 18:56:59
2009
@@ -351,7 +351,9 @@
   */
   public RowResult getClosestRowBefore(final byte[] row, final byte[] family)
   throws IOException {
-    Result r = getRowOrBefore(row, family);
+    // Do parse in case we are passed a family with a ':' on it.
+    final byte [] f = KeyValue.parseColumn(family)[0];
+    Result r = getRowOrBefore(row, f);
     return r == null || r.isEmpty()? null: r.getRowResult();
   }
 

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=810668&r1=810667&r2=810668&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java Wed Sep
 2 18:56:59 2009
@@ -122,7 +122,7 @@
   private final Map<Integer, byte []> locksToRows =
     new ConcurrentHashMap<Integer, byte []>();
   protected final Map<byte [], Store> stores =
-    new ConcurrentSkipListMap<byte [], Store>(KeyValue.FAMILY_COMPARATOR);
+    new ConcurrentSkipListMap<byte [], Store>(Bytes.BYTES_RAWCOMPARATOR);
   
   //These variable are just used for getting data out of the region, to test on
   //client side

Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/regionserver/TestHRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/regionserver/TestHRegion.java?rev=810668&r1=810667&r2=810668&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/regionserver/TestHRegion.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/regionserver/TestHRegion.java Wed
Sep  2 18:56:59 2009
@@ -72,13 +72,32 @@
     super.setUp();
   }
 
-  
   //////////////////////////////////////////////////////////////////////////////
   // New tests that doesn't spin up a mini cluster but rather just test the 
   // individual code pieces in the HRegion. Putting files locally in
   // /tmp/testtable
   //////////////////////////////////////////////////////////////////////////////
 
+  public void testFamilyWithAndWithoutColon() throws Exception {
+    byte [] b = Bytes.toBytes(getName());
+    byte [] cf = Bytes.toBytes("cf");
+    initHRegion(b, getName(), cf);
+    Put p = new Put(b);
+    byte [] cfwithcolon = Bytes.toBytes("cf:");
+    p.add(cfwithcolon, cfwithcolon, cfwithcolon);
+    boolean exception = false;
+    try {
+      this.region.put(p);
+    } catch (NoSuchColumnFamilyException e) {
+      exception = true;
+    }
+    assertTrue(exception);
+    // Can I add it using old style call?
+    p = new Put(b);
+    p.add(cfwithcolon, System.currentTimeMillis(), cfwithcolon);
+    this.region.put(p);
+  }
+
   //////////////////////////////////////////////////////////////////////////////
   // checkAndPut tests
   //////////////////////////////////////////////////////////////////////////////



Mime
View raw message