Bug#112704: Fix TempTable CTE clone handler mismatch when TempTable f…#672
Bug#112704: Fix TempTable CTE clone handler mismatch when TempTable f…#672catalinbp wants to merge 1 commit into
Conversation
…alls back to InnoDB When TempTable materialization hits RECORD_FILE_FULL and falls back to InnoDB, CTE clones keep TempTable handlers created at preparation time (open_table_from_share()), while the table itself is created in InnoDB. Later open_tmp_table() calls on those clones fail with "Table doesn't exist". Non-recursive CTE refs hit this in create_materialized_table()'s shortcut path. Recursive CTE refs hit it separately in FollowTailIterator::Init(), which opens recursive clones without going through create_materialized_table(). Changes: 1. sql_derived.cc: In create_materialized_table()'s shortcut path, detect handler-type mismatch and replace the handler to match an already-created sibling clone before open_tmp_table(). 2. basic_row_iterators.cc: In FollowTailIterator::Init(), detect handler-type mismatch against share->db_type() (already corrected during fallback) and replace the stale handler before opening. 3. sql_tmp_table.cc: On TempTable->InnoDB fallback, update share->db_plugin so db_type() reflects InnoDB, destroy the stale TempTable handler, keep create_info.db_type consistent, and count Created_tmp_disk_tables once.
|
Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at https://oca.opensource.oracle.com/ |
I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it. |
…alls back to InnoDB
When TempTable materialization hits RECORD_FILE_FULL and falls back to InnoDB, CTE clones keep TempTable handlers created at preparation time (open_table_from_share()), while the table itself is created in InnoDB. Later open_tmp_table() calls on those clones fail with "Table doesn't exist".
Non-recursive CTE refs hit this in create_materialized_table()'s shortcut path. Recursive CTE refs hit it separately in FollowTailIterator::Init(), which opens recursive clones without going through create_materialized_table().
Changes:
sql_derived.cc: In create_materialized_table()'s shortcut path, detect handler-type mismatch and replace the handler to match an already-created sibling clone before open_tmp_table().
basic_row_iterators.cc: In FollowTailIterator::Init(), detect handler-type mismatch against share->db_type() (already corrected during fallback) and replace the stale handler before opening.
sql_tmp_table.cc: On TempTable->InnoDB fallback, update share->db_plugin so db_type() reflects InnoDB, destroy the stale TempTable handler, keep create_info.db_type consistent, and count Created_tmp_disk_tables once.