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

Abierto
#197 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
go
Área
backend, data

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Go
Estrellas
1
Forks
1
Merge medio
11 min
PR fusionados (30 d)
5

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ConduitIO/conduit-processor-sdk

Todos los issues de ConduitIO/conduit-processor-sdk

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.