hust-hhb commented on code in PR #47988:
URL: https://github.com/apache/doris/pull/47988#discussion_r2006744376
##########
fe/fe-core/src/main/java/org/apache/doris/cloud/transaction/CloudGlobalTransactionMgr.java:
##########
@@ -885,132 +936,146 @@ private void getDeleteBitmapUpdateLock(long
transactionId, List<OlapTable> mowTa
}
StopWatch stopWatch = new StopWatch();
stopWatch.start();
- getPartitionInfo(mowTableList, tabletCommitInfos, lockContext);
int totalRetryTime = 0;
String retryMsg = "";
- for (Map.Entry<Long, Set<Long>> entry :
lockContext.getTableToPartitions().entrySet()) {
- GetDeleteBitmapUpdateLockRequest.Builder builder =
GetDeleteBitmapUpdateLockRequest.newBuilder();
-
builder.setTableId(entry.getKey()).setLockId(transactionId).setInitiator(-1)
-
.setExpiration(Config.delete_bitmap_lock_expiration_seconds).setRequireCompactionStats(true);
- List<Long> tabletList =
lockContext.getTableToTabletList().get(entry.getKey());
- for (Long tabletId : tabletList) {
- TabletMeta tabletMeta =
lockContext.getTabletToTabletMeta().get(tabletId);
- TabletIndexPB.Builder tabletIndexBuilder =
TabletIndexPB.newBuilder();
- tabletIndexBuilder.setDbId(tabletMeta.getDbId());
- tabletIndexBuilder.setTableId(tabletMeta.getTableId());
- tabletIndexBuilder.setIndexId(tabletMeta.getIndexId());
- tabletIndexBuilder.setPartitionId(tabletMeta.getPartitionId());
- tabletIndexBuilder.setTabletId(tabletId);
- builder.addTabletIndexes(tabletIndexBuilder);
- }
- final GetDeleteBitmapUpdateLockRequest request = builder.build();
- GetDeleteBitmapUpdateLockResponse response = null;
-
- int retryTime = 0;
- while (retryTime++ < Config.metaServiceRpcRetryTimes()) {
- try {
- response =
MetaServiceProxy.getInstance().getDeleteBitmapUpdateLock(request);
- if (LOG.isDebugEnabled()) {
- LOG.debug("get delete bitmap lock, transactionId={},
Request: {}, Response: {}", transactionId,
- request, response);
- }
- if
(DebugPointUtil.isEnable("CloudGlobalTransactionMgr.getDeleteBitmapUpdateLock.conflict"))
{
- DebugPoint debugPoint = DebugPointUtil.getDebugPoint(
-
"CloudGlobalTransactionMgr.getDeleteBitmapUpdateLock.conflict");
- double percent = debugPoint.param("percent", 0.4);
- long timestamp = System.currentTimeMillis();
- Random random = new Random(timestamp);
- if (Math.abs(random.nextInt()) % 100 < 100 * percent) {
- LOG.info("set kv txn conflict for test");
- GetDeleteBitmapUpdateLockResponse.Builder
getLockResponseBuilder
- =
GetDeleteBitmapUpdateLockResponse.newBuilder();
-
getLockResponseBuilder.setStatus(MetaServiceResponseStatus.newBuilder()
-
.setCode(MetaServiceCode.KV_TXN_CONFLICT_RETRY_EXCEEDED_MAX_TIMES)
- .setMsg("kv txn conflict"));
- response = getLockResponseBuilder.build();
+ boolean res = false;
Review Comment:
getDeleteBitmapUpdateLock function is used in several place, record in
function can reduce redundant code, in the end of function, we can use time
cost to decide print detail log or not, only print detail log when time cost
>1000ms
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]