greptimedb
greptimedb copied to clipboard
System table in distribute mode
Background
In standalone mode, datanode creates system table and regions during it's first startup, and registers these tables to catalog.
But in distributed mode, all regions of system tables should be treated equally. For example , for system table scripts
, when frontend received a insert into scripts
request, it should forward the create request to all datanodes, instead of forwarding by partition rules.
Proposal
Frontend should be able to distinguish system table request. System table names should be retrived from metasrv.
For insert request, system table insert requests should bypass current writer splitter logic and forward to all datanodes. https://github.com/GreptimeTeam/greptimedb/blob/5abff7a536ece42cbe53e96c4205b9625e923a49/src/frontend/src/spliter.rs#L19
For query requests, we should implement a SystemTableScan
exec plan that forwards request to all datanodes.
API change
Not applicable.
Maybe we can create another table implementation in frontend just for system table? The new table implementation act as a "fan-out" adapter to its designated tables, and loop through them upon writing and reading.
Maybe we can create another table implementation in frontend just for system table? The new table implementation act as a "fan-out" adapter to its designated tables, and loop through them upon writing and reading.
I think it's more like a specialized physical plan that scans all regions (from all datanodes), maybe we should add a optimize rule for this.