.META.
.
- *
+ *
* This class is "read-only" in that the locations of the catalog tables cannot
* be explicitly set. Instead, ZooKeeper is used to learn of the availability
* and location of .META.
.
@@ -65,7 +65,7 @@ public class CatalogTracker {
// servers when they needed to know of meta movement but also by
// client-side (inside in HTable) so rather than figure meta
// locations on fault, the client would instead get notifications out of zk.
- //
+ //
// But this original intent is frustrated by the fact that this class has to
// read an hbase table, the -ROOT- table, to figure out the .META. region
// location which means we depend on an HConnection. HConnection will do
@@ -110,13 +110,6 @@ public class CatalogTracker {
private boolean instantiatedzkw = false;
private Abortable abortable;
- /*
- * Do not clear this address once set. Its needed when we do
- * server shutdown processing -- we need to know who had .META. last. If you
- * want to know if the address is good, rely on {@link #metaAvailable} value.
- */
- private ServerName metaLocation;
-
private boolean stopped = false;
static final byte [] META_REGION_NAME =
@@ -147,7 +140,7 @@ public class CatalogTracker {
* @param abortable If fatal exception we'll call abort on this. May be null.
* If it is we'll use the Connection associated with the passed
* {@link Configuration} as our Abortable.
- * @throws IOException
+ * @throws IOException
*/
public CatalogTracker(final ZooKeeperWatcher zk, final Configuration conf,
Abortable abortable)
@@ -193,7 +186,7 @@ public class CatalogTracker {
* Determines current availability of catalog tables and ensures all further
* transitions of either region are tracked.
* @throws IOException
- * @throws InterruptedException
+ * @throws InterruptedException
*/
public void start() throws IOException, InterruptedException {
LOG.debug("Starting catalog tracker " + this);
@@ -235,7 +228,7 @@ public class CatalogTracker {
* not currently available.
* @return {@link ServerName} for server hosting .META.
or null
* if none available
- * @throws InterruptedException
+ * @throws InterruptedException
*/
public ServerName getMetaLocation() throws InterruptedException {
return this.metaRegionTracker.getMetaRegionLocation();
@@ -309,8 +302,6 @@ public class CatalogTracker {
LOG.info(".META. still not available, sleeping and retrying." +
" Reason: " + e.getMessage());
}
- } catch (IOException e) {
- LOG.info("Retrying", e);
}
}
}
@@ -356,7 +347,7 @@ public class CatalogTracker {
} else {
throw ioe;
}
-
+
}
return protocol;
}
@@ -406,7 +397,7 @@ public class CatalogTracker {
}
}
LOG.info("Failed verification of " + Bytes.toStringBinary(regionName) +
- " at address=" + address + "; " + t);
+ " at address=" + address + ", exception=" + t);
return false;
}
@@ -416,7 +407,7 @@ public class CatalogTracker {
* the internal call to {@link #waitForMetaServerConnection(long)}.
* @return True if the .META.
location is healthy.
* @throws IOException
- * @throws InterruptedException
+ * @throws InterruptedException
*/
public boolean verifyMetaRegionLocation(final long timeout)
throws InterruptedException, IOException {
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Action.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Action.java
index ba14702d3a7..9a41fcb45c7 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Action.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Action.java
@@ -62,6 +62,11 @@ public class Action@@ -66,10 +65,22 @@ public class Append extends Mutation { * Create a Append operation for the specified row. *
* At least one column must be appended to. - * @param row row key + * @param row row key; makes a local copy of passed in array. */ public Append(byte[] row) { - this.row = Arrays.copyOf(row, row.length); + this(row, 0, row.length); + } + + /** Create a Append operation for the specified row. + *
+ * At least one column must be appended to. + * @param rowArray Makes a copy out of this buffer. + * @param rowOffset + * @param rowLength + */ + public Append(final byte [] rowArray, final int rowOffset, final int rowLength) { + checkRow(rowArray, rowOffset, rowLength); + this.row = Bytes.copy(rowArray, rowOffset, rowLength); } /** diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java index 0db0167a839..5efd45b1148 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java @@ -19,6 +19,11 @@ package org.apache.hadoop.hbase.client; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.hbase.Cell; @@ -26,11 +31,6 @@ import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.util.Bytes; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - /** * Used to perform Delete operations on a single row. *
@@ -91,8 +91,27 @@ public class Delete extends Mutation implements Comparable
+ *
+ * If no further operations are done, this will delete all columns in all
+ * families of the specified row with a timestamp less than or equal to the
+ * specified timestamp.
+ *
+ * This timestamp is ONLY used for a delete row operation. If specifying
+ * families or columns, you must specify each timestamp individually.
+ * @param rowArray We make a local copy of this passed in row.
+ * @param rowOffset
+ * @param rowLength
+ * @param ts maximum version timestamp (only for delete row)
+ */
+ public Delete(final byte [] rowArray, final int rowOffset, final int rowLength, long ts) {
+ checkRow(rowArray, rowOffset, rowLength);
+ this.row = Bytes.copy(rowArray, rowOffset, rowLength);
+ this.ts = ts;
}
/**
@@ -121,10 +140,8 @@ public class Delete extends Mutation implements Comparable
@@ -83,6 +83,7 @@ public class Get extends OperationWithAttributes
* @param row row key
*/
public Get(byte [] row) {
+ Mutation.checkRow(row);
this.row = row;
}
@@ -388,9 +389,17 @@ public class Get extends OperationWithAttributes
//Row
@Override
public int compareTo(Row other) {
+ // TODO: This is wrong. Can't have two gets the same just because on same row.
return Bytes.compareTo(this.getRow(), other.getRow());
}
+ @Override
+ public int hashCode() {
+ // TODO: This is wrong. Can't have two gets the same just because on same row. But it
+ // matches how equals works currently and gets rid of the findbugs warning.
+ return Bytes.hashCode(this.getRow());
+ }
+
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -400,6 +409,7 @@ public class Get extends OperationWithAttributes
return false;
}
Row other = (Row) obj;
+ // TODO: This is wrong. Can't have two gets the same just because on same row.
return compareTo(other) == 0;
}
-}
+}
\ No newline at end of file
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
index a9bae629f21..690c810acf2 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
@@ -1350,7 +1350,7 @@ public class HBaseAdmin implements Abortable, Closeable {
throws IOException, InterruptedException {
compact(tableNameOrRegionName, null, false);
}
-
+
/**
* Compact a column family within a table or region.
* Asynchronous operation.
@@ -1404,7 +1404,7 @@ public class HBaseAdmin implements Abortable, Closeable {
throws IOException, InterruptedException {
compact(tableNameOrRegionName, null, true);
}
-
+
/**
* Major compact a column family within a table or region.
* Asynchronous operation.
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
index c5a8608d48a..6f12f51cfb2 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java
@@ -19,7 +19,6 @@
package org.apache.hadoop.hbase.client;
import java.io.IOException;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
@@ -28,7 +27,6 @@ import java.util.TreeMap;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
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.io.TimeRange;
@@ -52,17 +50,47 @@ public class Increment extends Mutation implements Comparable
* At least one column must be incremented.
- * @param row row key
+ * @param row row key (we will make a copy of this).
*/
public Increment(byte [] row) {
- if (row == null || row.length > HConstants.MAX_ROW_LENGTH) {
- throw new IllegalArgumentException("Row key is invalid");
+ this(row, 0, row.length);
+ }
+
+ /**
+ * Create a Increment operation for the specified row.
+ *
+ * At least one column must be incremented.
+ * @param row row key (we will make a copy of this).
+ */
+ public Increment(final byte [] row, final int offset, final int length) {
+ checkRow(row, offset, length);
+ this.row = Bytes.copy(row, offset, length);
+ }
+
+ /**
+ * Add the specified KeyValue to this operation.
+ * @param cell individual Cell
+ * @return this
+ * @throws java.io.IOException e
+ */
+ @SuppressWarnings("unchecked")
+ public Increment add(Cell cell) throws IOException{
+ KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
+ byte [] family = kv.getFamily();
+ List extends Cell> list = getCellList(family);
+ //Checking that the row of the kv is the same as the put
+ int res = Bytes.compareTo(this.row, 0, row.length,
+ kv.getBuffer(), kv.getRowOffset(), kv.getRowLength());
+ if (res != 0) {
+ throw new WrongRowIOException("The row in " + kv.toString() +
+ " doesn't match the original one " + Bytes.toStringBinary(this.row));
}
- this.row = Arrays.copyOf(row, row.length);
+ ((List We compare and equate mutations based off their row so be careful putting RowMutations
+ * into Sets or using them as keys in Maps.
*/
@InterfaceAudience.Public
@InterfaceStability.Evolving
@@ -88,6 +91,16 @@ public class RowMutations implements Row {
return Bytes.compareTo(this.getRow(), i.getRow());
}
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) return true;
+ if (obj instanceof RowMutations) {
+ RowMutations other = (RowMutations)obj;
+ return compareTo(other) == 0;
+ }
+ return false;
+ }
+
@Override
public byte[] getRow() {
return row;
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/WrongRowIOException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/WrongRowIOException.java
new file mode 100644
index 00000000000..a44dc8aaee0
--- /dev/null
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/WrongRowIOException.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.client;
+
+import org.apache.hadoop.hbase.exceptions.HBaseIOException;
+
+public class WrongRowIOException extends HBaseIOException {
+ private static final long serialVersionUID = -5849522209440123059L;
+
+ public WrongRowIOException(final String msg) {
+ super(msg);
+ }
+}
\ No newline at end of file
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/AccessDeniedException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/AccessDeniedException.java
index 3d759e8bd56..45949648305 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/AccessDeniedException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/AccessDeniedException.java
@@ -17,7 +17,6 @@
*/
package org.apache.hadoop.hbase.exceptions;
-import org.apache.hadoop.hbase.exceptions.DoNotRetryIOException;
/**
* Exception thrown by access-related methods.
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/CoprocessorException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/CoprocessorException.java
index a66591ea1e7..5e5409a55c6 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/CoprocessorException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/CoprocessorException.java
@@ -20,7 +20,6 @@ package org.apache.hadoop.hbase.exceptions;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
-import org.apache.hadoop.hbase.exceptions.DoNotRetryIOException;
/**
* Thrown if a coprocessor encounters any exception.
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/CorruptHFileException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/CorruptHFileException.java
index 61288ea86b3..3b92b3579d3 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/CorruptHFileException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/CorruptHFileException.java
@@ -18,7 +18,6 @@
package org.apache.hadoop.hbase.exceptions;
import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.hbase.exceptions.DoNotRetryIOException;
/**
* This exception is thrown when attempts to read an HFile fail due to corruption or truncation
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/DoNotRetryIOException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/DoNotRetryIOException.java
index a539a6650e0..8973233f111 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/DoNotRetryIOException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/DoNotRetryIOException.java
@@ -56,4 +56,4 @@ public class DoNotRetryIOException extends HBaseIOException {
public DoNotRetryIOException(Throwable cause) {
super(cause);
}
-}
+}
\ No newline at end of file
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/LeaseException.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/LeaseException.java
index 1d1cece986c..0ba7650cd5b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/LeaseException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/exceptions/LeaseException.java
@@ -19,7 +19,6 @@
package org.apache.hadoop.hbase.exceptions;
import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.hbase.exceptions.DoNotRetryIOException;
/**
* Reports a problem with a lease
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java
index b262bd1aa13..12008e2ddb9 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/NullComparator.java
@@ -23,6 +23,7 @@ import com.google.protobuf.InvalidProtocolBufferException;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
+import org.apache.hadoop.hbase.protobuf.generated.ClientProtos;
import org.apache.hadoop.hbase.protobuf.generated.ComparatorProtos;
/**
@@ -47,6 +48,11 @@ public class NullComparator extends ByteArrayComparable {
return obj == null;
}
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
@Override
public int compareTo(byte[] value, int offset, int length) {
throw new UnsupportedOperationException();
@@ -69,9 +75,9 @@ public class NullComparator extends ByteArrayComparable {
*/
public static NullComparator parseFrom(final byte [] pbBytes)
throws DeserializationException {
- ComparatorProtos.NullComparator proto;
try {
- proto = ComparatorProtos.NullComparator.parseFrom(pbBytes);
+ @SuppressWarnings("unused")
+ ComparatorProtos.NullComparator proto = ComparatorProtos.NullComparator.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/AuthMethod.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/AuthMethod.java
index 26ab35d7736..c223fa51036 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/AuthMethod.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/AuthMethod.java
@@ -46,7 +46,7 @@ public enum AuthMethod {
private static final int FIRST_CODE = values()[0].code;
/** Return the object represented by the code. */
- private static AuthMethod valueOf(byte code) {
+ public static AuthMethod valueOf(byte code) {
final int i = (code & 0xff) - FIRST_CODE;
return i < 0 || i >= values().length ? null : values()[i];
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java
index ea0b255b2fc..f147299262f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java
@@ -1587,7 +1587,7 @@ public class ZKUtil {
try {
getReplicationZnodesDump(zkw, sb);
} catch (KeeperException ke) {
- LOG.warn("Couldn't get the replication znode dump." + ke.getStackTrace());
+ LOG.warn("Couldn't get the replication znode dump", ke);
}
sb.append("\nQuorum Server Statistics:");
String[] servers = zkw.getQuorum().split(",");
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAttributes.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAttributes.java
index 8c5abbabe3e..ef8f0222a30 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAttributes.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestAttributes.java
@@ -29,9 +29,10 @@ import org.junit.experimental.categories.Category;
@Category(SmallTests.class)
public class TestAttributes {
+ private static final byte [] ROW = new byte [] {'r'};
@Test
public void testPutAttributes() {
- Put put = new Put(new byte [] {});
+ Put put = new Put(ROW);
Assert.assertTrue(put.getAttributesMap().isEmpty());
Assert.assertNull(put.getAttribute("absent"));
@@ -79,7 +80,7 @@ public class TestAttributes {
@Test
public void testDeleteAttributes() {
- Delete del = new Delete(new byte [] {});
+ Delete del = new Delete(new byte [] {'r'});
Assert.assertTrue(del.getAttributesMap().isEmpty());
Assert.assertNull(del.getAttribute("absent"));
@@ -126,7 +127,7 @@ public class TestAttributes {
@Test
public void testGetId() {
- Get get = new Get(null);
+ Get get = new Get(ROW);
Assert.assertNull("Make sure id is null if unset", get.toMap().get("id"));
get.setId("myId");
Assert.assertEquals("myId", get.toMap().get("id"));
@@ -134,7 +135,7 @@ public class TestAttributes {
@Test
public void testAppendId() {
- Append append = new Append(Bytes.toBytes("testRow"));
+ Append append = new Append(ROW);
Assert.assertNull("Make sure id is null if unset", append.toMap().get("id"));
append.setId("myId");
Assert.assertEquals("myId", append.toMap().get("id"));
@@ -142,7 +143,7 @@ public class TestAttributes {
@Test
public void testDeleteId() {
- Delete delete = new Delete(new byte [] {});
+ Delete delete = new Delete(ROW);
Assert.assertNull("Make sure id is null if unset", delete.toMap().get("id"));
delete.setId("myId");
Assert.assertEquals("myId", delete.toMap().get("id"));
@@ -150,7 +151,7 @@ public class TestAttributes {
@Test
public void testPutId() {
- Put put = new Put(new byte [] {});
+ Put put = new Put(ROW);
Assert.assertNull("Make sure id is null if unset", put.toMap().get("id"));
put.setId("myId");
Assert.assertEquals("myId", put.toMap().get("id"));
@@ -163,6 +164,4 @@ public class TestAttributes {
scan.setId("myId");
Assert.assertEquals("myId", scan.toMap().get("id"));
}
-
-}
-
+}
\ No newline at end of file
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
index 3d01d1bea16..419d41dfe05 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
@@ -34,6 +34,7 @@ import org.junit.experimental.categories.Category;
// TODO: cover more test cases
@Category(SmallTests.class)
public class TestGet {
+ private static final byte [] ROW = new byte [] {'r'};
@Test
public void testAttributesSerialization() throws IOException {
Get get = new Get(Bytes.toBytes("row"));
@@ -53,7 +54,7 @@ public class TestGet {
@Test
public void testGetAttributes() {
- Get get = new Get(null);
+ Get get = new Get(ROW);
Assert.assertTrue(get.getAttributesMap().isEmpty());
Assert.assertNull(get.getAttribute("absent"));
@@ -100,11 +101,10 @@ public class TestGet {
@Test
public void testNullQualifier() {
- Get get = new Get(null);
+ Get get = new Get(ROW);
byte[] family = Bytes.toBytes("family");
get.addColumn(family, null);
Setrow
is empty or null or
+ * > {@link HConstants#MAX_ROW_LENGTH}
+ * @return row
+ */
+ static byte [] checkRow(final byte [] row) {
+ return checkRow(row, 0, row == null? 0: row.length);
+ }
+
+ /**
+ * @param row Row to check
+ * @param offset
+ * @param length
+ * @throws IllegalArgumentException Thrown if row
is empty or null or
+ * > {@link HConstants#MAX_ROW_LENGTH}
+ * @return row
+ */
+ static byte [] checkRow(final byte [] row, final int offset, final int length) {
+ if (row == null) {
+ throw new IllegalArgumentException("Row buffer is null");
+ }
+ if (length == 0) {
+ throw new IllegalArgumentException("Row length is 0");
+ }
+ if (length > HConstants.MAX_ROW_LENGTH) {
+ throw new IllegalArgumentException("Row length " + length + " is > " +
+ HConstants.MAX_ROW_LENGTH);
+ }
+ return row;
+ }
+}
\ No newline at end of file
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
index 7819723b2d3..97c55ecd25f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Put.java
@@ -57,14 +57,23 @@ public class Put extends Mutation implements HeapSize, Comparable