← Back to team overview

maria-developers team mailing list archive

Re: 031efde365c: MDEV-16217: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_num::get_date

 

Hi!

Am 12.11.18 um 13:24 schrieb Sergei Golubchik:
Hi, Oleksandr!

On Nov 07, Oleksandr Byelkin wrote:
revision-id: 031efde365c674dbdbaada95aa6d42a4274db438 (mariadb-10.2.18-65-g031efde365c)
parent(s): 89f948c766721a26e110bc9da0ca5ebc20f65112
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-11-07 14:29:47 +0100
message:

MDEV-16217: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_num::get_date

- clean up DEFAULT() to work only with default value and correctly print
   itself.
- fix of DBUG_ASSERT about fields read/write
- fix of field marking for write based really on the thd->mark_used_columns flag
diff --git a/sql/field.cc b/sql/field.cc
index caa84dc9932..6cd8940a893 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -70,8 +70,21 @@ const char field_separator=',';
  #define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
                          ((ulong) ((1LL << MY_MIN(arg, 4) * 8) - 1))
-#define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index)))
-#define ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED DBUG_ASSERT(is_stat_field || !table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || (table->vcol_set && bitmap_is_set(table->vcol_set, field_index))))
+// Column marked for read or the field set to read out or record[0] or [1]
+#define ASSERT_COLUMN_MARKED_FOR_READ                              \
+  DBUG_ASSERT(!table ||                                            \
+              (!table->read_set ||                                 \
+               bitmap_is_set(table->read_set, field_index) ||      \
+               (!(ptr >= table->record[0] &&                       \
+                  ptr < table->record[0] + table->s->reclength))))
+
+#define ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED                   \
+  DBUG_ASSERT(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))) || \
+              (table->vcol_set && bitmap_is_set(table->vcol_set, field_index)))
Do you need this ptr check in ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED ?
I'd expect you only needing it in ASSERT_COLUMN_MARKED_FOR_READ.

Appeared that yes, it is needed, because set_default uses save_in_field:

#3  0x00007ffff5b43412 in __GI___assert_fail (assertion=0x55555663d230 "is_stat_field || !table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || (table->vcol_set && bitmap_is_set(table->vcol_set, field_index)))", file=0x55555663ceb0 "sql/field.cc", line=4205, function=0x55555663faa0 <Field_long::store(long long, bool)::__PRETTY_FUNCTION__> "virtual int Field_long::store(longlong, bool)") at assert.c:101 #4  0x0000555555d5629a in Field_long::store (this=0x7fffd4013888, nr=6, unsigned_val=false) at sql/field.cc:4205 #5  0x0000555555da2939 in Item::save_in_field (this=0x7fffd4107ba8, field=0x7fffd4013888, no_conversions=false) at sql/item.cc:6386 #6  0x0000555555d4f44f in Field::set_default (this=0x7fffd4013888) at sql/field.cc:2351 #7  0x0000555555da9f3e in Item_default_value::calculate (this=0x7fffd4012858) at sql/item.cc:8876



[skip]



Follow ups

References