Skip to content

Commit 461cac8

Browse files
committed
MDEV-26150: The test main.opt_trace fails in case it is run in PS mode
In case the test main.opt_trace is run with the option --ps-protocol it fails since querying from the table INFORMATION_SCHEMA.OPTIMIZER_TRACE produces an output that differed from the expected one in the following way: @@ -2829,14 +2829,6 @@ } }, { - "transformation": { - "select_id": 2, - "from": "IN (SELECT)", - "to": "semijoin", - "chosen": true - } - }, - { "expanded_query": "/* select#2 */ select t10.pk from t10" } The table INFORMATION_SCHEMA.OPTIMIZER_TRACE is filled when optimizer_trace is on. The reason of missing above mentioned pieces in query result set is that the C++ macros OPT_TRACE_TRANSFORM(thd, trace_wrapper, trace_transform, select_lex->select_number, "IN (SELECT)", "semijoin"); located in the standalone function check_and_do_in_subquery_rewrites() is executed twice in case the statement explain extended select * from t1 where a in (select pk from t10); is run in PS mode. The first time it is executed on PREPARE phase and the second time on EXECUTE phase. The output produced by this macros on EXECUTE phase rewrites the output produced on PREPARE phase. In result test failed in case it was run in PS mode. To make test output uniform regardless the test is run in PS or normal mode the operator '--source include/protocol.inc' has been added to the file opt_trace.test and extra opt_trace,ps.rdiff file has been added. Additionally, added operators --enable_prepared_warnings/--disable_prepared_warnings in order to store warnings in result file that received on PREPARE phase during running the statemement 'SELECT INTO'.
1 parent 429382c commit 461cac8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

mysql-test/main/opt_trace.test

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
if (`SELECT $PS_PROTOCOL != 0`)
2-
{
3-
--skip Test temporarily disabled for ps-protocol
4-
}
51
--source include/not_embedded.inc
62
--source include/have_sequence.inc
3+
--source include/protocol.inc
74
SELECT table_name, column_name FROM information_schema.columns where table_name="OPTIMIZER_TRACE";
85
show variables like 'optimizer_trace';
96
set optimizer_trace="enabled=on";
@@ -267,12 +264,14 @@ begin
267264
return a;
268265
end|
269266

267+
--enable_prepare_warnings
270268
create function f2(a int) returns int
271269
begin
272270
declare a int default 0;
273271
select count(*) from t2 into a;
274272
return a;
275273
end|
274+
--disable_prepare_warnings
276275

277276
delimiter ;|
278277
set optimizer_trace='enabled=on';

0 commit comments

Comments
 (0)