Author: stack
Date: Fri May 20 04:46:33 2011
New Revision: 1125234
URL: http://svn.apache.org/viewvc?rev=1125234&view=rev
Log:
HBASE-3905 HBaseAdmin.createTableAsync() should check for invalid split keys.
Modified:
hbase/branches/0.90/CHANGES.txt
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
Modified: hbase/branches/0.90/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1125234&r1=1125233&r2=1125234&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Fri May 20 04:46:33 2011
@@ -12,6 +12,8 @@ Release 0.90.4 - Unreleased
(Vaibhav Puranik)
HBASE-3820 Splitlog() executed while the namenode was in safemode may
cause data-loss (Jieshan Bean)
+ HBASE-3905 HBaseAdmin.createTableAsync() should check for invalid split
+ keys. (Ted Yu)
IMPROVEMENT
HBASE-3882 hbase-config.sh needs to be updated so it can auto-detects the
Modified:
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL:
http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=1125234&r1=1125233&r2=1125234&view=diff
==============================================================================
---
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
(original)
+++
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
Fri May 20 04:46:33 2011
@@ -285,19 +285,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 {
@@ -335,6 +322,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) {