diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 13c4830..c70a5b7 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -66,7 +66,6 @@ import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.Cell; -import org.apache.hadoop.hbase.CellScanner; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.CompoundConfiguration; import org.apache.hadoop.hbase.DroppedSnapshotException; @@ -115,12 +114,9 @@ import org.apache.hadoop.hbase.master.AssignmentManager; import org.apache.hadoop.hbase.monitoring.MonitoredTask; import org.apache.hadoop.hbase.monitoring.TaskMonitor; import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.GetRegionInfoResponse.CompactionState; -import org.apache.hadoop.hbase.protobuf.generated.AdminProtos.WALEntry; import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceCall; -import org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription; import org.apache.hadoop.hbase.protobuf.generated.WALProtos.CompactionDescriptor; -import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALKey; import org.apache.hadoop.hbase.regionserver.MultiVersionConsistencyControl.WriteEntry; import org.apache.hadoop.hbase.regionserver.compactions.CompactionContext; import org.apache.hadoop.hbase.regionserver.wal.HLog; @@ -1624,7 +1620,7 @@ public class HRegion implements HeapSize { // , Writable{ // Record latest flush time this.lastFlushTime = EnvironmentEdgeManager.currentTimeMillis(); - + // Update the last flushed sequence id for region if (this.rsServices != null) { completeSequenceId = flushSeqId; @@ -1944,6 +1940,15 @@ public class HRegion implements HeapSize { // , Writable{ boolean initialized = false; + for (Mutation mutation : mutations) { + try { + checkRow(mutation.getRow(), "batchMutate"); + } catch (WrongRegionException ex) { + // TODO: this is temporary logging + LOG.warn("Wrong region is caught: " + " region:" + this.getRegionInfo() + " mutations:" + Arrays.toString(mutations)); + } + } + while (!batchOp.isDone()) { if (!isReplay) { checkReadOnly(); @@ -4664,7 +4669,7 @@ public class HRegion implements HeapSize { // , Writable{ Store store = stores.get(family.getKey()); List kvs = new ArrayList(family.getValue().size()); - + Collections.sort(family.getValue(), store.getComparator()); // Get previous values for all columns in this family Get get = new Get(row); @@ -4848,7 +4853,7 @@ public class HRegion implements HeapSize { // , Writable{ } get.setTimeRange(tr.getMin(), tr.getMax()); List results = get(get, false); - + // Iterate the input columns and update existing values if they were // found, otherwise add new column initialized to the increment amount int idx = 0; diff --git hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index a702b52..a0a5446 100644 --- hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -4020,8 +4020,6 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa try { int i = 0; for (ClientProtos.Action action: mutations) { - ClientProtos.ResultOrException.Builder resultOrExceptionBuilder = - ClientProtos.ResultOrException.newBuilder(); MutationProto m = action.getMutation(); Mutation mutation; if (m.getMutateType() == MutationType.PUT) { @@ -4065,9 +4063,8 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa } } } catch (IOException ie) { - ResultOrException resultOrException = ResponseConverter.buildActionResult(ie).build(); for (int i = 0; i < mutations.size(); i++) { - builder.addResultOrException(resultOrException); + builder.addResultOrException(getResultOrException(ie, mutations.get(i).getIndex())); } } long after = EnvironmentEdgeManager.currentTimeMillis();