Optimize UsageJobDaoImpl.updateJobSuccess to use direct UPDATE instead of row-level lock (#13160)

Co-authored-by: Aaron Chung <aaron_chung@apple.com>
This commit is contained in:
Vishesh 2026-06-18 19:12:51 +05:30 committed by GitHub
parent 95d0aed9f5
commit 6227525c84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 7 deletions

View File

@ -61,9 +61,6 @@ public class UsageJobDaoImpl extends GenericDaoBase<UsageJobVO, Long> implements
public void updateJobSuccess(Long jobId, long startMillis, long endMillis, long execTime, boolean success) {
TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB);
try {
txn.start();
UsageJobVO job = lockRow(jobId, Boolean.TRUE);
UsageJobVO jobForUpdate = createForUpdate();
jobForUpdate.setStartMillis(startMillis);
jobForUpdate.setEndMillis(endMillis);
@ -71,11 +68,8 @@ public class UsageJobDaoImpl extends GenericDaoBase<UsageJobVO, Long> implements
jobForUpdate.setStartDate(new Date(startMillis));
jobForUpdate.setEndDate(new Date(endMillis));
jobForUpdate.setSuccess(success);
update(job.getId(), jobForUpdate);
txn.commit();
update(jobId, jobForUpdate);
} catch (Exception ex) {
txn.rollback();
logger.error("error updating job success date", ex);
throw new CloudRuntimeException(ex.getMessage());
} finally {