spqr
spqr copied to clipboard
Wrong init_sql parsing
Describe the bug
The local log iterates over the file line by line, but it should iterate statement by statement.
To Reproduce
CREATE KEY RANGE uid_range_1
FROM 00000000-0000-0000-0000-000000000000
ROUTE TO shard1
FOR DISTRIBUTION uid_ds;
In the logs, you may see:
spqr-1 | {"level":"info","query":"CREATE KEY RANGE uid_range_1","time":"2025-01-30T08:30:11Z"}
spqr-1 | {"level":"error","error":"syntax error","time":"2025-01-30T08:30:11Z"}
spqr-1 | {"level":"error","error":"syntax error","time":"2025-01-30T08:30:11Z"}
spqr-1 | {"level":"info","query":"FROM 00000000-0000-0000-0000-000000000000","time":"2025-01-30T08:30:11Z"}
…
spqr-1 | {"level":"info","count":26,"filename":"/spqr-config/init.sql","time":"2025-01-30T08:30:11Z","message":"successfully init queries from
file"}
Expected behavior We should not fail on an incorrect init_sql format file, but we need to parse it by statements, not line endings.
This problem was partly fixed in #1011