Skip to content
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

Bug Report: ENUM filters do not work properly with Materialize #15598

Closed
mattlord opened this issue Mar 30, 2024 · 0 comments · Fixed by #15723
Closed

Bug Report: ENUM filters do not work properly with Materialize #15598

mattlord opened this issue Mar 30, 2024 · 0 comments · Fixed by #15723

Comments

@mattlord
Copy link
Contributor

mattlord commented Mar 30, 2024

Overview of the Issue

ENUM filtering does not work correctly with Materialize. It's affected by one issue not shown in the test case as well:

  • vstreamer does the filtering on the source side
  • during the copy phase the value the vstreamer gets from the select statement is the string value for the ENUM
  • during the replication phase the value the vstreamer gets from the binlog event is the ordinal value for the ENUM

Reproduction Steps

git checkout main && make build

pushd examples/local

./101_initial_cluster.sh; mysql < ../common/insert_commerce_data.sql

vtctldclient ApplySchema --sql "alter table customer add typ enum('individual','soho','enterprise') default 'individual'"  commerce

mysql -e "insert into customer values (100, 'mlord@planetscale.com', 'enterprise')"

vtctldclient Materialize --workflow enterprise_customers --target-keyspace commerce create --source-keyspace commerce --table-settings "
[
    {
      \"target_table\": \"enterprise_customers\",
      \"source_expression\": \"select customer_id, email from customer where typ = 'enterprise'\",
      \"create_ddl\": \"create table enterprise_customers (customer_id bigint unsigned, email varchar(128))\"
    }
]
"

sleep 10

mysql -e "insert into customer values (101, 'mlord2@planetscale.com', 'enterprise'), (200, 'mattalord@gmail.com', 'soho')"

mysql -e "select * from enterprise_customers"

./401_teardown.sh

popd

You'll see that all of the rows are getting copied:

+-------------+------------------------+
| customer_id | email                  |
+-------------+------------------------+
|           1 | alice@domain.com       |
|           2 | bob@domain.com         |
|           3 | charlie@domain.com     |
|           4 | dan@domain.com         |
|           5 | eve@domain.com         |
|         100 | mlord@planetscale.com  |
|         101 | mlord2@planetscale.com |
+-------------+------------------------+

Binary Version

❯ vtgate --version
vtgate version Version: 20.0.0-SNAPSHOT (Git revision cf4cc2ec744d8956fd71287fd350bfad303f84dc branch 'reshard_materialize_source') built on Sat Mar 30 02:18:31 EDT 2024 by matt@pslord.local using go1.22.1 darwin/arm64

Operating System and Environment details

N/A

Log Fragments

No response

@mattlord mattlord self-assigned this Mar 30, 2024
@mattlord mattlord added this to Backlog in VReplication via automation Mar 30, 2024
@mattlord mattlord moved this from Backlog to Prioritized in VReplication Apr 3, 2024
@mattlord mattlord moved this from Prioritized to In progress in VReplication Apr 15, 2024
VReplication automation moved this from In progress to Done May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

1 participant