1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-16546 System versioning setting to allow history modification

1. system_versioning_insert_history session variable allows
pseudocolumns ROW_START and ROW_END be specified in INSERT,
INSERT..SELECT and LOAD DATA.

2. Cleaned up select_insert::send_data() from setting vers_write as
this parameter is now set on TABLE initialization.

4. Replication of system_versioning_insert_history via option_bits in
OPTIONS_WRITTEN_TO_BIN_LOG.
This commit is contained in:
Aleksey Midenkov
2022-08-28 22:44:56 +03:00
committed by Sergei Golubchik
parent d9b0c9ad2b
commit a2cda88631
23 changed files with 581 additions and 23 deletions

View File

@ -7573,6 +7573,30 @@ int handler::ha_write_row(const uchar *buf)
DBUG_RETURN(error);
}
if (table->versioned() && !table->vers_write)
{
Field *row_start= table->vers_start_field();
Field *row_end= table->vers_end_field();
MYSQL_TIME ltime;
bitmap_set_bit(table->read_set, row_start->field_index);
bitmap_set_bit(table->read_set, row_end->field_index);
/*
Inserting the history row directly, check ROW_START <= ROW_END and
ROW_START is non-zero.
*/
if ((row_start->cmp(row_start->ptr, row_end->ptr) >= 0) ||
row_start->get_date(&ltime, Datetime::Options(
TIME_NO_ZERO_DATE, time_round_mode_t(time_round_mode_t::FRAC_NONE))))
{
String val;
row_start->val_str(&val);
my_error(ER_WRONG_VALUE, MYF(0), row_start->field_name.str, val.ptr());
DBUG_RETURN(HA_ERR_GENERIC);
}
}
MYSQL_INSERT_ROW_START(table_share->db.str, table_share->table_name.str);
mark_trx_read_write();
increment_statistics(&SSV::ha_write_count);