rohityadavcloud commented on code in PR #9955:
URL: https://github.com/apache/cloudstack/pull/9955#discussion_r1978581009


##########
engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java:
##########
@@ -486,6 +488,39 @@ public void check() {
         }
     }
 
+    private void initDistributedLock() {
+        LOGGER.info("Setting up distributed lock table if not created.");
+        TransactionLegacy txn = TransactionLegacy.open("initDistributedLock");
+        txn.start();
+        String errorMessage = "Unable to get the database connections";
+        try {
+            Connection conn = txn.getConnection();
+            errorMessage = "Unable to create distributed_lock table in the 
'cloud' database ";
+            String sql = "CREATE TABLE IF NOT EXISTS 
`cloud`.`distributed_lock` (" +

Review Comment:
   The reason to do this way is because for the db schema to work which uses 
GLOBAL_LOCKs, this table must exist before schema path can be applied. I'm 
happy to refactor this if there is any other way to do this. By 
'delete/truncate' what do you mean?



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to