diff --git a/service/clickhouse/clickhouse_service.go b/service/clickhouse/clickhouse_service.go index c2abcbcc..0b215efb 100644 --- a/service/clickhouse/clickhouse_service.go +++ b/service/clickhouse/clickhouse_service.go @@ -882,7 +882,7 @@ func GetCkTableMetrics(conf *model.CKManClickHouseConfig, database string, cols func GetCKMerges(conf *model.CKManClickHouseConfig) ([]model.CKTableMerges, error) { var merges []model.CKTableMerges - query := "SELECT database, table, elapsed, num_parts, result_part_name, source_part_names, total_size_bytes_compressed, bytes_read_uncompressed, bytes_written_uncompressed, rows_read, memory_usage, merge_algorithm FROM system.merges" + query := "SELECT database, table, elapsed, progress, num_parts, result_part_name, source_part_names, total_size_bytes_compressed, bytes_read_uncompressed, bytes_written_uncompressed, rows_read, memory_usage, merge_algorithm FROM system.merges" log.Logger.Debug("query: %s", query) for _, host := range conf.Hosts { db, err := common.ConnectClickHouse(host, model.ClickHouseDefaultDB, conf.GetConnOption()) @@ -896,11 +896,11 @@ func GetCKMerges(conf *model.CKManClickHouseConfig) ([]model.CKTableMerges, erro for rows.Next() { var ( databse, table, result_part_name, merge_algorithm string - elapsed float64 + elapsed, progress float64 memory_usage, num_parts, total_size_bytes_compressed, bytes_written_uncompressed, bytes_read_uncompressed, rows_read uint64 source_part_names []string ) - err = rows.Scan(&databse, &table, &elapsed, &num_parts, &result_part_name, &source_part_names, &total_size_bytes_compressed, &bytes_read_uncompressed, &bytes_written_uncompressed, &rows_read, &memory_usage, &merge_algorithm) + err = rows.Scan(&databse, &table, &elapsed, &progress, &num_parts, &result_part_name, &source_part_names, &total_size_bytes_compressed, &bytes_read_uncompressed, &bytes_written_uncompressed, &rows_read, &memory_usage, &merge_algorithm) if err != nil { return merges, err } @@ -908,7 +908,8 @@ func GetCKMerges(conf *model.CKManClickHouseConfig) ([]model.CKTableMerges, erro Table: databse + "." + table, Host: host, Elapsed: elapsed, - MergeStart: time.Now().Add(time.Duration(elapsed) * (-1)), + MergeStart: time.Now().Add(time.Duration(elapsed*float64(time.Second)) * (-1)), + Progress: progress, NumParts: num_parts, ResultPartName: result_part_name, SourcePartNames: strings.Join(source_part_names, ","),