1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-31033 ER_KEY_NOT_FOUND upon online COPY ALTER on a partitioned table

The row events were applied "twice": once for the ha_partition, and one
more time for the underlying storage engine.

There's no such problem in binlog/rpl, because ha_partiton::row_logging
is normally set to false.

The fix makes the events replicate only when the handler is a root handler.
We will try to *guess* this by comparing it to table->file. The same
approach is used in the MDEV-21540 fix, 231feabd. The assumption is made,
that the row methods are only called for table->file (and never for a
cloned handler), hence the assertions are added in ha_innobase and
ha_myisam to make sure that this is true at least for those engines

Also closes MDEV-31040, however the test is not included, since we have no
convenient way to construct a deterministic version.
This commit is contained in:
Nikita Malyavin
2023-04-12 02:01:31 +03:00
committed by Sergei Golubchik
parent 0775c7bdc3
commit c76072db93
5 changed files with 68 additions and 21 deletions

View File

@@ -7561,6 +7561,22 @@ inline bool handler::has_long_unique()
return table->s->long_unique_table;
}
/**
Return whether the handler is root.
@return false if table is maintained by different handlerton, true otherwise.
@note The implementation supposes that the same handler can't be found as both
root and non-root.
There are two known cases when it's non-root:
1. under partition's ha_write_row() (also true for copy_partitions())
2. under ha_mroonga::wrapper_write_row();
same applies for ha_delete_row/ha_update_row.
*/
inline bool handler::is_root_handler() const
{
return ht == table->file->ht;
}
extern pthread_attr_t *get_connection_attrib(void);
/**