Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6c05edfd
Commit
6c05edfd
authored
Sep 19, 2023
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.4 into 10.5
parents
7bef86ea
d0abbdf5
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
133 additions
and
73 deletions
+133
-73
cmake/stack_direction.c
cmake/stack_direction.c
+0
-33
configure.cmake
configure.cmake
+5
-19
debian/rules
debian/rules
+0
-9
mysql-test/main/sp.result
mysql-test/main/sp.result
+25
-0
mysql-test/main/sp.test
mysql-test/main/sp.test
+32
-0
mysql-test/suite/gcol/r/innodb_virtual_purge.result
mysql-test/suite/gcol/r/innodb_virtual_purge.result
+14
-0
mysql-test/suite/gcol/t/innodb_virtual_purge.test
mysql-test/suite/gcol/t/innodb_virtual_purge.test
+14
-0
mysql-test/suite/perfschema/r/privilege_table_io.result
mysql-test/suite/perfschema/r/privilege_table_io.result
+2
-0
mysql-test/suite/roles/acl_statistics.result
mysql-test/suite/roles/acl_statistics.result
+4
-4
scripts/mysql_system_tables.sql
scripts/mysql_system_tables.sql
+1
-0
scripts/mysql_system_tables_data.sql
scripts/mysql_system_tables_data.sql
+3
-3
sql/item.cc
sql/item.cc
+1
-1
sql/sql_class.h
sql/sql_class.h
+22
-1
storage/innobase/row/row0vers.cc
storage/innobase/row/row0vers.cc
+10
-3
No files found.
cmake/stack_direction.c
deleted
100644 → 0
View file @
7bef86ea
/*
Copyright (c) 2009 Sun Microsystems, Inc.
Use is subject to license terms.
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 Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
/* Check stack direction (0-down, 1-up) */
int
f
(
int
*
a
)
{
int
b
;
return
(
&
b
>
a
)
?
1
:
0
;
}
/*
Prevent compiler optimizations by calling function
through pointer.
*/
volatile
int
(
*
ptr_f
)(
int
*
)
=
f
;
int
main
()
{
int
a
;
return
ptr_f
(
&
a
);
}
configure.cmake
View file @
6c05edfd
...
...
@@ -672,25 +672,11 @@ int main()
}
"
HAVE_PTHREAD_YIELD_ZERO_ARG
)
IF
(
NOT STACK_DIRECTION
)
IF
(
CMAKE_CROSSCOMPILING AND NOT DEFINED CMAKE_CROSSCOMPILING_EMULATOR
)
MESSAGE
(
FATAL_ERROR
"STACK_DIRECTION is not defined. Please specify -DSTACK_DIRECTION=1 "
"or -DSTACK_DIRECTION=-1 when calling cmake."
)
ELSE
()
TRY_RUN
(
STACKDIR_RUN_RESULT STACKDIR_COMPILE_RESULT
${
CMAKE_BINARY_DIR
}
${
CMAKE_SOURCE_DIR
}
/cmake/stack_direction.c
)
# Test program returns 0 (down) or 1 (up).
# Convert to -1 or 1
IF
(
STACKDIR_RUN_RESULT EQUAL 0
)
SET
(
STACK_DIRECTION -1 CACHE INTERNAL
"Stack grows direction"
)
ELSE
()
SET
(
STACK_DIRECTION 1 CACHE INTERNAL
"Stack grows direction"
)
ENDIF
()
MESSAGE
(
STATUS
"Checking stack direction :
${
STACK_DIRECTION
}
"
)
ENDIF
()
IF
(
STACK_DIRECTION
)
ELSEIF
(
CMAKE_SYSTEM_PROCESSOR MATCHES
"^(parisc|hppa)"
)
SET
(
STACK_DIRECTION 1 CACHE INTERNAL
"Stack grows direction"
)
ELSE
()
SET
(
STACK_DIRECTION -1 CACHE INTERNAL
"Stack grows direction"
)
ENDIF
()
#
...
...
debian/rules
View file @
6c05edfd
...
...
@@ -51,15 +51,6 @@ ifneq (,$(filter $(DEB_HOST_ARCH_CPU),amd64 arm64))
CMAKEFLAGS += -DPLUGIN_COLUMNSTORE=NO
endif
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
ifneq (,$(filter $(DEB_HOST_ARCH_CPU),alpha amd64 arm arm64 i386 ia64 m68k mips64el mipsel powerpc ppc64 ppc64el riscv64 s390x sh4 sparc64))
CMAKEFLAGS += -DSTACK_DIRECTION=-1
endif
ifneq (,$(filter $(DEB_HOST_ARCH_CPU),hppa))
CMAKEFLAGS += -DSTACK_DIRECTION=1
endif
endif
# Add support for verbose builds
MAKEFLAGS += VERBOSE=1
...
...
mysql-test/main/sp.result
View file @
6c05edfd
...
...
@@ -8933,5 +8933,30 @@ CREATE TABLE t1 (a INT);
CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1));
ERROR 42000: PROCEDURE does not support subqueries or stored functions
DROP TABLE t1;
#
# MDEV-23902: MariaDB crash on calling function
#
CREATE FUNCTION f2 () RETURNS VARCHAR(1)
BEGIN
DECLARE rec1 ROW TYPE OF v1;
SELECT z INTO rec1 FROM v1;
RETURN 1;
END|
CREATE FUNCTION f1 () RETURNS VARCHAR(1) RETURN f2() ;
CREATE FUNCTION f3 () RETURNS VARCHAR(1) RETURN f_not_exist();
CREATE VIEW v1 AS SELECT f3() z;
SELECT f1();
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
# Check that crash doen't happen in case f3 completes with success.
DROP FUNCTION f3;
CREATE FUNCTION f3 () RETURNS VARCHAR(1) RETURN '!';
SELECT f1();
f1()
1
# Clean up
DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
DROP VIEW v1;
# End of 10.4 tests
#
mysql-test/main/sp.test
View file @
6c05edfd
...
...
@@ -10535,5 +10535,37 @@ CREATE PROCEDURE p1() SELECT 1 FROM t1 PROCEDURE ANALYSE( 10, (SELECT a FROM t1)
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-23902: MariaDB crash on calling function
--
echo
#
--
delimiter
|
CREATE
FUNCTION
f2
()
RETURNS
VARCHAR
(
1
)
BEGIN
DECLARE
rec1
ROW
TYPE
OF
v1
;
SELECT
z
INTO
rec1
FROM
v1
;
RETURN
1
;
END
|
--
delimiter
;
CREATE
FUNCTION
f1
()
RETURNS
VARCHAR
(
1
)
RETURN
f2
()
;
CREATE
FUNCTION
f3
()
RETURNS
VARCHAR
(
1
)
RETURN
f_not_exist
();
CREATE
VIEW
v1
AS
SELECT
f3
()
z
;
--
error
ER_VIEW_INVALID
SELECT
f1
();
--
echo
# Check that crash doen't happen in case f3 completes with success.
DROP
FUNCTION
f3
;
CREATE
FUNCTION
f3
()
RETURNS
VARCHAR
(
1
)
RETURN
'!'
;
SELECT
f1
();
--
echo
# Clean up
DROP
FUNCTION
f1
;
DROP
FUNCTION
f2
;
DROP
FUNCTION
f3
;
DROP
VIEW
v1
;
--
echo
# End of 10.4 tests
--
echo
#
mysql-test/suite/gcol/r/innodb_virtual_purge.result
View file @
6c05edfd
...
...
@@ -159,4 +159,18 @@ UNIQUE(pk),
KEY(e)
) ENGINE=InnoDB;
DROP TABLE t1, t2;
#
# MDEV-30024 InnoDB: tried to purge non-delete-marked record
# of an index on a virtual column prefix
#
CREATE TABLE t(a BINARY(8), b CHAR(8) AS (a) VIRTUAL, KEY(b(4)))
CHARACTER SET utf8 ENGINE=InnoDB;
INSERT INTO t (a) VALUES (''),('');
UPDATE t SET a = 'x';
UPDATE t SET a = '';
SET GLOBAL innodb_max_purge_lag_wait=0;
CHECK TABLE t EXTENDED;
Table Op Msg_type Msg_text
test.t check status OK
DROP TABLE t;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
mysql-test/suite/gcol/t/innodb_virtual_purge.test
View file @
6c05edfd
...
...
@@ -172,5 +172,19 @@ dec $n;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# MDEV-30024 InnoDB: tried to purge non-delete-marked record
--
echo
# of an index on a virtual column prefix
--
echo
#
CREATE
TABLE
t
(
a
BINARY
(
8
),
b
CHAR
(
8
)
AS
(
a
)
VIRTUAL
,
KEY
(
b
(
4
)))
CHARACTER
SET
utf8
ENGINE
=
InnoDB
;
INSERT
INTO
t
(
a
)
VALUES
(
''
),(
''
);
UPDATE
t
SET
a
=
'x'
;
UPDATE
t
SET
a
=
''
;
SET
GLOBAL
innodb_max_purge_lag_wait
=
0
;
CHECK
TABLE
t
EXTENDED
;
DROP
TABLE
t
;
--
source
include
/
wait_until_count_sessions
.
inc
SET
GLOBAL
innodb_purge_rseg_truncate_frequency
=
@
saved_frequency
;
mysql-test/suite/perfschema/r/privilege_table_io.result
View file @
6c05edfd
...
...
@@ -124,6 +124,8 @@ wait/io/table/sql/handler TABLE mysql db fetch 1
wait/io/table/sql/handler TABLE mysql proxies_priv fetch 1
wait/io/table/sql/handler TABLE mysql proxies_priv fetch 1
wait/io/table/sql/handler TABLE mysql proxies_priv fetch 1
wait/io/table/sql/handler TABLE mysql proxies_priv fetch 1
wait/io/table/sql/handler TABLE mysql proxies_priv fetch 1
wait/io/table/sql/handler TABLE mysql roles_mapping fetch 1
wait/io/table/sql/handler TABLE mysql tables_priv fetch 1
wait/io/table/sql/handler TABLE mysql tables_priv fetch 1
...
...
mysql-test/suite/roles/acl_statistics.result
View file @
6c05edfd
...
...
@@ -6,7 +6,7 @@ Acl_function_grants 0
Acl_procedure_grants 0
Acl_package_spec_grants 0
Acl_package_body_grants 0
Acl_proxy_users
2
Acl_proxy_users
4
Acl_role_grants 0
Acl_roles 0
Acl_table_grants 1
...
...
@@ -25,7 +25,7 @@ PROCEDURE_GRANTS
0
SELECT count(*) PROXY_USERS from mysql.proxies_priv;
PROXY_USERS
2
4
SELECT count(*) ROLE_GRANTS from mysql.roles_mapping;
ROLE_GRANTS
0
...
...
@@ -71,7 +71,7 @@ Acl_function_grants 3
Acl_procedure_grants 2
Acl_package_spec_grants 0
Acl_package_body_grants 0
Acl_proxy_users
3
Acl_proxy_users
5
Acl_role_grants 4
Acl_roles 2
Acl_table_grants 3
...
...
@@ -90,7 +90,7 @@ PROCEDURE_GRANTS
2
SELECT count(*) PROXY_USERS from mysql.proxies_priv;
PROXY_USERS
3
5
SELECT count(*) ROLE_GRANTS from mysql.roles_mapping;
ROLE_GRANTS
4
...
...
scripts/mysql_system_tables.sql
View file @
6c05edfd
...
...
@@ -303,6 +303,7 @@ set @had_proxies_priv_table= @@warning_count != 0;
-- and for upgrades
CREATE
TEMPORARY
TABLE
tmp_proxies_priv
LIKE
proxies_priv
;
INSERT
INTO
tmp_proxies_priv
VALUES
(
'localhost'
,
'root'
,
''
,
''
,
TRUE
,
''
,
now
());
REPLACE
INTO
tmp_proxies_priv
SELECT
'localhost'
,
IFNULL
(
@
auth_root_socket
,
'root'
),
''
,
''
,
TRUE
,
''
,
now
()
FROM
DUAL
;
INSERT
INTO
proxies_priv
SELECT
*
FROM
tmp_proxies_priv
WHERE
@
had_proxies_priv_table
=
0
;
DROP
TABLE
tmp_proxies_priv
;
...
...
scripts/mysql_system_tables_data.sql
View file @
6c05edfd
...
...
@@ -47,9 +47,9 @@ IF @auth_root_socket is not null THEN
INSERT
INTO
global_priv
SELECT
*
FROM
tmp_user_nopasswd
WHERE
@
had_user_table
=
0
AND
@
auth_root_socket
IS
NULL
;
INSERT
INTO
global_priv
SELECT
*
FROM
tmp_user_socket
WHERE
@
had_user_table
=
0
AND
@
auth_root_socket
IS
NOT
NULL
;
DROP
TABLE
tmp_user_nopasswd
,
tmp_user_socket
;
CREATE
TEMPORARY
TABLE
tmp_proxies_priv
LIKE
proxies_priv
;
INSERT
INTO
tmp_proxies_priv
SELECT
@
current_hostname
,
'root'
,
''
,
''
,
TRUE
,
''
,
now
()
FROM
DUAL
WHERE
@
current_hostname
!=
'localhost'
;
INSERT
INTO
tmp_proxies_priv
SELECT
Host
,
User
,
''
,
''
,
TRUE
,
''
,
now
()
FROM
tmp_user_nopasswd
WHERE
Host
!=
'localhost'
AND
@
auth_root_socket
IS
NULL
;
REPLACE
INTO
tmp_proxies_priv
SELECT
@
current_hostname
,
IFNULL
(
@
auth_root_socket
,
'root'
),
''
,
''
,
TRUE
,
''
,
now
()
FROM
DUAL
WHERE
@
current_hostname
!=
'localhost'
;
INSERT
INTO
proxies_priv
SELECT
*
FROM
tmp_proxies_priv
WHERE
@
had_proxies_priv_table
=
0
;
DROP
TABLE
tmp_proxies_priv
;
DROP
TABLE
tmp_
user_nopasswd
,
tmp_user_socket
,
tmp_
proxies_priv
;
sql/item.cc
View file @
6c05edfd
...
...
@@ -2883,7 +2883,7 @@ Item_sp::execute_impl(THD *thd, Item **args, uint arg_count)
init_sql_alloc
(
key_memory_sp_head_call_root
,
&
sp_mem_root
,
MEM_ROOT_BLOCK_SIZE
,
0
,
MYF
(
0
));
*
sp_query_arena
=
Query_arena
(
&
sp_mem_root
,
Query_arena
::
STMT_
INITIALIZED_FOR_SP
);
Query_arena
::
STMT_
SP_QUERY_ARGUMENTS
);
}
bool
err_status
=
m_sp
->
execute_function
(
thd
,
args
,
arg_count
,
...
...
sql/sql_class.h
View file @
6c05edfd
...
...
@@ -1158,11 +1158,21 @@ class Query_arena
Prepared statement: STMT_INITIALIZED -> STMT_PREPARED -> STMT_EXECUTED.
Stored procedure: STMT_INITIALIZED_FOR_SP -> STMT_EXECUTED.
Other statements: STMT_CONVENTIONAL_EXECUTION never changes.
Special case for stored procedure arguments: STMT_SP_QUERY_ARGUMENTS
This state never changes and used for objects
whose lifetime is whole duration of function call
(sp_rcontext, it's tables and items. etc). Such objects
should be deallocated after every execution of a stored
routine. Caller's arena/memroot can't be used for
placing such objects since memory allocated on caller's
arena not freed until termination of user's session.
*/
enum
enum_state
{
STMT_INITIALIZED
=
0
,
STMT_INITIALIZED_FOR_SP
=
1
,
STMT_PREPARED
=
2
,
STMT_CONVENTIONAL_EXECUTION
=
3
,
STMT_EXECUTED
=
4
,
STMT_ERROR
=
-
1
STMT_CONVENTIONAL_EXECUTION
=
3
,
STMT_EXECUTED
=
4
,
STMT_SP_QUERY_ARGUMENTS
=
5
,
STMT_ERROR
=
-
1
};
enum_state
state
;
...
...
@@ -4218,6 +4228,17 @@ class THD: public THD_count, /* this must be first */
inline
Query_arena
*
activate_stmt_arena_if_needed
(
Query_arena
*
backup
)
{
if
(
state
==
Query_arena
::
STMT_SP_QUERY_ARGUMENTS
)
/*
Caller uses the arena with state STMT_SP_QUERY_ARGUMENTS for stored
routine's parameters. Lifetime of these objects spans a lifetime of
stored routine call and freed every time the stored routine execution
has been completed. That is the reason why switching to statement's
arena is not performed for arguments, else we would observe increasing
of memory usage while a stored routine be called over and over again.
*/
return
NULL
;
/*
Use the persistent arena if we are in a prepared statement or a stored
procedure statement and we have not already changed to use this arena.
...
...
storage/innobase/row/row0vers.cc
View file @
6c05edfd
...
...
@@ -723,9 +723,16 @@ row_vers_vc_matches_cluster(
&&
(
!
compare
[
v_col
->
v_pos
]))
{
if
(
ind_field
->
prefix_len
!=
0
&&
!
dfield_is_null
(
field2
)
&&
field2
->
len
>
ind_field
->
prefix_len
)
{
field2
->
len
=
ind_field
->
prefix_len
;
&&
!
dfield_is_null
(
field2
))
{
field2
->
len
=
unsigned
(
dtype_get_at_most_n_mbchars
(
field2
->
type
.
prtype
,
field2
->
type
.
mbminlen
,
field2
->
type
.
mbmaxlen
,
ind_field
->
prefix_len
,
field2
->
len
,
static_cast
<
char
*>
(
field2
->
data
)));
}
/* The index field mismatch */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment