HBASE-10069 Potential duplicate calls to log#appendNoSync() in HRegion#doMiniBatchMutation()

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1550223 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
sershe 2013-12-11 18:45:13 +00:00
parent 86bf0e85d8
commit c93a61d4d6
1 changed files with 6 additions and 1 deletions

View File

@ -2338,14 +2338,19 @@ public class HRegion implements HeapSize { // , Writable{
long nonceGroup = batchOp.getNonceGroup(i), nonce = batchOp.getNonce(i);
// In replay, the batch may contain multiple nonces. If so, write WALEdit for each.
// Given how nonces are originally written, these should be contiguous.
// txid should always increase, so having the last one is ok.
// They don't have to be, it will still work, just write more WALEdits than needed.
if (nonceGroup != currentNonceGroup || nonce != currentNonce) {
if (walEdit.size() > 0) {
assert isInReplay;
if (!isInReplay) {
throw new IOException("Multiple nonces per batch and not in replay");
}
// txid should always increase, so having the one from the last call is ok.
txid = this.log.appendNoSync(this.getRegionInfo(), htableDescriptor.getTableName(),
walEdit, m.getClusterIds(), now, htableDescriptor, this.sequenceId, true,
currentNonceGroup, currentNonce);
hasWalAppends = true;
walEdit = new WALEdit(isInReplay);
}
currentNonceGroup = nonceGroup;
currentNonce = nonce;