Web console: fix task log tailing (#8434)

* fix log tailing

* update snapshots
This commit is contained in:
Vadim Ogievetsky 2019-08-29 14:15:06 -07:00 committed by Fangjin Yang
parent beed07022a
commit f55e1be80b
3 changed files with 60 additions and 26 deletions

View File

@ -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),
);
}

View File

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

View File

@ -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,
};
},
@ -839,6 +849,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',
@ -878,20 +904,12 @@ GROUP BY 1`;
show: hiddenColumns.exists('Compaction'),
},
{
Header: 'Size',
accessor: 'size',
Header: 'Avg. segment size',
accessor: 'avg_segment_size',
filterable: false,
width: 100,
Cell: row => formatBytes(row.value),
show: hiddenColumns.exists('Size'),
},
{
Header: 'Replicated size',
accessor: 'replicated_size',
filterable: false,
width: 100,
Cell: row => formatBytes(row.value),
show: hiddenColumns.exists('Replicated size'),
show: hiddenColumns.exists('Avg. segment size'),
},
{
Header: 'Num rows',