summaryrefslogtreecommitdiff
path: root/storage/innobase/handler/ha_innodb.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2020-12-22 08:34:18 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-12-22 08:34:18 +0300
commit9b38ed4c85bda254f48c02890f134adf227700e3 (patch)
tree49bc225dde6194356be5df8247bf4823cae0143b /storage/innobase/handler/ha_innodb.cc
parent932ec586aada4bd78f613ee10750effc7f442327 (diff)
downloadmariadb-git-9b38ed4c85bda254f48c02890f134adf227700e3.tar.gz
MDEV-23446 UPDATE does not insert history row if the row is not changed
Add history row outside of compare_record() check. For TRX_ID versioning we have to fail can_compare_record to force InnoDB update which adds history row; and there in ha_innobase::update_row() is additional "row changed" check where we force history row anyway.
Diffstat (limited to 'storage/innobase/handler/ha_innodb.cc')
-rw-r--r--storage/innobase/handler/ha_innodb.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index d1f155eecff..e66a340a7f0 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -8799,6 +8799,20 @@ ha_innobase::update_row(
MySQL that the row is not really updated and it
should not increase the count of updated rows.
This is fix for http://bugs.mysql.com/29157 */
+ if (m_prebuilt->versioned_write
+ && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE
+ /* Multiple UPDATE of same rows in single transaction create
+ historical rows only once. */
+ && trx->id != table->vers_start_id()) {
+ error = row_insert_for_mysql((byte*) old_row,
+ m_prebuilt,
+ ROW_INS_HISTORICAL);
+ if (error != DB_SUCCESS) {
+ goto func_exit;
+ }
+ innobase_srv_conc_exit_innodb(m_prebuilt);
+ innobase_active_small();
+ }
DBUG_RETURN(HA_ERR_RECORD_IS_THE_SAME);
} else {
const bool vers_set_fields = m_prebuilt->versioned_write