From 8055a7b3c23b9ea6faf78ca99c66dc08eb2939b4 Mon Sep 17 00:00:00 2001
From: sunny <Unknown>
Date: Mon, 5 Mar 2007 00:37:57 +0000
Subject: [PATCH] Fix for Bug# 21409. At low transaction isolation levels we
 let each consistent read set its own snapshot

---
 handler/ha_innodb.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc
index 7ea6ecaeb7..cdcf75bc17 100644
--- a/handler/ha_innodb.cc
+++ b/handler/ha_innodb.cc
@@ -6856,6 +6856,16 @@ ha_innobase::store_lock(
 		trx->isolation_level = innobase_map_isolation_level(
 						(enum_tx_isolation)
 						thd->variables.tx_isolation);
+
+		if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
+		    && trx->global_read_view) {
+
+			/* At low transaction isolation levels we let
+			each consistent read set its own snapshot */
+
+			read_view_close_for_mysql(trx);
+		}
+
 	}
 
 	const bool in_lock_tables = thd_in_lock_tables(thd);
-- 
2.30.9