infer: adding a field to After only on an update with a Before image fails the record

Aperta
#197 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend, data

Direzione di ricerca

Start by tracing the default infer schema encoding for records with structured Before and After payloads; the issue does not name implementation files or tests. Reproduce with an Avro attached update where a top level field is added to After, then inspect how the inferred schema handles the missing field in Before. Done when the record encodes with the expected nullable field behavior or returns a clear error naming the field and remedy.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

On a record that has both a structured Before and After and carries a schema, a processor that adds a
top-level field to After only fails the record under the default infer strategy. This is the mirror of
the removal case fixed in v0.10.0 (#195). It is not a regression: v0.9.2 fails the same way.

Reproduce

An Avro-attached update (for example Postgres CDC with REPLICA IDENTITY FULL) with
Before = {id: 1, name: "a"} and After = {id: 1, name: "b"}. In Conduit, run any of these on it:

  • field.set on .Payload.After.added
  • field.rename on .Payload.After.name to full_name, After only
  • a custom.javascript that adds a property to After

Actual

The record fails. infer takes the schema from After, which now has the new field. Before lacks that
field, so encoding it fails with missing required field (in v0.10.0 the rename case reports
ErrFieldNotInSchema on the old name). Same result with and without a NULL flip, same on v0.9.2 and v0.10.0.

Expected

Either the added field is also made nullable in the inferred schema and Before encodes with the field null
(as the NULL-flip handling in #195 already does for fields nil on one side), or the record fails with a clear
error that names the field and the remedy (add it to Before too). The current message does not say which.

Notes

  • sdk.schema.encode.payload.strategy: extend does not help: it rejects a top-level difference between
    Before and After with ErrSchemaExtendMismatch.
  • Workaround: set the field on both parts (.Payload.Before.added and .Payload.After.added).
  • Anyone using field.set to stamp CDC updates hits this. Conduit processor probe results are in the Conduit
    PR bumping to v0.10.0.
Lingua principale
Go
Stelle
1
Fork
1
Merge medio
11m
PR unite (30g)
5

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ConduitIO/conduit-processor-sdk

Tutte le issue di ConduitIO/conduit-processor-sdk

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.