JackDrogon commented on code in PR #25943:
URL: https://github.com/apache/doris/pull/25943#discussion_r1372810211


##########
fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java:
##########
@@ -3331,4 +3338,174 @@ public TCreatePartitionResult 
createPartition(TCreatePartitionRequest request) t
         LOG.debug("send create partition result: {}", result);
         return result;
     }
+
+    public TGetMetaResult getMeta(TGetMetaRequest request) throws TException {
+        String clientAddr = getClientAddrAsString();
+        LOG.debug("receive get meta request: {}", request);
+
+        TGetMetaResult result = new TGetMetaResult();
+        TStatus status = new TStatus(TStatusCode.OK);
+        result.setStatus(status);
+        try {
+            result = getMetaImpl(request, clientAddr);
+        } catch (UserException e) {
+            LOG.warn("failed to get meta: {}", e.getMessage());
+            status.setStatusCode(TStatusCode.ANALYSIS_ERROR);
+            status.addToErrorMsgs(e.getMessage());
+        } catch (Throwable e) {
+            LOG.warn("catch unknown result.", e);
+            status.setStatusCode(TStatusCode.INTERNAL_ERROR);
+            status.addToErrorMsgs(Strings.nullToEmpty(e.getMessage()));
+            return result;
+        }
+        return result;
+    }
+
+    private TGetMetaResult getMetaImpl(TGetMetaRequest request, String 
clientIp)
+            throws Exception {
+        //  Step 1: check fields
+        if (!request.isSetUser()) {
+            throw new UserException("user is not set");
+        }
+        if (!request.isSetPasswd()) {
+            throw new UserException("passwd is not set");
+        }
+        if (!request.isSetDb()) {
+            throw new UserException("db is not set");
+        }
+
+        // Step 2: check auth
+        TGetMetaResult result = new TGetMetaResult();
+        result.setStatus(new TStatus(TStatusCode.OK));
+        Database db = null;
+        List<Table> tables = null;
+
+        String cluster = request.getCluster();
+        if (Strings.isNullOrEmpty(cluster)) {
+            cluster = SystemInfoService.DEFAULT_CLUSTER;
+        }
+        if (Strings.isNullOrEmpty(request.getToken())) {
+            TGetMetaDB getMetaDb = request.getDb();
+
+            if (getMetaDb.isSetId()) {
+                db = 
Env.getCurrentInternalCatalog().getDbNullable(getMetaDb.getId());
+            } else if (getMetaDb.isSetName()) {
+                db = 
Env.getCurrentInternalCatalog().getDbNullable(getMetaDb.getName());
+            }
+
+            if (db == null) {
+                LOG.warn("db not found {}", getMetaDb);
+                return result;

Review Comment:
   Yes, syncer will check not get this



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