spqr icon indicating copy to clipboard operation
spqr copied to clipboard

Wrong init_sql parsing

Open Denchick opened this issue 11 months ago • 1 comments

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.

Denchick avatar Jan 30 '25 11:01 Denchick

This problem was partly fixed in #1011

Denchick avatar Feb 17 '25 10:02 Denchick