diff options
author | mkaruza <mario.karuza@galeracluster.com> | 2022-05-10 11:15:32 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2022-05-30 12:43:52 +0300 |
commit | ebbd5ef6e2902a51a46e47dbb8a8667593cb25e7 (patch) | |
tree | 1b6a2a61387e9cf76b12154cda681cf044d29d44 /sql/log.cc | |
parent | c8fabbed425140332038537c8baeaa33c96a9db5 (diff) | |
download | mariadb-git-ebbd5ef6e2902a51a46e47dbb8a8667593cb25e7.tar.gz |
MDEV-27862 Galera should replicate nextval()-related changes in sequences with INCREMENT <> 0, at least NOCACHE ones with engine=InnoDB
Sequence storage engine is not transactionl so cache will be written in
stmt_cache that is not replicated in cluster. To fix this replicate
what is available in both trans_cache and stmt_cache.
Sequences will only work when NOCACHE keyword is used when sequnce is
created. If WSREP is enabled and we don't have this keyword report error
indicting that sequence will not work correctly in cluster.
When binlog is enabled statement cache will be cleared in transaction
before COMMIT so cache generated from sequence will not be replicated.
We need to keep cache until replication.
Tests are re-recorded because of replication changes that were
introducted with this PR.
Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/log.cc b/sql/log.cc index 25cf0831469..ec96a2f9b23 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2013,7 +2013,13 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all) thd->backup_stage(&org_stage); THD_STAGE_INFO(thd, stage_binlog_write); +#ifdef WITH_WSREP + // DON'T clear stmt cache in case we are in transaction + if (!cache_mngr->stmt_cache.empty() && + (!wsrep_on(thd) || ending_trans(thd, all))) +#else if (!cache_mngr->stmt_cache.empty()) +#endif { error= binlog_commit_flush_stmt_cache(thd, all, cache_mngr); } @@ -10777,13 +10783,13 @@ maria_declare_plugin_end; #ifdef WITH_WSREP #include "wsrep_mysqld.h" -IO_CACHE *wsrep_get_trans_cache(THD * thd) +IO_CACHE *wsrep_get_cache(THD * thd, bool is_transactional) { DBUG_ASSERT(binlog_hton->slot != HA_SLOT_UNDEF); binlog_cache_mngr *cache_mngr = (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); if (cache_mngr) - return cache_mngr->get_binlog_cache_log(true); + return cache_mngr->get_binlog_cache_log(is_transactional); WSREP_DEBUG("binlog cache not initialized, conn: %llu", thd->thread_id); |