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

未关闭
#197 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
go
领域
backend, data

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.
主要语言
Go
星标
1
派生
1
平均合并
11 分钟
30 天内合并 PR
5

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ConduitIO/conduit-processor-sdk 的其他 Issue

查看 ConduitIO/conduit-processor-sdk 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。