GreptimeTeam / greptimedb

An open-source, cloud-native, unified time series database for metrics, logs and events with SQL/PromQL supported. Available on GreptimeCloud.
https://greptime.com/
Apache License 2.0
4.36k stars 315 forks source link

Column <column_name> already exists when querying a metric #4978

Closed 0neSe7en closed 1 week ago

0neSe7en commented 1 week ago

What type of bug is this?

Data corruption, Unexpected error

What subsystems are affected?

Standalone mode, Query Engine

Minimal reproduce step

I sent the metrics via Prometheus remote write. it's working at first, but after a while getting Column <column_name> already exists error.

select greptime_value from test_metrics;  -- got {"code":3001,"error":"Column ap_mac already exists","execution_time_ms":1}

-- I retrieved the table id
SELECT * FROM "tables" where "table_name" == 'test_metrics';
-- and query from greptime_physical_table directly
select * from greptime_physical_table where __table_id == 1898 order by greptime_timestamp desc limit 10; -- working

I have 284 metrics, and two of them are getting this error

What did you expect to see?

the rows

What did you see instead?

Column ap_mac already exists

What operating system did you use?

Debian 11 Docker 27.3.1

What version of GreptimeDB did you use?

0.9.5

Relevant log output and stack trace

greptime-1  | 2024-11-12T11:40:24.066803Z ERROR sql{protocol="http" request_type="sql"}: servers::http::error_result: Failed to handle HTTP request err=0: , at src/common/recordbatch/src/adapter.rs:291:55
greptime-1  | 1: External(0: External error, at src/query/src/dist_plan/merge_scan.rs:235:22
greptime-1  | 1: Region query error, at src/frontend/src/instance/region_query.rs:52:14
greptime-1  | 2: Failed to query, at src/frontend/src/instance/region_query.rs:73:14
greptime-1  | 3: External error, at src/frontend/src/instance/standalone.rs:106:14
greptime-1  | 4: Failed to execute logical plan, at /greptimedb/src/datanode/src/region_server.rs:177:14
greptime-1  | 5: Failed to get metadata from engine metric for region_id 8151847927808(1898, 0), at src/query/src/dummy_catalog.rs:251:18
greptime-1  | 6: Invalid region metadata, at src/metric-engine/src/engine/read.rs:247:14
greptime-1  | 7: Invalid schema, at src/store-api/src/metadata.rs:644:63
greptime-1  | 8: Column ap_mac already exists, at src/datatypes/src/schema.rs:270:9)
WenyXu commented 1 week ago

Thanks, it's a known issue, and it will be fixed in #4972

waynexia commented 1 week ago

Closed by #4792