Open pedropb opened 8 months ago
My initial investigation points to cursor_value
not considering the table names when updating the cursor value.
These are the queries logged:
Product Load (0.9ms) SELECT `products`.* FROM `products` INNER JOIN `comments` ON `comments`.`product_id` = `products`.`id` ORDER BY products.id,comments.id LIMIT 2
Product Load (1.0ms) SELECT `products`.* FROM `products` INNER JOIN `comments` ON `comments`.`product_id` = `products`.`id` WHERE (products.id > '2' OR (products.id = '2' AND (comments.id > '2'))) ORDER BY products.id,comments.id LIMIT 2
Product Load (1.0ms) SELECT `products`.* FROM `products` INNER JOIN `comments` ON `comments`.`product_id` = `products`.`id` WHERE (products.id > '3' OR (products.id = '3' AND (comments.id > '3'))) ORDER BY products.id,comments.id LIMIT 2
vs the expected positions:
# [ product.id, comment.id ]
[[1, 1], [2, 2], [2, 3], [3, 4], [3, 5], [3, 6]]
Once the cursor hits product.id = 3
it gets stuck, because the queries always returns [3, 4], [3, 5]
, and cursor_value
does not use the table_name
(iow: column.to_s.split(".").first
) on @columns
to update the value on the cursor:
Reproduction steps:
dev test
on branchpb-bug-multi-cursor-different-tables
Expected behaviour:
Other notes