Author: stack
Date: Fri Feb 17 22:58:01 2012
New Revision: 1245792
URL: http://svn.apache.org/viewvc?rev=1245792&view=rev
Log:
HBASE-3584 Rename RowMutation to RowMutations
Added:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/RowMutation.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/HbaseObjectWritable.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java
hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTable.java Fri
Feb 17 22:58:01 2012
@@ -752,7 +752,7 @@ public class HTable implements HTableInt
* {@inheritDoc}
*/
@Override
- public void mutateRow(final RowMutation rm) throws IOException {
+ public void mutateRow(final RowMutations rm) throws IOException {
new ServerCallable<Void>(connection, tableName, rm.getRow(),
operationTimeout) {
public Void call() throws IOException {
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java
Fri Feb 17 22:58:01 2012
@@ -272,7 +272,7 @@ public interface HTableInterface extends
* atomically
* @throws IOException
*/
- public void mutateRow(final RowMutation rm) throws IOException;
+ public void mutateRow(final RowMutations rm) throws IOException;
/**
* Appends values to one or more columns within a single row.
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/RowMutation.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/RowMutation.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/RowMutation.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/RowMutation.java
Fri Feb 17 22:58:01 2012
@@ -1,126 +0,0 @@
-/*
- * 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 java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.hadoop.hbase.HConstants;
-import org.apache.hadoop.hbase.io.HbaseObjectWritable;
-import org.apache.hadoop.hbase.util.Bytes;
-
-/**
- * Performs multiple mutations atomically on a single row.
- * Currently {@link Put} and {@link Delete} are supported.
- *
- * The mutations are performed in the order in which they
- * were added.
- */
-public class RowMutation implements Row {
- private List<Mutation> mutations = new ArrayList<Mutation>();
- private byte [] row;
- private static final byte VERSION = (byte)0;
-
- /** Constructor for Writable. DO NOT USE */
- public RowMutation() {}
-
- /**
- * Create an atomic mutation for the specified row.
- * @param row row key
- */
- public RowMutation(byte [] row) {
- if(row == null || row.length > HConstants.MAX_ROW_LENGTH) {
- throw new IllegalArgumentException("Row key is invalid");
- }
- this.row = Arrays.copyOf(row, row.length);
- }
-
- /**
- * Add a {@link Put} operation to the list of mutations
- * @param p The {@link Put} to add
- * @throws IOException
- */
- public void add(Put p) throws IOException {
- internalAdd(p);
- }
-
- /**
- * Add a {@link Delete} operation to the list of mutations
- * @param d The {@link Delete} to add
- * @throws IOException
- */
- public void add(Delete d) throws IOException {
- internalAdd(d);
- }
-
- private void internalAdd(Mutation m) throws IOException {
- int res = Bytes.compareTo(this.row, m.getRow());
- if(res != 0) {
- throw new IOException("The row in the recently added Put/Delete " +
- Bytes.toStringBinary(m.getRow()) + " doesn't match the original one
" +
- Bytes.toStringBinary(this.row));
- }
- mutations.add(m);
- }
-
- @Override
- public void readFields(final DataInput in) throws IOException {
- int version = in.readByte();
- if (version > VERSION) {
- throw new IOException("version not supported");
- }
- this.row = Bytes.readByteArray(in);
- int numMutations = in.readInt();
- mutations.clear();
- for(int i = 0; i < numMutations; i++) {
- mutations.add((Mutation) HbaseObjectWritable.readObject(in, null));
- }
- }
-
- @Override
- public void write(final DataOutput out) throws IOException {
- out.writeByte(VERSION);
- Bytes.writeByteArray(out, this.row);
- out.writeInt(mutations.size());
- for (Mutation m : mutations) {
- HbaseObjectWritable.writeObject(out, m, m.getClass(), null);
- }
- }
-
- @Override
- public int compareTo(Row i) {
- return Bytes.compareTo(this.getRow(), i.getRow());
- }
-
- @Override
- public byte[] getRow() {
- return row;
- }
-
- /**
- * @return An unmodifiable list of the current mutations.
- */
- public List<Mutation> getMutations() {
- return Collections.unmodifiableList(mutations);
- }
-}
Added:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java?rev=1245792&view=auto
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
(added)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
Fri Feb 17 22:58:01 2012
@@ -0,0 +1,126 @@
+/*
+ * 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 java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.io.HbaseObjectWritable;
+import org.apache.hadoop.hbase.util.Bytes;
+
+/**
+ * Performs multiple mutations atomically on a single row.
+ * Currently {@link Put} and {@link Delete} are supported.
+ *
+ * The mutations are performed in the order in which they
+ * were added.
+ */
+public class RowMutations implements Row {
+ private List<Mutation> mutations = new ArrayList<Mutation>();
+ private byte [] row;
+ private static final byte VERSION = (byte)0;
+
+ /** Constructor for Writable. DO NOT USE */
+ public RowMutations() {}
+
+ /**
+ * Create an atomic mutation for the specified row.
+ * @param row row key
+ */
+ public RowMutations(byte [] row) {
+ if(row == null || row.length > HConstants.MAX_ROW_LENGTH) {
+ throw new IllegalArgumentException("Row key is invalid");
+ }
+ this.row = Arrays.copyOf(row, row.length);
+ }
+
+ /**
+ * Add a {@link Put} operation to the list of mutations
+ * @param p The {@link Put} to add
+ * @throws IOException
+ */
+ public void add(Put p) throws IOException {
+ internalAdd(p);
+ }
+
+ /**
+ * Add a {@link Delete} operation to the list of mutations
+ * @param d The {@link Delete} to add
+ * @throws IOException
+ */
+ public void add(Delete d) throws IOException {
+ internalAdd(d);
+ }
+
+ private void internalAdd(Mutation m) throws IOException {
+ int res = Bytes.compareTo(this.row, m.getRow());
+ if(res != 0) {
+ throw new IOException("The row in the recently added Put/Delete " +
+ Bytes.toStringBinary(m.getRow()) + " doesn't match the original one
" +
+ Bytes.toStringBinary(this.row));
+ }
+ mutations.add(m);
+ }
+
+ @Override
+ public void readFields(final DataInput in) throws IOException {
+ int version = in.readByte();
+ if (version > VERSION) {
+ throw new IOException("version not supported");
+ }
+ this.row = Bytes.readByteArray(in);
+ int numMutations = in.readInt();
+ mutations.clear();
+ for(int i = 0; i < numMutations; i++) {
+ mutations.add((Mutation) HbaseObjectWritable.readObject(in, null));
+ }
+ }
+
+ @Override
+ public void write(final DataOutput out) throws IOException {
+ out.writeByte(VERSION);
+ Bytes.writeByteArray(out, this.row);
+ out.writeInt(mutations.size());
+ for (Mutation m : mutations) {
+ HbaseObjectWritable.writeObject(out, m, m.getClass(), null);
+ }
+ }
+
+ @Override
+ public int compareTo(Row i) {
+ return Bytes.compareTo(this.getRow(), i.getRow());
+ }
+
+ @Override
+ public byte[] getRow() {
+ return row;
+ }
+
+ /**
+ * @return An unmodifiable list of the current mutations.
+ */
+ public List<Mutation> getMutations() {
+ return Collections.unmodifiableList(mutations);
+ }
+}
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java
Fri Feb 17 22:58:01 2012
@@ -503,7 +503,7 @@ public abstract class CoprocessorHost<E
}
@Override
- public void mutateRow(RowMutation rm) throws IOException {
+ public void mutateRow(RowMutations rm) throws IOException {
table.mutateRow(rm);
}
}
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/HbaseObjectWritable.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/HbaseObjectWritable.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/HbaseObjectWritable.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/io/HbaseObjectWritable.java
Fri Feb 17 22:58:01 2012
@@ -60,7 +60,7 @@ import org.apache.hadoop.hbase.client.Mu
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Row;
-import org.apache.hadoop.hbase.client.RowMutation;
+import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.coprocessor.Exec;
import org.apache.hadoop.hbase.filter.BinaryComparator;
@@ -257,7 +257,7 @@ public class HbaseObjectWritable impleme
addToMap(Append.class, code++);
- addToMap(RowMutation.class, code++);
+ addToMap(RowMutations.class, code++);
addToMap(Message.class, code++);
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HRegionInterface.java
Fri Feb 17 22:58:01 2012
@@ -29,7 +29,7 @@ import org.apache.hadoop.hbase.HServerIn
import org.apache.hadoop.hbase.NotServingRegionException;
import org.apache.hadoop.hbase.Stoppable;
import org.apache.hadoop.hbase.client.Append;
-import org.apache.hadoop.hbase.client.RowMutation;
+import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
@@ -263,7 +263,7 @@ public interface HRegionInterface extend
byte [] family, byte [] qualifier, long amount, boolean writeToWAL)
throws IOException;
- public void mutateRow(byte[] regionName, RowMutation rm)
+ public void mutateRow(byte[] regionName, RowMutations rm)
throws IOException;
/**
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Fri Feb 17 22:58:01 2012
@@ -77,7 +77,7 @@ import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.NotServingRegionException;
import org.apache.hadoop.hbase.UnknownScannerException;
import org.apache.hadoop.hbase.client.Append;
-import org.apache.hadoop.hbase.client.RowMutation;
+import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
@@ -4149,7 +4149,7 @@ public class HRegion implements HeapSize
return results;
}
- public void mutateRow(RowMutation rm) throws IOException {
+ public void mutateRow(RowMutations rm) throws IOException {
mutateRowsWithLocks(rm.getMutations(), Collections.singleton(rm.getRow()));
}
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Fri Feb 17 22:58:01 2012
@@ -83,7 +83,7 @@ import org.apache.hadoop.hbase.catalog.M
import org.apache.hadoop.hbase.catalog.RootLocationEditor;
import org.apache.hadoop.hbase.client.Action;
import org.apache.hadoop.hbase.client.Append;
-import org.apache.hadoop.hbase.client.RowMutation;
+import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HConnectionManager;
@@ -3156,7 +3156,7 @@ public class HRegionServer implements HR
}
@Override
- public void mutateRow(byte[] regionName, RowMutation rm)
+ public void mutateRow(byte[] regionName, RowMutations rm)
throws IOException {
checkOpen();
if (regionName == null) {
@@ -3321,8 +3321,8 @@ public class HRegionServer implements HR
} else if (action instanceof Append) {
response.add(regionName, originalIndex,
append(regionName, (Append)action));
- } else if (action instanceof RowMutation) {
- mutateRow(regionName, (RowMutation)action);
+ } else if (action instanceof RowMutations) {
+ mutateRow(regionName, (RowMutations)action);
response.add(regionName, originalIndex, new Result());
} else {
LOG.debug("Error: invalid Action, row must be a Get, Delete, " +
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/rest/client/RemoteHTable.java
Fri Feb 17 22:58:01 2012
@@ -42,7 +42,7 @@ import org.apache.hadoop.hbase.HBaseConf
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.client.RowMutation;
+import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTableInterface;
@@ -650,7 +650,7 @@ public class RemoteHTable implements HTa
}
@Override
- public void mutateRow(RowMutation rm) throws IOException {
+ public void mutateRow(RowMutations rm) throws IOException {
throw new IOException("atomicMutation not supported");
}
}
Modified:
hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
---
hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
(original)
+++
hbase/trunk/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java
Fri Feb 17 22:58:01 2012
@@ -4078,7 +4078,7 @@ public class TestFromClientSide {
byte [][] QUALIFIERS = new byte [][] {
Bytes.toBytes("a"), Bytes.toBytes("b")
};
- RowMutation arm = new RowMutation(ROW);
+ RowMutations arm = new RowMutations(ROW);
Put p = new Put(ROW);
p.add(FAMILY, QUALIFIERS[0], VALUE);
arm.add(p);
@@ -4088,7 +4088,7 @@ public class TestFromClientSide {
Result r = t.get(g);
assertEquals(0, Bytes.compareTo(VALUE, r.getValue(FAMILY, QUALIFIERS[0])));
- arm = new RowMutation(ROW);
+ arm = new RowMutations(ROW);
p = new Put(ROW);
p.add(FAMILY, QUALIFIERS[1], VALUE);
arm.add(p);
Modified:
hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
---
hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
(original)
+++
hbase/trunk/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
Fri Feb 17 22:58:01 2012
@@ -151,7 +151,7 @@ public class TestRegionObserverInterface
delete.deleteColumn(B, B);
delete.deleteColumn(C, C);
- RowMutation arm = new RowMutation(ROW);
+ RowMutations arm = new RowMutations(ROW);
arm.add(put);
arm.add(delete);
table.mutateRow(arm);
Modified:
hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java?rev=1245792&r1=1245791&r2=1245792&view=diff
==============================================================================
---
hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java
(original)
+++
hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java
Fri Feb 17 22:58:01 2012
@@ -33,7 +33,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.*;
import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.Mutation;
-import org.apache.hadoop.hbase.client.RowMutation;
+import org.apache.hadoop.hbase.client.RowMutations;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Put;
@@ -280,7 +280,7 @@ public class TestAtomicOperation extends
region.flushcache();
}
long ts = timeStamps.incrementAndGet();
- RowMutation rm = new RowMutation(row);
+ RowMutations rm = new RowMutations(row);
if (op) {
Put p = new Put(row, ts);
p.add(fam1, qual1, value1);