fix prewrite & commit log info to debug(#776)

This commit is contained in:
b.tian 2024-01-17 11:33:50 +08:00
parent 533dbc23a1
commit aedfd66b88
1 changed files with 31 additions and 22 deletions

View File

@ -227,8 +227,9 @@ public class TwoPhaseCommitter implements AutoCloseable {
this.doCommitPrimaryKeyWithRetry(backOffer, key, commitTs); this.doCommitPrimaryKeyWithRetry(backOffer, key, commitTs);
} }
} }
if (commitResult.isSuccess() && LOG.isDebugEnabled()) {
LOG.info("commit primary key {} successfully", KeyUtils.formatBytes(key)); LOG.debug("commit primary key {} successfully", KeyUtils.formatBytes(key));
}
} }
/** /**
@ -397,11 +398,13 @@ public class TwoPhaseCommitter implements AutoCloseable {
BatchKeys batchKeys, BatchKeys batchKeys,
Map<ByteString, Kvrpcpb.Mutation> mutations) Map<ByteString, Kvrpcpb.Mutation> mutations)
throws TiBatchWriteException { throws TiBatchWriteException {
LOG.debug( if (LOG.isDebugEnabled()) {
"start prewrite secondary key, row={}, size={}KB, regionId={}", LOG.debug(
batchKeys.getKeys().size(), "start prewrite secondary key, row={}, size={}KB, regionId={}",
batchKeys.getSizeInKB(), batchKeys.getKeys().size(),
batchKeys.getRegion().getId()); batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
}
List<ByteString> keyList = batchKeys.getKeys(); List<ByteString> keyList = batchKeys.getKeys();
int batchSize = keyList.size(); int batchSize = keyList.size();
@ -445,11 +448,13 @@ public class TwoPhaseCommitter implements AutoCloseable {
throw new TiBatchWriteException(errorMsg, e); throw new TiBatchWriteException(errorMsg, e);
} }
} }
LOG.debug( if (LOG.isDebugEnabled()) {
"prewrite secondary key successfully, row={}, size={}KB, regionId={}", LOG.debug(
batchKeys.getKeys().size(), "prewrite secondary key successfully, row={}, size={}KB, regionId={}",
batchKeys.getSizeInKB(), batchKeys.getKeys().size(),
batchKeys.getRegion().getId()); batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
}
} }
private void appendBatchBySize( private void appendBatchBySize(
@ -592,11 +597,13 @@ public class TwoPhaseCommitter implements AutoCloseable {
private void doCommitSecondaryKeySingleBatchWithRetry( private void doCommitSecondaryKeySingleBatchWithRetry(
BackOffer backOffer, BatchKeys batchKeys, long commitTs) throws TiBatchWriteException { BackOffer backOffer, BatchKeys batchKeys, long commitTs) throws TiBatchWriteException {
LOG.info( if (LOG.isDebugEnabled()) {
"start commit secondary key, row={}, size={}KB, regionId={}", LOG.debug(
batchKeys.getKeys().size(), "start commit secondary key, row={}, size={}KB, regionId={}",
batchKeys.getSizeInKB(), batchKeys.getKeys().size(),
batchKeys.getRegion().getId()); batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
}
List<ByteString> keysCommit = batchKeys.getKeys(); List<ByteString> keysCommit = batchKeys.getKeys();
ByteString[] keys = new ByteString[keysCommit.size()]; ByteString[] keys = new ByteString[keysCommit.size()];
keysCommit.toArray(keys); keysCommit.toArray(keys);
@ -612,11 +619,13 @@ public class TwoPhaseCommitter implements AutoCloseable {
LOG.warn(error); LOG.warn(error);
throw new TiBatchWriteException("commit secondary key error", commitResult.getException()); throw new TiBatchWriteException("commit secondary key error", commitResult.getException());
} }
LOG.info( if (commitResult.isSuccess() && LOG.isDebugEnabled()) {
"commit {} rows successfully, size={}KB, regionId={}", LOG.debug(
batchKeys.getKeys().size(), "commit {} rows successfully, size={}KB, regionId={}",
batchKeys.getSizeInKB(), batchKeys.getKeys().size(),
batchKeys.getRegion().getId()); batchKeys.getSizeInKB(),
batchKeys.getRegion().getId());
}
} }
private GroupKeyResult groupKeysByRegion(ByteString[] keys, int size, BackOffer backOffer) private GroupKeyResult groupKeysByRegion(ByteString[] keys, int size, BackOffer backOffer)