Commit 7b957316 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.3 into 10.4

parents cbdf62ae 3c99a48d
This diff is collapsed.
...@@ -295,3 +295,80 @@ BEGIN NOT ATOMIC ...@@ -295,3 +295,80 @@ BEGIN NOT ATOMIC
END END
$$ $$
DELIMITER ;$$ DELIMITER ;$$
--echo #
--echo # Testing various keywords in various contexts
--echo #
DELIMITER $$;
CREATE PROCEDURE p1(query TEXT, var TEXT)
BEGIN
DECLARE errmsg TEXT DEFAULT '';
DECLARE CONTINUE HANDLER
FOR SQLEXCEPTION
BEGIN
GET DIAGNOSTICS CONDITION 1 errmsg = MESSAGE_TEXT;
SET errmsg= REPLACE(errmsg, 'You have an error in your SQL ', '..');
SET errmsg= REPLACE(errmsg, '; check the manual that corresponds to your MariaDB server version for the right syntax to use', '..');
END;
SET query=REPLACE(query, '$(VAR)', var);
EXECUTE IMMEDIATE query;
SELECT CONCAT(query, '; -- ', LEFT(COALESCE(errmsg,''),40)) AS `--------`;
END;
$$
CREATE PROCEDURE p2(query TEXT)
BEGIN
FOR row IN (SELECT word FROM t1 ORDER BY category, word)
DO
CALL p1(query, row.word);
END FOR;
END;
$$
DELIMITER ;$$
CREATE TABLE t1 (word TEXT, category TEXT);
INSERT INTO t1 VALUES ('non_keyword', '00 Simple identifier');
INSERT INTO t1 VALUES ('lpad', '01 Built-in native function');
INSERT INTO t1 VALUES ('rpad', '01 Built-in native function');
INSERT INTO t1 VALUES ('adddate', '02 function_call_nonkeyword');
INSERT INTO t1 VALUES ('substr', '02 function_call_nonkeyword');
INSERT INTO t1 VALUES ('substring', '02 function_call_nonkeyword');
INSERT INTO t1 VALUES ('trim_oracle', '02 function_call_nonkeyword');
INSERT INTO t1 VALUES ('ascii', '03 function_call_conflict');
INSERT INTO t1 VALUES ('replace', '03 function_call_conflict');
INSERT INTO t1 VALUES ('weight_string', '03 function_call_conflict');
INSERT INTO t1 VALUES ('char', '04 function_call_keyword');
INSERT INTO t1 VALUES ('trim', '04 function_call_keyword');
INSERT INTO t1 VALUES ('year', '04 function_call_keyword');
INSERT INTO t1 VALUES ('create', '05 Reserved keyword');
CALL p2('SELECT @@$(VAR)');
CALL p2('SELECT @@global.$(VAR)');
CALL p2('SELECT @@global.$(VAR)()');
CALL p2('SELECT $(VAR)()');
CALL p2('SELECT test.$(VAR)()');
CALL p2('SELECT $(VAR) FROM t1');
CALL p2('SELECT t1.$(VAR) FROM t1');
CALL p2('DROP TABLE $(VAR)');
CALL p2('DROP TABLE test.$(VAR)');
CALL p2('CREATE FUNCTION $(VAR)() RETURNS OOPS');
CALL p2('CREATE FUNCTION test.$(VAR)() RETURNS OOPS');
CALL p2('DROP FUNCTION $(VAR)');
CALL p2('DROP FUNCTION test.$(VAR)');
DROP TABLE t1;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2021, MariaDB Corporation. Copyright (c) 2016, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -27,6 +27,11 @@ Created 7/19/1997 Heikki Tuuri ...@@ -27,6 +27,11 @@ Created 7/19/1997 Heikki Tuuri
#include "ibuf0ibuf.h" #include "ibuf0ibuf.h"
#include "sync0sync.h" #include "sync0sync.h"
#include "btr0sea.h" #include "btr0sea.h"
#ifdef WITH_WSREP
extern Atomic_relaxed<bool> wsrep_sst_disable_writes;
#else
constexpr bool wsrep_sst_disable_writes= false;
#endif
using st_::span; using st_::span;
...@@ -2605,6 +2610,10 @@ ibuf_merge_in_background( ...@@ -2605,6 +2610,10 @@ ibuf_merge_in_background(
} }
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
if (wsrep_sst_disable_writes) {
return(0);
}
if (full) { if (full) {
/* Caller has requested a full batch */ /* Caller has requested a full batch */
n_pages = PCT_IO(100); n_pages = PCT_IO(100);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment