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/28 09:14:56 UTC

[GitHub] [doris] caiconghui opened a new pull request, #10471: [enhancement](proc) Support showing more details in show proc "/dbs"

caiconghui opened a new pull request, #10471:
URL: https://github.com/apache/doris/pull/10471

   # Proposed changes
   
   Issue Number: close #10470 
   
   ## Problem Summary:
   
   Describe the overview of changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (Yes/No/I Don't know)
   2. Has unit tests been added: (Yes/No/No Need)
   3. Has document been added or modified: (Yes/No/No Need)
   4. Does it need to update dependencies: (Yes/No)
   5. Are there any changes that cannot be rolled back: (Yes/No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


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


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

Posted by GitBox <gi...@apache.org>.
caiconghui commented on code in PR #10471:
URL: https://github.com/apache/doris/pull/10471#discussion_r910552927


##########
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:
   I think both are ok. just keep same style with origin code.



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


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

Posted by GitBox <gi...@apache.org>.
stalary commented on code in PR #10471:
URL: https://github.com/apache/doris/pull/10471#discussion_r910555030


##########
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:
   Ok, no problem~



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


[GitHub] [doris] github-actions[bot] commented on pull request #10471: [enhancement](proc) Support showing more details in show proc "/dbs"

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10471:
URL: https://github.com/apache/doris/pull/10471#issuecomment-1170705497

   PR approved by anyone and no changes requested.


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


[GitHub] [doris] caiconghui merged pull request #10471: [enhancement](proc) Support showing more details in show proc "/dbs"

Posted by GitBox <gi...@apache.org>.
caiconghui merged PR #10471:
URL: https://github.com/apache/doris/pull/10471


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


[GitHub] [doris] github-actions[bot] commented on pull request #10471: [enhancement](proc) Support showing more details in show proc "/dbs"

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10471:
URL: https://github.com/apache/doris/pull/10471#issuecomment-1170705483

   PR approved by at least one committer and no changes requested.


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


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

Posted by GitBox <gi...@apache.org>.
caiconghui commented on code in PR #10471:
URL: https://github.com/apache/doris/pull/10471#discussion_r910553035


##########
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:
   fix



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


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

Posted by GitBox <gi...@apache.org>.
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