|
| 1 | +# Issue 03: Extract Shared Backend And Shard Configuration Parsing |
| 2 | + |
| 3 | +## Priority |
| 4 | + |
| 5 | +`P1` |
| 6 | + |
| 7 | +## Status |
| 8 | + |
| 9 | +Implemented in the current working tree. |
| 10 | + |
| 11 | +## Problem |
| 12 | + |
| 13 | +Backend URL parsing and shard spec parsing are duplicated across multiple tools. The code paths are intended to stay aligned, but they are maintained by copy-paste. |
| 14 | + |
| 15 | +## Evidence |
| 16 | + |
| 17 | +- [tools/sqlengine.cpp](/data/rene/ParserSQL/tools/sqlengine.cpp:203) |
| 18 | +- [tools/mysql_server.cpp](/data/rene/ParserSQL/tools/mysql_server.cpp:65) |
| 19 | +- [tools/bench_distributed.cpp](/data/rene/ParserSQL/tools/bench_distributed.cpp:51) |
| 20 | +- [tools/engine_stress_test.cpp](/data/rene/ParserSQL/tools/engine_stress_test.cpp:53) |
| 21 | + |
| 22 | +## Risk |
| 23 | + |
| 24 | +- Tool behavior diverges over time |
| 25 | +- SSL, naming, or shard parsing bugs are fixed in one entry point but not others |
| 26 | +- Extra friction for integration testing and documentation |
| 27 | + |
| 28 | +## Desired Outcome |
| 29 | + |
| 30 | +One shared parser for backend URLs and shard specs, reused by all tool entry points and test helpers. |
| 31 | + |
| 32 | +## Scope |
| 33 | + |
| 34 | +- Extract reusable parsing helpers |
| 35 | +- Update all current tool entry points to use the shared code |
| 36 | +- Add focused unit tests for parsing behavior |
| 37 | + |
| 38 | +## Acceptance Criteria |
| 39 | + |
| 40 | +- No copy-pasted backend/shard parsing remains across tool binaries |
| 41 | +- Existing CLI behavior is preserved |
| 42 | +- Parsing behavior is covered by direct tests |
| 43 | + |
| 44 | +## Resolution Notes |
| 45 | + |
| 46 | +- Added a shared parser interface in `include/sql_engine/tool_config_parser.h`. |
| 47 | +- Implemented shared backend URL and shard spec parsing in `src/sql_engine/tool_config_parser.cpp`. |
| 48 | +- Updated `sqlengine`, `mysql_server`, `bench_distributed`, and `engine_stress_test` to use the shared parser instead of local copies. |
| 49 | +- Switched `tests/test_ssl_config.cpp` to hit the shared parser directly and added shard parsing coverage. |
| 50 | + |
| 51 | +## Verification |
| 52 | + |
| 53 | +- `make run_tests && ./run_tests --gtest_filter="SSLConfigTest.*" --gtest_brief=1` |
| 54 | +- `make build-sqlengine bench-distributed engine-stress mysql-server` |
| 55 | +- `./run_tests --gtest_brief=1` |
0 commit comments