From 1b7f4590aea92e927c1db8d30d665dcf336cbd1b Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Wed, 22 Apr 2015 00:13:10 +0300
Subject: [PATCH] gh-793: don't warn if the transaction is rolled back due to
 exception.

---
 src/box/lua/call.cc | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/box/lua/call.cc b/src/box/lua/call.cc
index 7cae56b639..c7fdb062ff 100644
--- a/src/box/lua/call.cc
+++ b/src/box/lua/call.cc
@@ -640,22 +640,21 @@ execute_call(lua_State *L, struct request *request, struct obuf *out)
 void
 box_lua_call(struct request *request, struct obuf *out)
 {
-	auto txn_guard = make_scoped_guard([=] {
-		struct txn *txn = in_txn();
-		if (txn) {
-			say_warn("transaction is active at CALL return");
-			txn_rollback();
-		}
-	});
 	lua_State *L = NULL;
 	try {
 		L = lua_newthread(tarantool_L);
 		LuarefGuard coro_ref(tarantool_L);
 		execute_call(L, request, out);
+		if (in_txn()) {
+			say_warn("a transaction is active at CALL return");
+			txn_rollback();
+		}
 	} catch (Exception *e) {
+		txn_rollback();
 		/* Let all well-behaved exceptions pass through. */
 		throw;
 	} catch (...) {
+		txn_rollback();
 		/* Convert Lua error to a Tarantool exception. */
 		tnt_raise(LuajitError, L != NULL ? L : tarantool_L);
 	}
-- 
GitLab