[MDEV-33061] JOIN_TAB::preread_init() should set preread_init_done=TRUE in all cases Created: 2023-12-19  Updated: 2024-01-17

Status: Open
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: None
Fix Version/s: 11.4

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 0
Labels: None


 Description   

monty has pointed out that JOIN_TAB::preread_init does not set preread_init_done=true in all cases.

If it doesn't set it, it is called repeatedly for every row combination from previous tables.

This MDEV is about checking this and fixing it.



 Comments   
Comment by Sergei Petrunia [ 2023-12-19 ]

Trying to find cases where this happens:
applying this patch

diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 44bb31db41c..1ef4c3d33bb 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -16092,6 +16092,11 @@ bool JOIN_TAB::preread_init()
       derived->is_nonrecursive_derived_with_rec_ref() ||
       is_split_derived)
     preread_init_done= TRUE;
+  else
+  {
+    fprintf(stderr, "BAAAM: table=%s query=%s\n", table->alias.ptr(),
+    table->in_use->query());
+  }
   if (select && select->quick)
     select->quick->replace_handler(table->file);
 

and running the main testsuite, I get nothing.

Generated at Thu Feb 08 10:36:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.