-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DBZ-6967: Handle bytea target field in in Postgres dialect #36
Conversation
Hi @bpaquet Thanks for the contribution. Maybe there is a better way to resolve it. Please have a look to |
Hi @mfvitale @bpaquet |
thx @harveyyue and @mfvitale . I do not have a strong opinion on patch location. I put it in PG Dialect to avoid side effect I can not test. If we want to do this for all dialect, the best place is probably to override bind in ConnectBytesType. Are you okay for this? |
Yes, |
2e0595d
to
5b3f20a
Compare
@mfvitale done. I also added an Intergation test |
getSink().execute(String.format(sql, destinationTable)); | ||
|
||
consume(createRecord); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should assert that the type is correctly store on table. Have a look to other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Should the test be valid also for other database? Maybe you can add it to |
@mfvitale @bpaquet Guys, jdbc sink will use [2023-09-29 10:38:17,776] INFO [debezium_avro_jdbc_sink|task-0] Type replaced [BYTES]: io.debezium.connector.jdbc.type.connect.ConnectBytesType -> io.debezium.connector.jdbc.dialect.mysql.BytesType (io.debezium.connector.jdbc.dialect.GeneralDatabaseDialect:609) |
Hi @bpaquet, thanks for your contribution. Please prefix the commit message(s) with the DBZ-xxx JIRA issue key. |
There is no test at the moment in this file. Do you think I should move it here? |
1b301e5
to
2a76c38
Compare
That's precisely why I originialy added the fix in PG Dialect. Waiting for @mfvitale opinion here :) |
As a general advice, if the behavior is common to other databases the fix should be applied also to the others. This means that also the tests should run for the databases impacted by the issue. Since this is an insert problem you can move the test to For others databases there is a dedicated |
In fact this test is specific to postgres because the |
In this case the test is in the right place. Instead for the code change I think it should go in a dedicated |
2a76c38
to
b452f76
Compare
Done @mfvitale |
|
||
import java.nio.ByteBuffer; | ||
|
||
public class ConnectBytesTypePostgres extends ConnectBytesType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll suggest to rename it to BytesType
and extend AbstractType
to be uniform of what already done for others database (i.e MySQL).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
b452f76
to
0c1fa6e
Compare
0c1fa6e
to
77fa935
Compare
@mfvitale are we good to go ? :) |
I'm not sure this is the good way to fix it, but it works :)
With this fix, the connector is able to write into bytea field. Without, it failed with the following stack: