MDEV-19252 Problem with DBUG_ASSERT_AS_PRINTF and marked_for_write()

Problem was that DBUG_FIX_WRITE_SET was not enabled when using
DBUG_ASSERT_AS_PRINTF
This commit is contained in:
Monty 2019-04-19 13:20:15 +03:00
parent a024649081
commit c07e346ca6
4 changed files with 28 additions and 7 deletions

View file

@ -0,0 +1,4 @@
CREATE TABLE t2 (n BLOB, UNIQUE(n));
INSERT INTO t2 VALUES (1);
DELETE FROM t2 WHERE n = 1;
DROP TABLE t2;

View file

@ -0,0 +1,12 @@
--source include/have_innodb.inc
#
# MDEV-19252 Warning about assertion failure marked_for_write_or_computed()
# printed by release build with DBUG_ASSERT_AS_PRINTF, but no failure on debug
# build
#
CREATE TABLE t2 (n BLOB, UNIQUE(n));
INSERT INTO t2 VALUES (1);
DELETE FROM t2 WHERE n = 1;
DROP TABLE t2;

View file

@ -67,14 +67,19 @@ inline bool Field::marked_for_read() const
ptr < table->record[0] + table->s->reclength)));
}
/*
The name of this function is a bit missleading as in 10.4 we don't
have to test anymore if the field is computed. Instead we mark
changed fields with DBUG_FIX_WRITE_SET() in table.cc
*/
inline bool Field::marked_for_write_or_computed() const
{
return is_stat_field || !table ||
(!table->write_set ||
bitmap_is_set(table->write_set, field_index) ||
(!(ptr >= table->record[0] &&
ptr < table->record[0] + table->s->reclength)));
return (is_stat_field || !table ||
(!table->write_set ||
bitmap_is_set(table->write_set, field_index) ||
(!(ptr >= table->record[0] &&
ptr < table->record[0] + table->s->reclength))));
}

View file

@ -8080,10 +8080,10 @@ public:
/*
to satisfy ASSERT_COLUMN_MARKED_FOR_WRITE Field's assert we temporarily
to satisfy marked_for_write_or_computed() Field's assert we temporarily
mark field for write before storing the generated value in it
*/
#ifndef DBUG_OFF
#ifdef DBUG_ASSERT_EXISTS
#define DBUG_FIX_WRITE_SET(f) bool _write_set_fixed= !bitmap_fast_test_and_set(write_set, (f)->field_index)
#define DBUG_RESTORE_WRITE_SET(f) if (_write_set_fixed) bitmap_clear_bit(write_set, (f)->field_index)
#else