hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1125233 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
Date Fri, 20 May 2011 04:45:40 GMT
Author: stack
Date: Fri May 20 04:45:40 2011
New Revision: 1125233

URL: http://svn.apache.org/viewvc?rev=1125233&view=rev
Log:
HBASE-3905 HBaseAdmin.createTableAsync() should check for invalid split keys.

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1125233&r1=1125232&r2=1125233&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri May 20 04:45:40 2011
@@ -109,6 +109,8 @@ Release 0.91.0 - Unreleased
    HBASE-3898  TestSplitTransactionOnCluster broke in TRUNK
    HBASE-3826  Minor compaction needs to check if still over
                compactionThreshold after compacting (Nicolas Spiegelberg)  
+   HBASE-3905  HBaseAdmin.createTableAsync() should check for invalid split
+               keys (Ted Yu)
 
   IMPROVEMENTS
    HBASE-3290  Max Compaction Size (Nicolas Spiegelberg via Stack)  

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=1125233&r1=1125232&r2=1125233&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java Fri May 20 04:45:40
2011
@@ -286,19 +286,6 @@ public class HBaseAdmin implements Abort
   public void createTable(HTableDescriptor desc, byte [][] splitKeys)
   throws IOException {
     HTableDescriptor.isLegalTableName(desc.getName());
-    if(splitKeys != null && splitKeys.length > 1) {
-      Arrays.sort(splitKeys, Bytes.BYTES_COMPARATOR);
-      // Verify there are no duplicate split keys
-      byte [] lastKey = null;
-      for(byte [] splitKey : splitKeys) {
-        if(lastKey != null && Bytes.equals(splitKey, lastKey)) {
-          throw new IllegalArgumentException("All split keys must be unique, " +
-            "found duplicate: " + Bytes.toStringBinary(splitKey) +
-            ", " + Bytes.toStringBinary(lastKey));
-        }
-        lastKey = splitKey;
-      }
-    }
     createTableAsync(desc, splitKeys);
     for (int tries = 0; tries < numRetries; tries++) {
       try {
@@ -336,6 +323,19 @@ public class HBaseAdmin implements Abort
   public void createTableAsync(HTableDescriptor desc, byte [][] splitKeys)
   throws IOException {
     HTableDescriptor.isLegalTableName(desc.getName());
+    if(splitKeys != null && splitKeys.length > 1) {
+      Arrays.sort(splitKeys, Bytes.BYTES_COMPARATOR);
+      // Verify there are no duplicate split keys
+      byte [] lastKey = null;
+      for(byte [] splitKey : splitKeys) {
+        if(lastKey != null && Bytes.equals(splitKey, lastKey)) {
+          throw new IllegalArgumentException("All split keys must be unique, " +
+            "found duplicate: " + Bytes.toStringBinary(splitKey) +
+            ", " + Bytes.toStringBinary(lastKey));
+        }
+        lastKey = splitKey;
+      }
+    }
     try {
       getMaster().createTable(desc, splitKeys);
     } catch (RemoteException e) {



Mime
View raw message