diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2020-07-20 18:28:08 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2020-07-20 18:28:08 +0300 |
commit | af83ed9f0ed10496c11bea6b054f4d86562e2349 (patch) | |
tree | ad98c4625ff8a0c79add509acb512914250cf5e3 /sql/table.cc | |
parent | af57c658090cc52aa20e8cde7d24a563d73ff886 (diff) | |
download | mariadb-git-af83ed9f0ed10496c11bea6b054f4d86562e2349.tar.gz |
MDEV-20661 Virtual fields are not recalculated on system fields value assignment
Fix stale virtual field value in 4 cases: when virtual field depends
on row_start/row_end in timestamp/trx_id versioned table. row_start
dep is recalculated in vers_update_fields() (SQL and InnoDB
layer). row_end dep is recalculated on history row insert.
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/sql/table.cc b/sql/table.cc index 7aa7abfa006..84c827ec70b 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -8078,29 +8078,24 @@ void TABLE::vers_update_fields() bitmap_set_bit(write_set, vers_start_field()->field_index); bitmap_set_bit(write_set, vers_end_field()->field_index); - if (versioned(VERS_TIMESTAMP)) + if (!vers_write) { - if (!vers_write) - { - file->column_bitmaps_signal(); - return; - } - if (vers_start_field()->store_timestamp(in_use->query_start(), - in_use->query_start_sec_part())) - DBUG_ASSERT(0); + file->column_bitmaps_signal(); + return; } - else + + if (versioned(VERS_TIMESTAMP) && + vers_start_field()->store_timestamp(in_use->query_start(), + in_use->query_start_sec_part())) { - if (!vers_write) - { - file->column_bitmaps_signal(); - return; - } + DBUG_ASSERT(0); } vers_end_field()->set_max(); bitmap_set_bit(read_set, vers_end_field()->field_index); file->column_bitmaps_signal(); + if (vfield) + update_virtual_fields(file, VCOL_UPDATE_FOR_READ); } |