From: Aleksandr Lyapunov <alyapunov@tarantool.org>
To: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v3 08/13] txm: introduce tx manager
Date: Wed, 15 Jul 2020 16:55:31 +0300 [thread overview]
Message-ID: <1594821336-14468-9-git-send-email-alyapunov@tarantool.org> (raw)
In-Reply-To: <1594821336-14468-1-git-send-email-alyapunov@tarantool.org>
Define TX manager. It will store data for MVCC and conflict manager.
Define also 'use_mvcc_engine' in config that enables MVCC engine.
Part of #4897
---
src/box/lua/load_cfg.lua | 2 ++
src/box/txn.c | 21 +++++++++++++++++++++
src/box/txn.h | 12 ++++++++++++
src/main.cc | 5 +++++
test/app-tap/init_script.result | 1 +
test/box/admin.result | 2 ++
test/box/cfg.result | 4 ++++
7 files changed, 47 insertions(+)
diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index 107bc15..8b40b29 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -82,6 +82,7 @@ local default_cfg = {
coredump = false,
read_only = false,
hot_standby = false,
+ use_mvcc_engine = false,
checkpoint_interval = 3600,
checkpoint_wal_threshold = 1e18,
checkpoint_count = 2,
@@ -162,6 +163,7 @@ local template_cfg = {
checkpoint_count = 'number',
read_only = 'boolean',
hot_standby = 'boolean',
+ use_mvcc_engine = 'boolean',
worker_pool_threads = 'number',
replication_timeout = 'number',
replication_sync_lag = 'number',
diff --git a/src/box/txn.c b/src/box/txn.c
index d254edb..d647fc9 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -38,6 +38,16 @@
#include "errinj.h"
#include "iproto_constants.h"
+struct tx_manager
+{
+};
+
+/** That's a definition, see declaration for description. */
+bool tx_manager_use_mvcc_engine = false;
+
+/** The one and only instance of tx_manager. */
+static struct tx_manager txm;
+
double too_long_threshold;
/* Txn cache. */
@@ -1165,3 +1175,14 @@ txn_on_yield(struct trigger *trigger, void *event)
txn_set_flag(txn, TXN_IS_ABORTED_BY_YIELD);
return 0;
}
+
+void
+tx_manager_init()
+{
+ (void)txm;
+}
+
+void
+tx_manager_free()
+{
+}
diff --git a/src/box/txn.h b/src/box/txn.h
index 962ada0..a2374f3 100644
--- a/src/box/txn.h
+++ b/src/box/txn.h
@@ -43,6 +43,12 @@ extern "C" {
/** box statistics */
extern struct rmean *rmean_box;
+/**
+ * Global flag that enables mvcc engine.
+ * If set, memtx starts to apply statements through txm history mechanism
+ * and tx manager itself transaction reads in order to detect conflicts.
+ */
+extern bool tx_manager_use_mvcc_engine;
struct journal_entry;
struct engine;
@@ -700,6 +706,12 @@ box_txn_savepoint(void);
API_EXPORT int
box_txn_rollback_to_savepoint(box_txn_savepoint_t *savepoint);
+void
+tx_manager_init();
+
+void
+tx_manager_free();
+
#if defined(__cplusplus)
} /* extern "C" */
#endif /* defined(__cplusplus) */
diff --git a/src/main.cc b/src/main.cc
index 65b1606..07eafb8 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -75,6 +75,7 @@
#include <libutil.h>
#include "box/lua/init.h" /* box_lua_init() */
#include "box/session.h"
+#include "box/txn.h"
#include "systemd.h"
#include "crypto/crypto.h"
#include "core/popen.h"
@@ -569,6 +570,8 @@ load_cfg(void)
log_format,
background);
+ tx_manager_use_mvcc_engine = cfg_getb("use_mvcc_engine");
+
if (background)
daemonize();
@@ -667,6 +670,7 @@ tarantool_free(void)
random_free();
#endif
crypto_free();
+ tx_manager_free();
coll_free();
systemd_free();
say_logger_free();
@@ -830,6 +834,7 @@ main(int argc, char **argv)
signal_init();
cbus_init();
coll_init();
+ tx_manager_init();
crypto_init();
systemd_init();
tarantool_lua_init(tarantool_bin, main_argc, main_argv);
diff --git a/test/app-tap/init_script.result b/test/app-tap/init_script.result
index 857f0c9..3838e35 100644
--- a/test/app-tap/init_script.result
+++ b/test/app-tap/init_script.result
@@ -37,6 +37,7 @@ slab_alloc_factor:1.05
sql_cache_size:5242880
strip_core:true
too_long_threshold:0.5
+use_mvcc_engine:false
vinyl_bloom_fpr:0.05
vinyl_cache:134217728
vinyl_dir:.
diff --git a/test/box/admin.result b/test/box/admin.result
index ab3e80a..278e8c5 100644
--- a/test/box/admin.result
+++ b/test/box/admin.result
@@ -95,6 +95,8 @@ cfg_filter(box.cfg)
- true
- - too_long_threshold
- 0.5
+ - - use_mvcc_engine
+ - false
- - vinyl_bloom_fpr
- 0.05
- - vinyl_cache
diff --git a/test/box/cfg.result b/test/box/cfg.result
index bdd210b..b5ba165 100644
--- a/test/box/cfg.result
+++ b/test/box/cfg.result
@@ -83,6 +83,8 @@ cfg_filter(box.cfg)
| - true
| - - too_long_threshold
| - 0.5
+ | - - use_mvcc_engine
+ | - false
| - - vinyl_bloom_fpr
| - 0.05
| - - vinyl_cache
@@ -190,6 +192,8 @@ cfg_filter(box.cfg)
| - true
| - - too_long_threshold
| - 0.5
+ | - - use_mvcc_engine
+ | - false
| - - vinyl_bloom_fpr
| - 0.05
| - - vinyl_cache
--
2.7.4
next prev parent reply other threads:[~2020-07-15 13:55 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-15 13:55 [Tarantool-patches] [PATCH v3 00/13] Transaction engine for memtx engine Aleksandr Lyapunov
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 01/13] Update license file (2020) Aleksandr Lyapunov
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 02/13] Check data_offset overflow in struct tuple Aleksandr Lyapunov
2020-07-16 14:27 ` Nikita Pettik
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 03/13] vinyl: rename tx_manager -> vy_tx_manager Aleksandr Lyapunov
2020-07-15 16:04 ` Nikita Pettik
2020-07-16 8:17 ` Aleksandr Lyapunov
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 04/13] txm: introduce dirty tuples Aleksandr Lyapunov
2020-07-15 16:22 ` Nikita Pettik
2020-07-16 0:05 ` Vladislav Shpilevoy
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 05/13] txm: save txn in txn_stmt Aleksandr Lyapunov
2020-07-15 16:23 ` Nikita Pettik
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 06/13] txm: add TX status Aleksandr Lyapunov
2020-07-15 16:42 ` Nikita Pettik
2020-07-16 0:08 ` Vladislav Shpilevoy
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 07/13] txm: save does_require_old_tuple flag in txn_stmt Aleksandr Lyapunov
2020-07-15 16:49 ` Nikita Pettik
2020-07-16 0:09 ` Vladislav Shpilevoy
2020-07-15 13:55 ` Aleksandr Lyapunov [this message]
2020-07-15 16:51 ` [Tarantool-patches] [PATCH v3 08/13] txm: introduce tx manager Nikita Pettik
2020-07-15 22:01 ` Vladislav Shpilevoy
2020-07-16 0:10 ` Vladislav Shpilevoy
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 09/13] tmx: introduce prepare sequence number Aleksandr Lyapunov
2020-07-15 17:13 ` Nikita Pettik
2020-07-16 0:11 ` Vladislav Shpilevoy
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 10/13] tmx: introduce conflict tracker Aleksandr Lyapunov
2020-07-16 0:16 ` Vladislav Shpilevoy
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 11/13] txm: introduce txm_story Aleksandr Lyapunov
2020-07-16 0:20 ` Vladislav Shpilevoy
2020-07-17 6:16 ` Aleksandr Lyapunov
2020-07-16 22:25 ` Vladislav Shpilevoy
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 12/13] txm: clarify all fetched tuples Aleksandr Lyapunov
2020-07-15 13:55 ` [Tarantool-patches] [PATCH v3 13/13] tmx: use new tx manager in memtx Aleksandr Lyapunov
2020-07-16 22:26 ` Vladislav Shpilevoy
2020-07-17 5:08 ` Aleksandr Lyapunov
2020-07-23 20:58 ` Vladislav Shpilevoy
2020-07-15 15:47 ` [Tarantool-patches] [PATCH v3 00/13] Transaction engine for memtx engine Aleksandr Lyapunov
2020-07-15 16:38 ` Aleksandr Lyapunov
2020-07-15 16:39 ` Aleksandr Lyapunov
2020-07-15 16:40 ` Aleksandr Lyapunov
2020-07-16 0:05 ` Vladislav Shpilevoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1594821336-14468-9-git-send-email-alyapunov@tarantool.org \
--to=alyapunov@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v3 08/13] txm: introduce tx manager' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox