greptimedb
greptimedb copied to clipboard
value_indices is empty in distributed mode
Investigation:
- This only occurs under distributed mode. Standalone cannot reproduce it
- The error that says "table" not found in the field position is an wrong error text (I placed the wrong variable in
fmt
). - The root cause is table info returns wrong table meta. Detailed below
Create table SQL:
CREATE TABLE IF NOT EXISTS host_load2 (
ts TIMESTAMP(3) NOT NULL,
collector STRING NULL,
host STRING NULL,
val DOUBLE NULL,
TIME INDEX (ts),
PRIMARY KEY (collector, host)
);
Query:
tql eval(0, 10, '5s') host_load1{__field__="val"};
Table meta:
table meta: TableMeta { schema: Schema { column_schemas: [ColumnSchema { name: "ts", data_type: Timestamp(Millisecond(TimestampMillisecondType)), is_nullable: false, is_time_index: true, default_constraint: None, metadata: {"greptime:time_index": "true"} }, ColumnSchema { name: "collector", data_type: String(StringType), is_nullable: true, is_time_index: false, default_constraint: None, metadata: {} }, ColumnSchema { name: "host", data_type: String(StringType), is_nullable: true, is_time_index: false, default_constraint: None, metadata: {} }, ColumnSchema { name: "val", data_type: Float64(Float64Type), is_nullable: true, is_time_index: false, default_constraint: None, metadata: {} }], name_to_index: {"ts": 0, "host": 2, "collector": 1, "val": 3}, arrow_schema: Schema { fields: [Field { name: "ts", data_type: Timestamp(Millisecond, None), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {"greptime:time_index": "true"} }, Field { name: "collector", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "host", data_type: Utf8, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "val", data_type: Float64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {"greptime:version": "0"} }, timestamp_index: Some(0), version: 0 }, primary_key_indices: [1, 2], value_indices: [], engine: "mito", region_numbers: [], next_column_id: 4, engine_options: {}, options: TableOptions { write_buffer_size: None, ttl: None, extra_options: {} }, created_on: 1970-01-01T00:00:00Z }
Notice that the value_indices
is empty
But DESC TABLE
's result is correct:
MySQL [(none)]> desc table host_load1;
+-----------+----------------------+------+---------+---------------+
| Field | Type | Null | Default | Semantic Type |
+-----------+----------------------+------+---------+---------------+
| ts | TimestampMillisecond | NO | | TIME INDEX |
| collector | String | YES | | PRIMARY KEY |
| host | String | YES | | PRIMARY KEY |
| val | Float64 | YES | | FIELD |
+-----------+----------------------+------+---------+---------------+
Originally posted by @waynexia in https://github.com/GreptimeTeam/greptimedb/issues/1779#issuecomment-1598907079
@waynexia @WenyXu @MichaelScofield Can we reproduce this issue?
In distributed mode, the value_indices
in the table info that stored in etcd is indeed empty. However, the manifests of the table info are both correct either in standalone mode or in the distributed mode's datanode. The query result in the comment above are same, too. I don't think this is a critical bug, we can delay fixing it until major features in region server is done.
Is it fixed? @MichaelScofield @waynexia
Just checked the recent version of greptimedb cluster, the query seems fine:
mysql> CREATE TABLE IF NOT EXISTS host_load2 (
-> ts TIMESTAMP(3) NOT NULL,
-> collector STRING NULL,
-> host STRING NULL,
-> val DOUBLE NULL,
-> TIME INDEX (ts),
-> PRIMARY KEY (collector, host)
-> );
Query OK, 0 rows affected (0.05 sec)
mysql> tql eval(0, 10, '5s') host_load2{__field__="val"};
Empty set (0.05 sec)
So I'm gonna close this issue.