You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ra...@apache.org on 2016/02/06 08:36:25 UTC
hbase git commit: HBASE-15204 Try to estimate the cell count for
adding into WALEdit (Revert for making it more cleaner)
Repository: hbase
Updated Branches:
refs/heads/master 59b03c77d -> 4e44f4f50
HBASE-15204 Try to estimate the cell count for adding into WALEdit (Revert
for making it more cleaner)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4e44f4f5
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4e44f4f5
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4e44f4f5
Branch: refs/heads/master
Commit: 4e44f4f5050bf2720762f754d3756763026c0dbd
Parents: 59b03c7
Author: ramkrishna <ra...@gmail.com>
Authored: Sat Feb 6 13:05:13 2016 +0530
Committer: ramkrishna <ra...@gmail.com>
Committed: Sat Feb 6 13:05:13 2016 +0530
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/HRegion.java | 25 +++++++-------------
.../hadoop/hbase/regionserver/wal/WALEdit.java | 8 +------
2 files changed, 10 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/4e44f4f5/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 86f4a1b..f03c205 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -2906,26 +2906,25 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
* OperationStatusCode and the exceptionMessage if any.
* @throws IOException
*/
- OperationStatus[] batchMutate(BatchOperationInProgress<?> batchOp)
- throws IOException {
+ OperationStatus[] batchMutate(BatchOperationInProgress<?> batchOp) throws IOException {
boolean initialized = false;
Operation op = batchOp.isInReplay() ? Operation.REPLAY_BATCH_MUTATE : Operation.BATCH_MUTATE;
startRegionOperation(op);
- int cellCountFromCP = 0;
try {
while (!batchOp.isDone()) {
if (!batchOp.isInReplay()) {
checkReadOnly();
}
checkResources();
+
if (!initialized) {
this.writeRequestsCount.add(batchOp.operations.length);
if (!batchOp.isInReplay()) {
- cellCountFromCP = doPreMutationHook(batchOp);
+ doPreMutationHook(batchOp);
}
initialized = true;
}
- long addedSize = doMiniBatchMutation(batchOp, cellCountFromCP);
+ long addedSize = doMiniBatchMutation(batchOp);
long newSize = this.addAndGetGlobalMemstoreSize(addedSize);
if (isFlushSize(newSize)) {
requestFlush();
@@ -2938,11 +2937,10 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
}
- private int doPreMutationHook(BatchOperationInProgress<?> batchOp)
+ private void doPreMutationHook(BatchOperationInProgress<?> batchOp)
throws IOException {
/* Run coprocessor pre hook outside of locks to avoid deadlock */
WALEdit walEdit = new WALEdit();
- int cellCount = 0;
if (coprocessorHost != null) {
for (int i = 0 ; i < batchOp.operations.length; i++) {
Mutation m = batchOp.getMutation(i);
@@ -2972,17 +2970,14 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
}
if (!walEdit.isEmpty()) {
batchOp.walEditsFromCoprocessors[i] = walEdit;
- cellCount += walEdit.size();
walEdit = new WALEdit();
}
}
}
- return cellCount;
}
@SuppressWarnings("unchecked")
- private long doMiniBatchMutation(BatchOperationInProgress<?> batchOp, int cellCount)
- throws IOException {
+ private long doMiniBatchMutation(BatchOperationInProgress<?> batchOp) throws IOException {
boolean isInReplay = batchOp.isInReplay();
// variable to note if all Put items are for the same CF -- metrics related
boolean putsCfSetConsistent = true;
@@ -2994,7 +2989,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
Set<byte[]> deletesCfSet = null;
long currentNonceGroup = HConstants.NO_NONCE, currentNonce = HConstants.NO_NONCE;
- WALEdit walEdit = null;
+ WALEdit walEdit = new WALEdit(isInReplay);
MultiVersionConcurrencyControl.WriteEntry writeEntry = null;
long txid = 0;
boolean doRollBackMemstore = false;
@@ -3025,6 +3020,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
Map<byte[], List<Cell>> familyMap = mutation.getFamilyCellMap();
// store the family map reference to allow for mutations
familyMaps[lastIndexExclusive] = familyMap;
+
// skip anything that "ran" already
if (batchOp.retCodeDetails[lastIndexExclusive].getOperationStatusCode()
!= OperationStatusCode.NOT_RUN) {
@@ -3131,11 +3127,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
noOfDeletes++;
}
rewriteCellTags(familyMaps[i], mutation);
- for (List<Cell> cells : familyMaps[i].values()) {
- cellCount += cells.size();
- }
}
- walEdit = new WALEdit(cellCount);
+
lock(this.updatesLock.readLock(), numReadyToWrite);
locked = true;
http://git-wip-us.apache.org/repos/asf/hbase/blob/4e44f4f5/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
index 1a87447..cea2ee7 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
@@ -99,7 +99,7 @@ public class WALEdit implements Writable, HeapSize {
private final int VERSION_2 = -1;
private final boolean isReplay;
- private ArrayList<Cell> cells = null;
+ private ArrayList<Cell> cells = new ArrayList<Cell>(1);
public static final WALEdit EMPTY_WALEDIT = new WALEdit();
@@ -118,12 +118,6 @@ public class WALEdit implements Writable, HeapSize {
public WALEdit(boolean isReplay) {
this.isReplay = isReplay;
- cells = new ArrayList<Cell>(1);
- }
-
- public WALEdit(int cellCount) {
- this.isReplay = false;
- cells = new ArrayList<Cell>(cellCount);
}
/**