This is an automated email from the ASF dual-hosted git repository.

winterhazel pushed a commit to branch 4.22
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.22 by this push:
     new 6227525c842 Optimize UsageJobDaoImpl.updateJobSuccess to use direct 
UPDATE instead of row-level lock (#13160)
6227525c842 is described below

commit 6227525c8423efb96aa399a3f2a918aa33a7a10a
Author: Vishesh <[email protected]>
AuthorDate: Thu Jun 18 19:12:51 2026 +0530

    Optimize UsageJobDaoImpl.updateJobSuccess to use direct UPDATE instead of 
row-level lock (#13160)
    
    Co-authored-by: Aaron Chung <[email protected]>
---
 .../schema/src/main/java/com/cloud/usage/dao/UsageJobDaoImpl.java | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git 
a/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDaoImpl.java 
b/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDaoImpl.java
index 6f340501cf1..68ad8fa12ed 100644
--- a/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/usage/dao/UsageJobDaoImpl.java
@@ -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 {

Reply via email to