Skip to content

sql-server: one broken database dir in the data dir fails every INFORMATION_SCHEMA query server-wide #11206

@seanmartinsmith

Description

@seanmartinsmith

a half-created database directory (has .dolt/ but no repo_state.json - e.g. a CREATE DATABASE interrupted by server shutdown) makes every INFORMATION_SCHEMA query against healthy databases on the same sql-server fail with Error 1105: open ...<dir>/.dolt/repo_state.json: The system cannot find the file specified. regular queries against the healthy DBs still work - it's specifically information_schema, which seems to eagerly open every dir in the data dir.

repro on dolt 2.1.6 (windows, also expect *nix):

mkdir srv && cd srv && mkdir good && (cd good && dolt init && dolt sql -q "create table t (i int primary key)")
mkdir -p broken/.dolt/noms && touch broken/.dolt/noms/LOCK
dolt sql-server --data-dir . --port 13311 &
dolt --host 127.0.0.1 --port 13311 --no-tls --use-db good sql -q "select count(*) from information_schema.columns where table_schema='good'"
# -> Error 1105 (HY000): open .../broken/.dolt/repo_state.json: The system cannot find the file specified.

hit in the wild: an interrupted create left such a dir in a multi-database data dir, and on the next server start every client that touches information_schema failed across all ~20 databases (the client app runs an information_schema check on connect, so it couldn't open anything). recovery was just moving the broken dir out of the data dir.

would expect the broken dir to be skipped (with a warning) rather than failing unrelated queries. happy to provide more detail or test a patch.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions