Skip to content

Commit

Permalink
changefeedccl: Envelope schema name reflects schema config
Browse files Browse the repository at this point in the history
Fixes a bug where the Avro -envelope schema name, as opposed to subject,
 did not honor the schema prefix and full table name options.

Release note (bug fix): Envelope schema in avro registry now honors schema_prefix and full_table_name
  • Loading branch information
HonoreDB committed Feb 22, 2021
1 parent bc98209 commit b6ebdc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func (e *confluentAvroEncoder) EncodeValue(ctx context.Context, row encodeRow) (
}

opts := avroEnvelopeOpts{afterField: true, beforeField: e.beforeField, updatedField: e.updatedField}
registered.schema, err = envelopeToAvroSchema(row.tableDesc.GetName(), opts, beforeDataSchema, afterDataSchema)
registered.schema, err = envelopeToAvroSchema(e.rawTableName(row.tableDesc), opts, beforeDataSchema, afterDataSchema)
if err != nil {
return nil, err
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/ccl/changefeedccl/encoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ func TestAvroSchemaNaming(t *testing.T) {
`supermovr.public.drivers-key`,
`supermovr.public.drivers-value`,
})

//Both changes to the subject are also reflected in the schema name in the posted schemas
require.Contains(t, reg.mu.schemas[reg.mu.subjects[`supermovr.public.drivers-key`]], `supermovr`)
require.Contains(t, reg.mu.schemas[reg.mu.subjects[`supermovr.public.drivers-value`]], `supermovr`)
}

t.Run(`enterprise`, enterpriseTest(testFn))
Expand Down

0 comments on commit b6ebdc6

Please sign in to comment.