Skip to content

Commit

Permalink
fix prewrite & commit log info to debug(#776)
Browse files Browse the repository at this point in the history
  • Loading branch information
b.tian committed Jan 18, 2024
1 parent 533dbc2 commit aedfd66
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions src/main/java/org/tikv/txn/TwoPhaseCommitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ private void doCommitPrimaryKeyWithRetry(BackOffer backOffer, ByteString key, lo
this.doCommitPrimaryKeyWithRetry(backOffer, key, commitTs);
}
}

LOG.info("commit primary key {} successfully", KeyUtils.formatBytes(key));
if (commitResult.isSuccess() && LOG.isDebugEnabled()) {
LOG.debug("commit primary key {} successfully", KeyUtils.formatBytes(key));
}
}

/**
Expand Down Expand Up @@ -397,11 +398,13 @@ private void doPrewriteSecondaryKeySingleBatchWithRetry(
BatchKeys batchKeys,
Map<ByteString, Kvrpcpb.Mutation> mutations)
throws TiBatchWriteException {
LOG.debug(
"start prewrite secondary key, row={}, size={}KB, regionId={}",
batchKeys.getKeys().size(),
batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
if (LOG.isDebugEnabled()) {
LOG.debug(
"start prewrite secondary key, row={}, size={}KB, regionId={}",
batchKeys.getKeys().size(),
batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
}

List<ByteString> keyList = batchKeys.getKeys();
int batchSize = keyList.size();
Expand Down Expand Up @@ -445,11 +448,13 @@ private void doPrewriteSecondaryKeySingleBatchWithRetry(
throw new TiBatchWriteException(errorMsg, e);
}
}
LOG.debug(
"prewrite secondary key successfully, row={}, size={}KB, regionId={}",
batchKeys.getKeys().size(),
batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
if (LOG.isDebugEnabled()) {
LOG.debug(
"prewrite secondary key successfully, row={}, size={}KB, regionId={}",
batchKeys.getKeys().size(),
batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
}
}

private void appendBatchBySize(
Expand Down Expand Up @@ -592,11 +597,13 @@ private void doCommitSecondaryKeysWithRetry(

private void doCommitSecondaryKeySingleBatchWithRetry(
BackOffer backOffer, BatchKeys batchKeys, long commitTs) throws TiBatchWriteException {
LOG.info(
"start commit secondary key, row={}, size={}KB, regionId={}",
batchKeys.getKeys().size(),
batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
if (LOG.isDebugEnabled()) {
LOG.debug(
"start commit secondary key, row={}, size={}KB, regionId={}",
batchKeys.getKeys().size(),
batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
}
List<ByteString> keysCommit = batchKeys.getKeys();
ByteString[] keys = new ByteString[keysCommit.size()];
keysCommit.toArray(keys);
Expand All @@ -612,11 +619,13 @@ private void doCommitSecondaryKeySingleBatchWithRetry(
LOG.warn(error);
throw new TiBatchWriteException("commit secondary key error", commitResult.getException());
}
LOG.info(
"commit {} rows successfully, size={}KB, regionId={}",
batchKeys.getKeys().size(),
batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
if (commitResult.isSuccess() && LOG.isDebugEnabled()) {
LOG.debug(
"commit {} rows successfully, size={}KB, regionId={}",
batchKeys.getKeys().size(),
batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
}
}

private GroupKeyResult groupKeysByRegion(ByteString[] keys, int size, BackOffer backOffer)
Expand Down

0 comments on commit aedfd66

Please sign in to comment.