Skip to content

Commit 87abc87

Browse files
committed
Implement VATS in XtraDB and InnoDB.
1 parent 5058ced commit 87abc87

File tree

8 files changed

+477
-34
lines changed

8 files changed

+477
-34
lines changed

sql/sql_class.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#include <sys/syscall.h>
7373
#endif
7474

75+
bool is_slave_replication = false;
7576
/*
7677
The following is used to initialise Table_ident with a internal
7778
table name

sql/sql_class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ extern MYSQL_PLUGIN_IMPORT const char **errmesg;
152152

153153
extern bool volatile shutdown_in_progress;
154154

155+
extern bool is_slave_replication;
156+
155157
extern "C" LEX_STRING * thd_query_string (MYSQL_THD thd);
156158
extern "C" char **thd_query(MYSQL_THD thd);
157159

storage/innobase/handler/ha_innodb.cc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,22 @@ static TYPELIB innodb_default_row_format_typelib = {
379379
NULL
380380
};
381381

382+
/** Possible values of the parameter innodb_lock_schedule_algorithm */
383+
static const char* innodb_lock_schedule_algorithm_names[] = {
384+
"fcfs",
385+
"vats",
386+
NullS
387+
};
388+
389+
/** Used to define an enumerate type of the system variable
390+
innodb_lock_schedule_algorithm. */
391+
static TYPELIB innodb_lock_schedule_algorithm_typelib = {
392+
array_elements(innodb_lock_schedule_algorithm_names) - 1,
393+
"innodb_lock_schedule_algorithm_typelib",
394+
innodb_lock_schedule_algorithm_names,
395+
NULL
396+
};
397+
382398
/* The following counter is used to convey information to InnoDB
383399
about server activity: in case of normal DML ops it is not
384400
sensible to call srv_active_wake_master_thread after each
@@ -22784,6 +22800,18 @@ static MYSQL_SYSVAR_ULONG(doublewrite_batch_size, srv_doublewrite_batch_size,
2278422800
NULL, NULL, 120, 1, 127, 0);
2278522801
#endif /* defined UNIV_DEBUG || defined UNIV_PERF_DEBUG */
2278622802

22803+
static MYSQL_SYSVAR_ENUM(lock_schedule_algorithm, innodb_lock_schedule_algorithm,
22804+
PLUGIN_VAR_RQCMDARG,
22805+
"The algorithm Innodb uses for deciding which locks to grant next when"
22806+
" a lock is released. Possible values are"
22807+
" FCFS"
22808+
" grant the locks in First-Come-First-Served order;"
22809+
" VATS"
22810+
" use the Variance-Aware-Transaction-Scheduling algorithm, which"
22811+
" uses an Eldest-Transaction-First heuristic.",
22812+
NULL, NULL, INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS,
22813+
&innodb_lock_schedule_algorithm_typelib);
22814+
2278722815
static MYSQL_SYSVAR_ULONG(buffer_pool_instances, srv_buf_pool_instances,
2278822816
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
2278922817
"Number of buffer pool instances, set to higher value on high-end machines to increase scalability",
@@ -23657,6 +23685,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
2365723685
MYSQL_SYSVAR(ft_sort_pll_degree),
2365823686
MYSQL_SYSVAR(large_prefix),
2365923687
MYSQL_SYSVAR(force_load_corrupted),
23688+
MYSQL_SYSVAR(lock_schedule_algorithm),
2366023689
MYSQL_SYSVAR(locks_unsafe_for_binlog),
2366123690
MYSQL_SYSVAR(lock_wait_timeout),
2366223691
MYSQL_SYSVAR(page_size),

storage/innobase/include/lock0lock.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ Created 5/7/1996 Heikki Tuuri
4040
#include "gis0rtree.h"
4141
#include "lock0prdt.h"
4242

43+
/** Alternatives for innodb_lock_schedule_algorithm, which can be changed by
44+
setting innodb_lock_schedule_algorithm. */
45+
enum innodb_lock_schedule_algorithm_t {
46+
/*!< First Come First Served */
47+
INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS,
48+
/*!< Variance-Aware-Transaction-Scheduling */
49+
INNODB_LOCK_SCHEDULE_ALGORITHM_VATS
50+
};
51+
52+
extern ulong innodb_lock_schedule_algorithm;
53+
4354
// Forward declaration
4455
class ReadView;
4556

0 commit comments

Comments
 (0)