What
discovery.attachDDL joins system.tables.create_table_query onto the schema it
built from system.columns. A table that appears in system.columns but not in
system.tables publishes with DDL == "" — no log line, no counter, nothing an
operator could notice.
Why it matters
Today DDL has no reader, so an empty value is inert. It stops being inert as
soon as the chtypes layer wires up: an empty DDL there is indistinguishable
from "this table has no engine information", and the natural coding of that is
to skip the table's type checks rather than fail. That is a fail-open shape,
and it would be introduced by a caller that never sees the gap.
The two queries are separate round trips (see the comment in refresh), so the
window is real even on a healthy server: a table dropped between them lands in
exactly this state.
Ask
- In
attachDDL, log a warning naming the table when a schema entry gets no
create_table_query, so it is visible without a debugger.
- When chtypes starts reading
DDL, treat empty as an error for that
table — never as "no engine info".
Item (1) is the cheap half and belongs in internal/discovery. Item (2) is a
constraint on the consumer, recorded here so it is not rediscovered late.
Provenance
Raised in the chtypes-side review of the #549–#555 stack. Deliberately not
folded into #550, which was green and under human review at the time.
What
discovery.attachDDLjoinssystem.tables.create_table_queryonto the schema itbuilt from
system.columns. A table that appears insystem.columnsbut not insystem.tablespublishes withDDL == ""— no log line, no counter, nothing anoperator could notice.
Why it matters
Today
DDLhas no reader, so an empty value is inert. It stops being inert assoon as the chtypes layer wires up: an empty
DDLthere is indistinguishablefrom "this table has no engine information", and the natural coding of that is
to skip the table's type checks rather than fail. That is a fail-open shape,
and it would be introduced by a caller that never sees the gap.
The two queries are separate round trips (see the comment in
refresh), so thewindow is real even on a healthy server: a table dropped between them lands in
exactly this state.
Ask
attachDDL, log a warning naming the table when a schema entry gets nocreate_table_query, so it is visible without a debugger.DDL, treat empty as an error for thattable — never as "no engine info".
Item (1) is the cheap half and belongs in
internal/discovery. Item (2) is aconstraint on the consumer, recorded here so it is not rediscovered late.
Provenance
Raised in the chtypes-side review of the #549–#555 stack. Deliberately not
folded into #550, which was green and under human review at the time.