github-actions[bot] commented on code in PR #68603:
URL: https://github.com/apache/doris/pull/68603#discussion_r4129362337


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java:
##########
@@ -433,6 +445,42 @@ public void alterCatalogProps(String catalogName, 
Map<String, String> newPropert
         }
     }
 
+    /**
+     * Migrate legacy markers after fenced master replay, before accepting 
queries or starting checkpoints.
+     */
+    public void migrateVarbinaryMappingProperties() throws DdlException {
+        writeLock();
+        try {
+            for (CatalogIf catalog : idToCatalog.values()) {
+                if (!(catalog instanceof ExternalCatalog)) {
+                    continue;
+                }
+                ExternalCatalog externalCatalog = (ExternalCatalog) catalog;
+                Map<String, String> migratedProperties = Maps.newHashMap();
+                for (String marker : new String[] 
{CatalogProperty.ENABLE_MAPPING_VARBINARY,
+                        CatalogProperty.ENABLE_MAPPING_TIMESTAMP_TZ}) {
+                    if 
(!Boolean.parseBoolean(externalCatalog.getProperties().get(marker))) {
+                        migratedProperties.put(marker, "true");
+                    }
+                }
+                if (migratedProperties.isEmpty()) {
+                    continue;
+                }
+                CatalogLog log = new CatalogLog();
+                log.setCatalogId(catalog.getId());
+                log.setNewProps(migratedProperties);
+                // Use the existing ALTER format so running older followers 
can replay the change.
+                // Journal first: a failed write must leave the marker 
eligible for a retry.
+                
Env.getCurrentEnv().getEditLog().logCatalogLog(OperationType.OP_ALTER_CATALOG_PROPS,
 log);
+                // Migration must not revalidate unrelated legacy connection 
properties or contact
+                // the external system while the master is still becoming 
ready.

Review Comment:
   [P2] This migration already holds `CatalogMgr`'s write lock when it calls 
`replayAlterCatalogProps`. That method releases only its nested lock hold 
before running deferred access-controller cleanup, so an initialized catalog's 
owned `AuthorizationPlugin.close()` still runs under the outer global lock. A 
slow close stalls promotion and catalog operations; a close waiting for catalog 
work can deadlock. Collect the cleanup and run it after the outer migration 
lock is released.



-- 
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]

Reply via email to