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

Materialize executor unexpectedly compact the UPDATE and DELETE operations from CDC #13346

Closed
StrikeW opened this issue Nov 9, 2023 · 4 comments · Fixed by #13351
Closed
Assignees
Labels
priority/critical type/bug Something isn't working
Milestone

Comments

@StrikeW
Copy link
Contributor

StrikeW commented Nov 9, 2023

Describe the bug

Materialize executor unexpectedly compact the UPDATE and DELETE operations of same pk from CDC

Error message/log

The chunk trace of the upstream UPDATE and DELETE operations.


2023-11-09T19:15:45.28921+08:00 DEBUG actor{otel.name="Actor 6" actor_id=6 prev_epoch=5393176590614528 curr_epoch=5393176656216064}:executor{otel.name="DmlExecutor 600000001 (actor 6)" actor_id=6}:executor{otel>
+---+-----+------+-----------------------+
|   | id  | name | description           |
+---+-----+------+-----------------------+
| + | 101 | RW   | Small 2-wheel scooter |
| - | 101 | RW   | Small 2-wheel scooter |
+---+-----+------+-----------------------+
 cardinality=2 capacity=2
2023-11-09T19:15:45.289386+08:00 DEBUG actor{otel.name="Actor 6" actor_id=6 prev_epoch=5393176590614528 curr_epoch=5393176656216064}:executor{otel.name="DmlExecutor 600000001 (actor 6)" actor_id=6}: events::str>
+---+-----+------+-----------------------+
|   | id  | name | description           |
+---+-----+------+-----------------------+
| + | 101 | RW   | Small 2-wheel scooter |
| - | 101 | RW   | Small 2-wheel scooter |
+---+-----+------+-----------------------+
 cardinality=2 capacity=2
2023-11-09T19:15:45.289835+08:00 DEBUG actor{otel.name="Actor 2" actor_id=2 prev_epoch=5393176590614528 curr_epoch=5393176656216064}:executor{otel.name="Materialize 200000003 (actor 2)" actor_id=2}:executor{ote>
+---+--------------------+----------------------+-----------------------------+
|   | mytest.products.id | mytest.products.name | mytest.products.description |
+---+--------------------+----------------------+-----------------------------+
| + | 101                | RW                   | Small 2-wheel scooter       |
| - | 101                | RW                   | Small 2-wheel scooter       |
+---+--------------------+----------------------+-----------------------------+

To Reproduce

  1. create a table in mysql and insert one row
mysql> select * from products;
+-----+---------+-----------------------+
| id  | name    | description           |
+-----+---------+-----------------------+
| 101 | scooter | Small 2-wheel scooter |
+-----+---------+-----------------------+
  1. Ingest the table into RW
create table products ( id INT,
 name STRING,
 description STRING,
 PRIMARY KEY (id)
) with (
 connector = 'mysql-cdc',
 hostname = 'localhost',
 port = '8306',
 username = 'dbz',
 password = '123456',
 database.name = 'mytest',
 table.name = 'products',
 server.id = '5085'
);
  1. Shutdown the cluster
  2. Execute following commands in mysql
UPDATE products SET name='RW' where id=101;
DELETE from products where id=101;
  1. Restart the cluster
  2. Select the table in RW

The expected result is the row should be deleted from RW, but it still exist.

Expected behavior

The expected result is the row should be deleted from RW, but it still exist.

How did you deploy RisingWave?

No response

The version of RisingWave

No response

Additional context

No response

@StrikeW StrikeW added the type/bug Something isn't working label Nov 9, 2023
@github-actions github-actions bot added this to the release-1.5 milestone Nov 9, 2023
@wcy-fdu
Copy link
Contributor

wcy-fdu commented Nov 9, 2023

cc @st1page

@BugenZhao
Copy link
Member

This is really a severe fault. Chaos unit test might be a good-to-have if code review cannot be enforced.

@st1page
Copy link
Contributor

st1page commented Nov 9, 2023

It is because we use a MaterializeBuffer to compact the input chunk and because the upsert stream does not obey the associative property, the compact operation with the retractable stream rules is illegal. e.g.
INSERT 1, DELETE 1 can be compacted into No-op. but UPSERT 1, DELETE 1 can not because we can not know if the record that should be deleted is inserted by the upsert operation.
I think we should remove the MaterializeBuffer structure but just leave a HashSet to help to get all the keys in the streamChunk and fetch them into the cache. And then we need to do all real operations in the state cache.

@fuyufjh
Copy link
Member

fuyufjh commented Nov 15, 2023

closed by #13351

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/critical type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants