From 760bc82cdfbce8fac85ccc4e0836c87d40cce507 Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Fri, 20 Feb 2015 19:56:25 +0300
Subject: [PATCH] engine API: Remove ENGINE_TRANSACTIONAL, all engines support
 transactions

---
 src/box/engine.h         | 13 +++----------
 src/box/memtx_engine.cc  |  3 +--
 src/box/sophia_engine.cc |  2 +-
 src/box/txn.cc           |  5 -----
 4 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/box/engine.h b/src/box/engine.h
index 34a2d78b90..0498e40e27 100644
--- a/src/box/engine.h
+++ b/src/box/engine.h
@@ -34,9 +34,8 @@ struct space;
 struct tuple;
 
 enum engine_flags {
-	ENGINE_TRANSACTIONAL = 1,
-	ENGINE_NO_YIELD = 2,
-	ENGINE_CAN_BE_TEMPORARY = 4,
+	ENGINE_NO_YIELD = 1,
+	ENGINE_CAN_BE_TEMPORARY = 2,
 	/**
 	 * Identifies that engine can handle changes
 	 * of primary key during update.
@@ -48,7 +47,7 @@ enum engine_flags {
 	 * If the flag is not set, the server will verify
 	 * that the primary key is not changed.
 	 */
-	ENGINE_AUTO_CHECK_UPDATE = 8,
+	ENGINE_AUTO_CHECK_UPDATE = 4,
 };
 
 extern uint32_t engine_flags[BOX_ENGINE_MAX];
@@ -204,12 +203,6 @@ Engine *engine_find(const char *name);
 /** Shutdown all engine factories. */
 void engine_shutdown();
 
-static inline bool
-engine_transactional(uint32_t flags)
-{
-	return flags & ENGINE_TRANSACTIONAL;
-}
-
 static inline bool
 engine_no_yield(uint32_t flags)
 {
diff --git a/src/box/memtx_engine.cc b/src/box/memtx_engine.cc
index bb7135c451..b64baafd65 100644
--- a/src/box/memtx_engine.cc
+++ b/src/box/memtx_engine.cc
@@ -93,8 +93,7 @@ MemtxEngine::MemtxEngine()
 	m_snapshot_lsn(-1),
 	m_snapshot_pid(0)
 {
-	flags = ENGINE_TRANSACTIONAL |
-		ENGINE_NO_YIELD |
+	flags = ENGINE_NO_YIELD |
 	        ENGINE_CAN_BE_TEMPORARY |
 		ENGINE_AUTO_CHECK_UPDATE;
 	memtx_recovery_prepare(&recovery);
diff --git a/src/box/sophia_engine.cc b/src/box/sophia_engine.cc
index dbbff9fd83..4be24222f0 100644
--- a/src/box/sophia_engine.cc
+++ b/src/box/sophia_engine.cc
@@ -111,7 +111,7 @@ SophiaEngine::SophiaEngine()
 	 ,m_prev_checkpoint_lsn(-1)
 	 ,m_checkpoint_lsn(-1)
 {
-	flags = ENGINE_TRANSACTIONAL;
+	flags = 0;
 	env = NULL;
 	recovery.state   = READY_NO_KEYS;
 	recovery.recover = sophia_recovery_begin_snapshot;
diff --git a/src/box/txn.cc b/src/box/txn.cc
index 14119838f1..6d23a89b08 100644
--- a/src/box/txn.cc
+++ b/src/box/txn.cc
@@ -163,11 +163,6 @@ txn_engine_begin_stmt(struct txn *txn, struct space *space)
 	if (txn->n_stmts == 1) {
 		/* First statement. */
 		txn->engine = engine;
-		if (txn->autocommit == false) {
-			if (! engine_transactional(engine->flags))
-				tnt_raise(ClientError, ER_UNSUPPORTED,
-				          space->def.engine_name, "transactions");
-		}
 	} else {
 		if (txn->engine->id != engine_id(space->handler))
 			tnt_raise(ClientError, ER_CROSS_ENGINE_TRANSACTION);
-- 
GitLab