This is an automated email from the ASF dual-hosted git repository.

cwylie pushed a commit to branch 0.16.0-incubating
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/0.16.0-incubating by this push:
     new 40f1450  Web console: fix task log tailing (#8434) (#8437)
40f1450 is described below

commit 40f14505fb20b1e22d23885417a1c297f6fc0592
Author: Clint Wylie <[email protected]>
AuthorDate: Thu Aug 29 18:35:22 2019 -0700

    Web console: fix task log tailing (#8434) (#8437)
    
    * fix log tailing
    
    * update snapshots
---
 web-console/src/components/show-log/show-log.tsx   |  9 +++-
 .../__snapshots__/datasource-view.spec.tsx.snap    | 23 ++++++---
 .../src/views/datasource-view/datasource-view.tsx  | 54 ++++++++++++++--------
 3 files changed, 60 insertions(+), 26 deletions(-)

diff --git a/web-console/src/components/show-log/show-log.tsx 
b/web-console/src/components/show-log/show-log.tsx
index 2467340..f66de9f 100644
--- a/web-console/src/components/show-log/show-log.tsx
+++ b/web-console/src/components/show-log/show-log.tsx
@@ -75,6 +75,13 @@ export class ShowLog extends 
React.PureComponent<ShowLogProps, ShowLogState> {
         return logValue;
       },
       onStateChange: ({ result, loading, error }) => {
+        const { tail } = this.state;
+        if (result && tail) {
+          const { current } = this.log;
+          if (current) {
+            current.scrollTop = current.scrollHeight;
+          }
+        }
         this.setState({
           logValue: result,
           loading,
@@ -101,7 +108,7 @@ export class ShowLog extends 
React.PureComponent<ShowLogProps, ShowLogState> {
   addTailer() {
     if (this.interval) return;
     this.interval = Number(
-      setInterval(() => this.showLogQueryManager.runQuery(null), 
ShowLog.CHECK_INTERVAL),
+      setInterval(() => this.showLogQueryManager.rerunLastQuery(true), 
ShowLog.CHECK_INTERVAL),
     );
   }
 
diff --git 
a/web-console/src/views/datasource-view/__snapshots__/datasource-view.spec.tsx.snap
 
b/web-console/src/views/datasource-view/__snapshots__/datasource-view.spec.tsx.snap
index 823be97..eecaefb 100755
--- 
a/web-console/src/views/datasource-view/__snapshots__/datasource-view.spec.tsx.snap
+++ 
b/web-console/src/views/datasource-view/__snapshots__/datasource-view.spec.tsx.snap
@@ -65,9 +65,10 @@ exports[`data source view matches snapshot 1`] = `
           "Availability",
           "Segment load/drop",
           "Retention",
-          "Compaction",
-          "Size",
           "Replicated size",
+          "Size",
+          "Compaction",
+          "Avg. segment size",
           "Num rows",
           "Actions",
         ]
@@ -167,11 +168,11 @@ exports[`data source view matches snapshot 1`] = `
         },
         Object {
           "Cell": [Function],
-          "Header": "Compaction",
-          "accessor": [Function],
+          "Header": "Replicated size",
+          "accessor": "replicated_size",
           "filterable": false,
-          "id": "compaction",
           "show": true,
+          "width": 100,
         },
         Object {
           "Cell": [Function],
@@ -183,8 +184,16 @@ exports[`data source view matches snapshot 1`] = `
         },
         Object {
           "Cell": [Function],
-          "Header": "Replicated size",
-          "accessor": "replicated_size",
+          "Header": "Compaction",
+          "accessor": [Function],
+          "filterable": false,
+          "id": "compaction",
+          "show": true,
+        },
+        Object {
+          "Cell": [Function],
+          "Header": "Avg. segment size",
+          "accessor": "avg_segment_size",
           "filterable": false,
           "show": true,
           "width": 100,
diff --git a/web-console/src/views/datasource-view/datasource-view.tsx 
b/web-console/src/views/datasource-view/datasource-view.tsx
index 08a851c..b8aa885 100644
--- a/web-console/src/views/datasource-view/datasource-view.tsx
+++ b/web-console/src/views/datasource-view/datasource-view.tsx
@@ -69,9 +69,10 @@ const tableColumns: string[] = [
   'Availability',
   'Segment load/drop',
   'Retention',
-  'Compaction',
-  'Size',
   'Replicated size',
+  'Size',
+  'Compaction',
+  'Avg. segment size',
   'Num rows',
   ActionCell.COLUMN_LABEL,
 ];
@@ -80,8 +81,9 @@ const tableColumnsNoSql: string[] = [
   'Availability',
   'Segment load/drop',
   'Retention',
-  'Compaction',
   'Size',
+  'Compaction',
+  'Avg. segment size',
   ActionCell.COLUMN_LABEL,
 ];
 
@@ -108,8 +110,9 @@ interface DatasourceQueryResultRow {
   num_available_segments: number;
   num_segments_to_load: number;
   num_segments_to_drop: number;
-  size: number;
   replicated_size: number;
+  size: number;
+  avg_segment_size: number;
   num_rows: number;
 }
 
@@ -171,8 +174,12 @@ export class DatasourcesView extends React.PureComponent<
   COUNT(*) FILTER (WHERE is_available = 1 AND ((is_published = 1 AND 
is_overshadowed = 0) OR is_realtime = 1)) AS num_available_segments,
   COUNT(*) FILTER (WHERE is_published = 1 AND is_overshadowed = 0 AND 
is_available = 0) AS num_segments_to_load,
   COUNT(*) FILTER (WHERE is_available = 1 AND NOT ((is_published = 1 AND 
is_overshadowed = 0) OR is_realtime = 1)) AS num_segments_to_drop,
-  SUM("size") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR 
is_realtime = 1) AS size,
   SUM("size" * "num_replicas") FILTER (WHERE (is_published = 1 AND 
is_overshadowed = 0) OR is_realtime = 1) AS replicated_size,
+  SUM("size") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR 
is_realtime = 1) AS size,
+  (
+    SUM("size") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR 
is_realtime = 1) /
+    COUNT(*) FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR 
is_realtime = 1)
+  ) AS avg_segment_size,
   SUM("num_rows") FILTER (WHERE (is_published = 1 AND is_overshadowed = 0) OR 
is_realtime = 1) AS num_rows
 FROM sys.segments
 GROUP BY 1`;
@@ -231,16 +238,19 @@ GROUP BY 1`;
           const loadstatus = loadstatusResp.data;
           datasources = datasourcesResp.data.map(
             (d: any): DatasourceQueryResultRow => {
+              const size = deepGet(d, 'properties.segments.size') || -1;
               const segmentsToLoad = Number(loadstatus[d.name] || 0);
               const availableSegments = Number(deepGet(d, 
'properties.segments.count'));
+              const numSegments = availableSegments + segmentsToLoad;
               return {
                 datasource: d.name,
                 num_available_segments: availableSegments,
-                num_segments: availableSegments + segmentsToLoad,
+                num_segments: numSegments,
                 num_segments_to_load: segmentsToLoad,
                 num_segments_to_drop: 0,
-                size: d.properties.segments.size,
                 replicated_size: -1,
+                size,
+                avg_segment_size: size / numSegments,
                 num_rows: -1,
               };
             },
@@ -840,6 +850,22 @@ GROUP BY 1`;
               show: hiddenColumns.exists('Retention'),
             },
             {
+              Header: 'Replicated size',
+              accessor: 'replicated_size',
+              filterable: false,
+              width: 100,
+              Cell: row => formatBytes(row.value),
+              show: hiddenColumns.exists('Replicated size'),
+            },
+            {
+              Header: 'Size',
+              accessor: 'size',
+              filterable: false,
+              width: 100,
+              Cell: row => formatBytes(row.value),
+              show: hiddenColumns.exists('Size'),
+            },
+            {
               Header: 'Compaction',
               id: 'compaction',
               accessor: row => Boolean(row.compaction),
@@ -878,20 +904,12 @@ GROUP BY 1`;
               show: hiddenColumns.exists('Compaction'),
             },
             {
-              Header: 'Size',
-              accessor: 'size',
-              filterable: false,
-              width: 100,
-              Cell: row => formatBytes(row.value),
-              show: hiddenColumns.exists('Size'),
-            },
-            {
-              Header: 'Replicated size',
-              accessor: 'replicated_size',
+              Header: 'Avg. segment size',
+              accessor: 'avg_segment_size',
               filterable: false,
               width: 100,
               Cell: row => formatBytes(row.value),
-              show: hiddenColumns.exists('Replicated size'),
+              show: hiddenColumns.exists('Avg. segment size'),
             },
             {
               Header: 'Num rows',


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to