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/06/29 14:15:52 UTC

[GitHub] [doris] stalary commented on a diff in pull request #10471: [enhancement](proc) Support showing more details in show proc "/dbs"

stalary commented on code in PR #10471:
URL: https://github.com/apache/doris/pull/10471#discussion_r909687687


##########
fe/fe-core/src/test/java/org/apache/doris/common/proc/DbsProcDirTest.java:
##########
@@ -192,11 +191,12 @@ public void testFetchResultNormal() throws AnalysisException {
         Assert.assertNotNull(result);
         Assert.assertTrue(result instanceof BaseProcResult);
 
-        Assert.assertEquals(Lists.newArrayList("DbId", "DbName", "TableNum", "Quota", "LastConsistencyCheckTime", "ReplicaQuota"),
+        Assert.assertEquals(Lists.newArrayList("DbId", "DbName", "TableNum", "Size", "Quota",
+                    "LastConsistencyCheckTime", "ReplicaCount", "ReplicaQuota"),
                 result.getColumnNames());
         List<List<String>> rows = Lists.newArrayList();
-        rows.add(Arrays.asList(String.valueOf(db1.getId()), db1.getFullName(), "0", "1024.000 TB", FeConstants.null_string, "1073741824"));
-        rows.add(Arrays.asList(String.valueOf(db2.getId()), db2.getFullName(), "0", "1024.000 TB", FeConstants.null_string, "1073741824"));
+        rows.add(Arrays.asList(String.valueOf(db1.getId()), db1.getFullName(), "0", "0.000 ", "1024.000 TB", "\\N", "0", "1073741824"));

Review Comment:
   Why did you replace `FeConstants.null_string` here



##########
fe/fe-core/src/main/java/org/apache/doris/common/proc/DbsProcDir.java:
##########
@@ -90,33 +88,31 @@ public ProcResult fetchResult() throws AnalysisException {
         }
 
         // get info
-        List<List<Comparable>> dbInfos = new ArrayList<List<Comparable>>();
+        List<List<Comparable>> dbInfos = new ArrayList<>();
         for (String dbName : dbNames) {
             DatabaseIf db = catalog.getInternalDataSource().getDbNullable(dbName);
             if (db == null) {
                 continue;
             }
-            List<Comparable> dbInfo = new ArrayList<Comparable>();
+            List<Comparable> dbInfo = new ArrayList<>();
             db.readLock();
             try {
                 int tableNum = db.getTables().size();
                 dbInfo.add(db.getId());
                 dbInfo.add(dbName);
                 dbInfo.add(tableNum);
 
-                String readableQuota = FeConstants.null_string;
-                String lastCheckTime = FeConstants.null_string;
-                long replicaQuota = 0;
-                if (db instanceof Database) {
-                    long dataQuota = ((Database) db).getDataQuota();
-                    Pair<Double, String> quotaUnitPair = DebugUtil.getByteUint(dataQuota);
-                    readableQuota =
-                            DebugUtil.DECIMAL_FORMAT_SCALE_3.format(quotaUnitPair.first) + " " + quotaUnitPair.second;
-                    lastCheckTime = TimeUtils.longToTimeString(((Database) db).getLastCheckTime());
-                    replicaQuota = ((Database) db).getReplicaQuota();
-                }
+                long usedDataQuota = ((Database) db).getUsedDataQuotaWithLock();

Review Comment:
   Would it be better to declare a `Database = (Database) db` first?



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