source: snapshot key and table checks look tables up by name only, so a same-name table in another schema breaks the start
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
Direzione di ricerca
Start in source/snapshot/fetch_worker.go and trace validateKey and validateTable, then read the existing table lookup paths that use regclass and search_path. Add a regression test with same-name tables in two schemas and different key types, running it with search_path set to each schema. Done means both checks resolve the configured table consistently with the snapshot query.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
In the snapshot fetch worker (source/snapshot/fetch_worker.go, v0.21.0 and v0.21.1), two checks find a configured table by its bare name in the catalog. Neither uses a namespace or search_path:
validateKeyreads the key column's type with
SELECT a.atttypid::regtype FROM pg_class c JOIN pg_attribute a ON c.oid = a.attrelid WHERE c.relkind = 'r' AND a.attname = $1 AND c.relname = $2.
When several schemas have a table with that name, it takes whichever row comes first.validateTablechecksSELECT EXISTS(SELECT tablename FROM pg_tables WHERE tablename=$1). That passes when any schema has the name.
Every other lookup resolves the configured name through the connection's search_path: the primary-key lookups ($1::regclass), the snapshot query, the OID lookup and the publication (FOR TABLE "<name>"). The checks can therefore inspect a different table from the one the source reads.
Reproduction
Postgres 16, tables: items, url with search_path=inventory:
CREATE SCHEMA inventory;
CREATE TABLE inventory.items (id bigint PRIMARY KEY);
CREATE TABLE public.items (id text PRIMARY KEY);
- The source refuses to start with
key "id" of type "text" is unsupported. It checkedpublic.items, but the table it reads isinventory.items. - With the types swapped (
inventory.itemstext,public.itemsbigint), validation passes. The snapshot then fails onCOALESCE(max("id"), 0)with SQLSTATE 42804.
Both failures are loud, so no record is lost or misread. But a correctly configured pipeline cannot start, and the error names the wrong table's column type.
Why it matters now
The source supports only bare tables entries (schema-qualified names are #277). Reading a table outside public therefore means setting search_path in url. conduit migrate kafka-connect now does exactly that for a Debezium table.include.list in one schema (ConduitIO/conduit#3350). Any database that has the same table name in another schema hits this bug.
Fix
Resolve the table the same way as everywhere else. In validateKey, join on c.oid = $2::regclass with internal.WrapSQLIdent(table) instead of c.relname = $2. In validateTable, use to_regclass($1) IS NOT NULL with the wrapped identifier instead of searching pg_tables by name. Add a regression test with a same-name table in two schemas whose key columns have different types. Run it once with search_path pointing at each schema.
- Lingua principale
- Go
- Stelle
- 20
- Fork
- 12
- Merge medio
- 9h 50m
- PR unite (30g)
- 29
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ConduitIO/conduit-connector-postgres
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
ConduitIO/conduit-connector-postgres#491 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ConduitIO/conduit-connector-postgres#449 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ConduitIO/conduit-connector-postgres#417 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ConduitIO/conduit-connector-postgres#340 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
ConduitIO/conduit-connector-postgres#461 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ConduitIO/conduit-connector-postgres
Issue simili
-
P3 tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
kind/feature needs-triage priority/unprioritized
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
NVIDIA/k8s-test-infra#1504 ·
I maintainer di solito rispondono entro 1 giorno
-
Area/Infrastructure Aspect/Infra Resources Type/Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
wso2/agent-manager#2717 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
open-policy-agent/opa#9685 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno