From b66f68520009899c21c102e26d4cdcbc47df46d0 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Thu, 28 Dec 2023 10:01:58 +0800 Subject: [PATCH] Set remote requst's DagRequest flags field (#8606) (#8611) close pingcap/tiflash#8607 --- dbms/src/Flash/Coprocessor/RemoteRequest.cpp | 2 + tests/fullstack-test/issues/issue_8607.test | 45 ++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 tests/fullstack-test/issues/issue_8607.test diff --git a/dbms/src/Flash/Coprocessor/RemoteRequest.cpp b/dbms/src/Flash/Coprocessor/RemoteRequest.cpp index 1c37c158dc7..3795255d0c6 100644 --- a/dbms/src/Flash/Coprocessor/RemoteRequest.cpp +++ b/dbms/src/Flash/Coprocessor/RemoteRequest.cpp @@ -89,6 +89,8 @@ RemoteRequest RemoteRequest::build( /// will be collected by CoprocessorBlockInputStream. /// Otherwise rows in execution summary of table scan will be double. dag_req.set_collect_execution_summaries(false); + dag_req.set_flags(dag_context.getFlags()); + dag_req.set_sql_mode(dag_context.getSQLMode()); const auto & original_dag_req = *dag_context.dag_request; if (original_dag_req.has_time_zone_name() && !original_dag_req.time_zone_name().empty()) dag_req.set_time_zone_name(original_dag_req.time_zone_name()); diff --git a/tests/fullstack-test/issues/issue_8607.test b/tests/fullstack-test/issues/issue_8607.test new file mode 100644 index 00000000000..fc686ca5a5f --- /dev/null +++ b/tests/fullstack-test/issues/issue_8607.test @@ -0,0 +1,45 @@ +# Copyright 2023 PingCAP, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Preparation. +=> DBGInvoke __init_fail_point() + +mysql> drop table if exists test.t +mysql> create table test.t (a int); + +mysql> insert into test.t values (123456789); + +mysql> alter table test.t set tiflash replica 1; +func> wait_table test t + +mysql> set tidb_isolation_read_engines='tiflash'; set tidb_enforce_mpp=1; select * from test.t where cast(a as char(5)) = '12345'; ++-----------+ +| a | ++-----------+ +| 123456789 | ++-----------+ + +=> DBGInvoke __enable_fail_point(force_remote_read_for_batch_cop) + +mysql> set tidb_isolation_read_engines='tiflash'; set tidb_enforce_mpp=1; select * from test.t where cast(a as char(5)) = '12345'; ++-----------+ +| a | ++-----------+ +| 123456789 | ++-----------+ + +=> DBGInvoke __disable_fail_point(force_remote_read_for_batch_cop) + +# Clean up. +mysql> drop table if exists test.t;