Skip to content

Commit

Permalink
[fix](metric) fix issue that the counter of rejected transactions doe…
Browse files Browse the repository at this point in the history
…s not cover some failed situations for load (apache#23363)

Co-authored-by: caiconghui1 <caiconghui1@jd.com>
  • Loading branch information
caiconghui and caiconghui1 committed Aug 31, 2023
1 parent 6795fc0 commit bba1d83
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,6 @@ public long beginTransaction(List<Long> tableIdList, String label, TUniqueId req
}

return tid;
} catch (DuplicatedRequestException e) {
throw e;
} catch (Exception e) {
if (MetricRepo.isInit) {
MetricRepo.COUNTER_TXN_REJECT.increase(1L);
}
throw e;
} finally {
writeUnlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,32 @@ public long beginTransaction(long dbId, List<Long> tableIdList, String label, TU
TxnCoordinator coordinator, LoadJobSourceType sourceType, long listenerId, long timeoutSecond)
throws AnalysisException, LabelAlreadyUsedException, BeginTransactionException, DuplicatedRequestException,
QuotaExceedException, MetaNotFoundException {
try {
if (Config.disable_load_job) {
throw new AnalysisException("disable_load_job is set to true, all load jobs are prevented");
}

if (Config.disable_load_job) {
throw new AnalysisException("disable_load_job is set to true, all load jobs are prevented");
}

switch (sourceType) {
case BACKEND_STREAMING:
checkValidTimeoutSecond(timeoutSecond, Config.max_stream_load_timeout_second,
Config.min_load_timeout_second);
break;
default:
checkValidTimeoutSecond(timeoutSecond, Config.max_load_timeout_second, Config.min_load_timeout_second);
}
switch (sourceType) {
case BACKEND_STREAMING:
checkValidTimeoutSecond(timeoutSecond, Config.max_stream_load_timeout_second,
Config.min_load_timeout_second);
break;
default:
checkValidTimeoutSecond(timeoutSecond, Config.max_load_timeout_second,
Config.min_load_timeout_second);
}

DatabaseTransactionMgr dbTransactionMgr = getDatabaseTransactionMgr(dbId);
return dbTransactionMgr.beginTransaction(tableIdList, label, requestId,
DatabaseTransactionMgr dbTransactionMgr = getDatabaseTransactionMgr(dbId);
return dbTransactionMgr.beginTransaction(tableIdList, label, requestId,
coordinator, sourceType, listenerId, timeoutSecond);
} catch (DuplicatedRequestException e) {
throw e;
} catch (Exception e) {
if (MetricRepo.isInit) {
MetricRepo.COUNTER_TXN_REJECT.increase(1L);
}
throw e;
}
}

private void checkValidTimeoutSecond(long timeoutSecond, int maxLoadTimeoutSecond,
Expand Down

0 comments on commit bba1d83

Please sign in to comment.