Commit 7668a79a authored by Marko Mäkelä's avatar Marko Mäkelä Committed by Marko Mäkelä

MDEV-12269 Port Bug#22996442 INNODB: MAKE UNIV_DEBUG DEPEND ON DBUG_OFF

This is a partial port of my patch in MySQL 8.0.
In MySQL 8.0, all InnoDB references to DBUG_OFF were replaced
with UNIV_DEBUG. We will not do that in MariaDB.

InnoDB used two independent compile-time flags that distinguish
debug and non-debug builds, which is confusing.

Also, make ut_ad() and alias of DBUG_ASSERT().
parent 105f46ff
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=3;
......
......@@ -5,8 +5,6 @@
--source include/have_innodb_32k.inc
--source include/have_file_key_management_plugin.inc
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact encrypted=yes encryption_key_id=1;
--error ER_CANT_CREATE_TABLE
......
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
......@@ -117,9 +116,9 @@ UPDATE t2 SET qa=@l,ra=@l,sa=@l,ta=@l,ua=@l;
UPDATE t2 SET va=@l,wa=@l,xa=@l,ya=@l,za=@l;
COMMIT;
INSERT INTO t1 SELECT * from t2;
SET DEBUG_DBUG='+d,crash_commit_before';
BEGIN;
UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e;
ERROR HY000: Lost connection to MySQL server during query
# Kill and restart
UPDATE t1 SET a=@f,b=@f,c=@f,d=@f,e=@f,f=@f,g=@f,h=@f,i=@f,j=@f,
k=@f,l=@f,m=@f,n=@f,o=@f,p=@f,q=@f,r=@f,s=@f,t=@f,u=@f,
v=@f,w=@f,x=@b,y=@f,z=@f,
......
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
......@@ -259,7 +258,7 @@ UPDATE t2 SET kc=@i,lc=@i,mc=@i,nc=@i,oc=@i,pc=@i;
UPDATE t2 SET qc=@i,rc=@i,sc=@i,tc=@i,uc=@i;
UPDATE t2 SET vc=@i,wc=@i,xc=@i,yc=@i,zc=@i;
COMMIT;
SET DEBUG_DBUG='+d,crash_commit_before';
BEGIN;
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c,
v=@c,w=@c,x=@c,y=@c,z=@c,
......@@ -272,7 +271,7 @@ vb=@c,wb=@c,xb=@c,yb=@c,zb=@c,
ac=@c,bc=@c,cc=@c,dc=@c,ec=@c,fc=@c,gc=@c,hc=@c,ic=@c,jc=@c,
kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c,
vc=@c,wc=@c,xc=@c,yc=@c,zc=@c;
ERROR HY000: Lost connection to MySQL server during query
# Kill and restart
UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e,f=@e,g=@e,h=@e,i=@e,j=@e,
k=@e,l=@e,m=@e,n=@e,o=@e,p=@e,q=@e,r=@e,s=@e,t=@e,u=@e,
v=@e,w=@e,x=@e,y=@e,z=@e,
......
CREATE TABLE t1 (
t1_int INT,
t1_time TIME
) ENGINE=innodb;
CREATE TABLE t2 (
t2_int int PRIMARY KEY,
t2_int2 INT
) ENGINE=INNODB;
INSERT IGNORE INTO t2 VALUES ();
Warnings:
Warning 1364 Field 't2_int' doesn't have a default value
INSERT INTO t1 VALUES ();
SELECT *
FROM t1 AS t1a
WHERE NOT EXISTS
(SELECT *
FROM t1 AS t1b
WHERE t1b.t1_int NOT IN
(SELECT t2.t2_int
FROM t2
WHERE t1b.t1_time LIKE t1b.t1_int
OR t1b.t1_time <> t2.t2_int2
AND 6=7
)
)
;
t1_int t1_time
DROP TABLE t1,t2;
--source include/have_innodb.inc
--source include/have_innodb_32k.inc
--source include/have_debug.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc
# Embedded server does not support crashing
# Embedded server does not support restarting
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
let $MYSQLD_DATADIR= `select @@datadir`;
......@@ -148,15 +141,9 @@ COMMIT;
INSERT INTO t1 SELECT * from t2;
SET DEBUG_DBUG='+d,crash_commit_before';
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
BEGIN;
UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e;
# Write file to make mysql-test-run.pl restart the server
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
--source include/kill_and_restart_mysqld.inc
UPDATE t1 SET a=@f,b=@f,c=@f,d=@f,e=@f,f=@f,g=@f,h=@f,i=@f,j=@f,
k=@f,l=@f,m=@f,n=@f,o=@f,p=@f,q=@f,r=@f,s=@f,t=@f,u=@f,
......
--source include/have_innodb.inc
--source include/have_innodb_64k.inc
--source include/have_debug.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc
# Embedded server does not support crashing
# Embedded server does not support restarting
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
call mtr.add_suppression("InnoDB: Warning: innodb_page_size has been changed from default value *");
let $MYSQLD_DATADIR= `select @@datadir`;
......@@ -293,9 +286,7 @@ UPDATE t2 SET vc=@i,wc=@i,xc=@i,yc=@i,zc=@i;
COMMIT;
SET DEBUG_DBUG='+d,crash_commit_before';
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
BEGIN;
UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
k=@c,l=@c,m=@c,n=@c,o=@c,p=@c,q=@c,r=@c,s=@c,t=@c,u=@c,
v=@c,w=@c,x=@c,y=@c,z=@c,
......@@ -308,11 +299,7 @@ UPDATE t1 SET a=@c,b=@c,c=@c,d=@c,e=@c,f=@c,g=@c,h=@c,i=@c,j=@c,
ac=@c,bc=@c,cc=@c,dc=@c,ec=@c,fc=@c,gc=@c,hc=@c,ic=@c,jc=@c,
kc=@c,lc=@c,mc=@c,nc=@c,oc=@c,pc=@c,qc=@c,rc=@c,sc=@c,tc=@c,uc=@c,
vc=@c,wc=@c,xc=@c,yc=@c,zc=@c;
# Write file to make mysql-test-run.pl restart the server
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
--source include/kill_and_restart_mysqld.inc
UPDATE t1 SET a=@e,b=@e,c=@e,d=@e,e=@e,f=@e,g=@e,h=@e,i=@e,j=@e,
k=@e,l=@e,m=@e,n=@e,o=@e,p=@e,q=@e,r=@e,s=@e,t=@e,u=@e,
......
# Test for bug #12400341: INNODB CAN LEAVE ORPHAN IBD FILES AROUND
-- source include/have_debug.inc
-- source include/have_innodb.inc
-- source include/have_innodb_16k.inc
if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_TRX_RSEG_N_SLOTS_DEBUG'`)
{
--skip Test requires InnoDB built with UNIV_DEBUG definition.
}
# Don't test under valgrind, undo slots of the previous test might exist still
# and cause unstable result.
--source include/not_valgrind.inc
......
......@@ -3,11 +3,6 @@
-- source include/have_innodb.inc
-- source include/have_debug.inc
if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`)
{
--skip Test requires InnoDB built with UNIV_DEBUG definition.
}
--disable_query_log
set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
set @old_innodb_undo_logs = @@innodb_undo_logs;
......
......@@ -5,7 +5,7 @@
#
# This is a symbolic test, it would not fail if the bug is present.
# Rather those SQL commands have been used during manual testing under
# UNIV_DEBUG & UNIV_SYNC_DEBUG to test all changed codepaths for locking
# innodb_sync_debug to test all changed codepaths for locking
# correctness.
#
......
-- source include/have_innodb.inc
# Bug #59307 uninitialized value in rw_lock_set_writer_id_and_recursion_flag()
# when Valgrind instrumentation (HAVE_VALGRIND) is not enabled
CREATE TABLE t1 (
t1_int INT,
t1_time TIME
) ENGINE=innodb;
CREATE TABLE t2 (
t2_int int PRIMARY KEY,
t2_int2 INT
) ENGINE=INNODB;
INSERT IGNORE INTO t2 VALUES ();
INSERT INTO t1 VALUES ();
SELECT *
FROM t1 AS t1a
WHERE NOT EXISTS
(SELECT *
FROM t1 AS t1b
WHERE t1b.t1_int NOT IN
(SELECT t2.t2_int
FROM t2
WHERE t1b.t1_time LIKE t1b.t1_int
OR t1b.t1_time <> t2.t2_int2
AND 6=7
)
)
;
DROP TABLE t1,t2;
......@@ -629,14 +629,6 @@ buf_flush_or_remove_pages(
processed = 0;
}
#ifdef DBUG_OFF
if (flush) {
DBUG_EXECUTE_IF("ib_export_flush_crash",
static ulint n_pages;
if (++n_pages == 4) {DBUG_SUICIDE();});
}
#endif /* DBUG_OFF */
/* The check for trx is interrupted is expensive, we want
to check every N iterations. */
if (!processed && trx && trx_is_interrupted(trx)) {
......
......@@ -187,6 +187,13 @@ command. */
#if defined HAVE_valgrind && defined HAVE_VALGRIND
# define UNIV_DEBUG_VALGRIND
#endif /* HAVE_VALGRIND */
#ifdef DBUG_OFF
# undef UNIV_DEBUG
#elif !defined UNIV_DEBUG
# define UNIV_DEBUG
#endif
#if 0
#define UNIV_DEBUG_VALGRIND /* Enable extra
Valgrind instrumentation */
......@@ -198,8 +205,6 @@ command. */
debugging without UNIV_DEBUG */
#define UNIV_BLOB_LIGHT_DEBUG /* Enable off-page column
debugging without UNIV_DEBUG */
#define UNIV_DEBUG /* Enable ut_ad() assertions
and disable UNIV_INLINE */
#define UNIV_DEBUG_LOCK_VALIDATE /* Enable
ut_ad(lock_rec_validate_page())
assertions. */
......
......@@ -60,14 +60,12 @@ ut_dbg_assertion_failed(
#define ut_error \
ut_dbg_assertion_failed(0, __FILE__, __LINE__)
/** Debug assertion */
#define ut_ad(EXPR) DBUG_ASSERT(EXPR)
#ifdef UNIV_DEBUG
/** Debug assertion. Does nothing unless UNIV_DEBUG is defined. */
#define ut_ad(EXPR) ut_a(EXPR)
/** Debug statement. Does nothing unless UNIV_DEBUG is defined. */
#define ut_d(EXPR) EXPR
#else
/** Debug assertion. Does nothing unless UNIV_DEBUG is defined. */
#define ut_ad(EXPR)
/** Debug statement. Does nothing unless UNIV_DEBUG is defined. */
#define ut_d(EXPR)
#endif
......
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