Skip to content

discovery: warn when a table publishes with an empty DDL #558

Description

@EricAndrechek

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

  1. In attachDDL, log a warning naming the table when a schema entry gets no
    create_table_query, so it is visible without a debugger.
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions