You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/12/19 02:15:30 UTC

[GitHub] [doris] AshinGau commented on a diff in pull request #14978: [refactor](resource) use resource to create external catalog

AshinGau commented on code in PR #14978:
URL: https://github.com/apache/doris/pull/14978#discussion_r1051739236


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Resource.java:
##########
@@ -78,6 +107,26 @@ public static Resource fromStmt(CreateResourceStmt stmt) throws DdlException {
         return resource;
     }
 
+    public synchronized boolean removeReference(String referenceName, ReferenceType type) {
+        String fullName = referenceName + REFERENCE_SPLIT + type.name();
+        if (references.remove(fullName) != null) {
+            LOG.info("Reference(type={}, name={}) is removed from resource {}, current set: {}",
+                    type, referenceName, name, references);
+            return true;
+        }
+        return false;
+    }
+
+    public synchronized boolean addReference(String referenceName, ReferenceType type) throws AnalysisException {

Review Comment:
   Different statements may require different parameters even when using the same resource, so some checks are added in `addReference`.



-- 
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-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org