[MDEV-17404] inconsistent transaction isolation level inside mysql.transaction_registry Created: 2018-10-09  Updated: 2023-10-06

Status: Open
Project: MariaDB Server
Component/s: Galera, Storage Engine - InnoDB, Versioned Tables
Affects Version/s: 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Eugene Kosov (Inactive) Assignee: Aleksey Midenkov
Resolution: Unresolved Votes: 0
Labels: trx-versioning

Issue Links:
Relates
relates to MDEV-16226 TRX_ID-based System Versioning refact... Stalled

 Description   

--source include/galera_cluster.inc
 
--connection node_1
create table t1 (
  a int primary key,
  s bigint unsigned as row start,
  e bigint unsigned as row end,
  period for system_time(s,e)
) engine=InnoDB with system versioning;
 
--connection node_2
insert into t1 (a) values (2);
select * from mysql.transaction_registry;
 
--connection node_1
select * from mysql.transaction_registry;
 
drop table t1;
 
--source include/galera_end.inc

select * from mysql.transaction_registry;
transaction_id	commit_id	begin_timestamp	commit_timestamp	isolation_level
36	37	2018-10-09 11:56:08.254080	2018-10-09 11:56:08.255792	REPEATABLE-READ
connection node_1;
select * from mysql.transaction_registry;
transaction_id	commit_id	begin_timestamp	commit_timestamp	isolation_level
36	37	2018-10-09 11:56:08.256453	2018-10-09 11:56:08.256454	READ-COMMITTED

Isolation levels are different. This issue was created to investigate why is that.

Here is the patch which breaks no tests and fixes the above issue:

diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index 819a56b9f23..3cd5fe91b13 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -47,7 +47,6 @@ struct wsrep_thd_shadow {
   uint                 server_status;
   enum wsrep_exec_mode wsrep_exec_mode;
   Vio                  *vio;
-  ulong                tx_isolation;
   const char           *db;
   size_t               db_length;
   my_hrtime_t          user_time;
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index ce6d9688cb3..c8e6d5533cc 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -160,10 +160,6 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
   thd->net.vio= 0;
   thd->clear_error();
 
-  shadow->tx_isolation        = thd->variables.tx_isolation;
-  thd->variables.tx_isolation = ISO_READ_COMMITTED;
-  thd->tx_isolation           = ISO_READ_COMMITTED;
-
   shadow->db            = thd->db.str;
   shadow->db_length     = thd->db.length;
   shadow->user_time     = thd->user_time;
@@ -178,7 +174,6 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
   thd->server_status          = shadow->server_status;
   thd->wsrep_exec_mode        = shadow->wsrep_exec_mode;
   thd->net.vio                = shadow->vio;
-  thd->variables.tx_isolation = shadow->tx_isolation;
   thd->user_time              = shadow->user_time;
   thd->reset_db(&db);


Generated at Thu Feb 08 08:36:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.