Skip to content

Commit

Permalink
fix: missing progress in merges metric
Browse files Browse the repository at this point in the history
  • Loading branch information
YenchangChan committed Apr 8, 2024
1 parent cc09fe1 commit 0d6982f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions service/clickhouse/clickhouse_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -896,19 +896,20 @@ 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
}
merge := model.CKTableMerges{
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, ","),
Expand Down

0 comments on commit 0d6982f

Please sign in to comment.