Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f924a94d
Commit
f924a94d
authored
Nov 28, 2017
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: disable versioned DML for transaction_registry=off [closes #364]
parent
dcc00d2b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
18 deletions
+48
-18
mysql-test/suite/versioning/r/insert.result
mysql-test/suite/versioning/r/insert.result
+5
-0
mysql-test/suite/versioning/t/insert.test
mysql-test/suite/versioning/t/insert.test
+6
-0
sql/handler.cc
sql/handler.cc
+9
-6
sql/share/errmsg-utf8.txt
sql/share/errmsg-utf8.txt
+3
-0
sql/sql_table.cc
sql/sql_table.cc
+13
-7
sql/sys_vars.cc
sql/sys_vars.cc
+8
-1
sql/vtmd.cc
sql/vtmd.cc
+4
-4
No files found.
mysql-test/suite/versioning/r/insert.result
View file @
f924a94d
...
...
@@ -355,6 +355,11 @@ rollback to a;
commit;
call verify_vtq;
No A B C D
set global transaction_registry= off;
insert into t2(x) values (1);
insert into t1(x) values (1);
ERROR HY000: Some versioned DML requires `transaction_registry` to be set to ON.
set global transaction_registry= on;
drop table t1;
drop table t2;
drop procedure test_01;
...
...
mysql-test/suite/versioning/t/insert.test
View file @
f924a94d
...
...
@@ -185,6 +185,12 @@ rollback to a;
commit
;
call
verify_vtq
;
set
global
transaction_registry
=
off
;
insert
into
t2
(
x
)
values
(
1
);
--
error
ER_VERS_TRT_IS_DISABLED
insert
into
t1
(
x
)
values
(
1
);
set
global
transaction_registry
=
on
;
drop
table
t1
;
drop
table
t2
;
...
...
sql/handler.cc
View file @
f924a94d
...
...
@@ -1414,16 +1414,14 @@ int ha_commit_trans(THD *thd, bool all)
goto
err
;
}
if
(
rw_trans
&&
use_transaction_registry
)
if
(
rw_trans
)
{
ulonglong
trx_start_id
=
0
,
trx_end_id
=
0
;
for
(
Ha_trx_info
*
ha_info
=
trans
->
ha_list
;
ha_info
;
ha_info
=
ha_info
->
next
())
for
(
Ha_trx_info
*
ha_info
=
trans
->
ha_list
;
ha_info
;
ha_info
=
ha_info
->
next
())
{
if
(
ulonglong
(
*
prepare
)(
THD
*
,
ulonglong
*
)
=
ha_info
->
ht
()
->
prepare_commit_versioned
)
if
(
ha_info
->
ht
()
->
prepare_commit_versioned
)
{
trx_end_id
=
prepare
(
thd
,
&
trx_start_id
);
trx_end_id
=
ha_info
->
ht
()
->
prepare_commit_versioned
(
thd
,
&
trx_start_id
);
if
(
trx_end_id
)
break
;
// FIXME: use a common ID for cross-engine transactions
}
...
...
@@ -1431,6 +1429,11 @@ int ha_commit_trans(THD *thd, bool all)
if
(
trx_end_id
)
{
if
(
!
use_transaction_registry
)
{
my_error
(
ER_VERS_TRT_IS_DISABLED
,
MYF
(
0
));
goto
err
;
}
DBUG_ASSERT
(
trx_start_id
);
TR_table
trt
(
thd
,
true
);
if
(
trt
.
update
(
trx_start_id
,
trx_end_id
))
...
...
sql/share/errmsg-utf8.txt
View file @
f924a94d
...
...
@@ -7913,3 +7913,6 @@ ER_NOT_LOG_TABLE
ER_VERS_GENERATED_ALWAYS_NOT_EMPTY
eng "Can not modify column `%s` to GENERATED ALWAYS AS ROW START/END for non-empty table"
ER_VERS_TRT_IS_DISABLED
eng "Some versioned DML requires `transaction_registry` to be set to ON."
sql/sql_table.cc
View file @
f924a94d
...
...
@@ -7442,15 +7442,21 @@ static bool mysql_inplace_alter_table(THD *thd,
{
TR_table
trt
(
thd
,
true
);
if
(
trt
==
*
table_list
||
!
use_transaction_registry
);
else
if
(
ulonglong
(
*
prepare
)(
THD
*
,
ulonglong
*
)
=
table
->
file
->
ht
->
prepare_commit_versioned
)
if
(
trt
!=
*
table_list
&&
table
->
file
->
ht
->
prepare_commit_versioned
)
{
ulonglong
trx_start_id
,
trx_end_id
=
prepare
(
thd
,
&
trx_start_id
);
if
(
trx_end_id
&&
trt
.
update
(
trx_start_id
,
trx_end_id
))
ulonglong
trx_start_id
=
0
;
ulonglong
trx_end_id
=
table
->
file
->
ht
->
prepare_commit_versioned
(
thd
,
&
trx_start_id
);
if
(
trx_end_id
)
{
my_error
(
ER_UNKNOWN_ERROR
,
MYF
(
0
));
goto
rollback
;
if
(
!
use_transaction_registry
)
{
my_error
(
ER_VERS_TRT_IS_DISABLED
,
MYF
(
0
));
goto
rollback
;
}
if
(
trt
.
update
(
trx_start_id
,
trx_end_id
))
{
goto
rollback
;
}
}
}
...
...
sql/sys_vars.cc
View file @
f924a94d
...
...
@@ -423,11 +423,18 @@ static Sys_var_enum Sys_vers_alter_history(
SESSION_VAR
(
vers_alter_history
),
CMD_LINE
(
REQUIRED_ARG
),
vers_alter_history_keywords
,
DEFAULT
(
VERS_ALTER_HISTORY_ERROR
));
static
bool
update_transaction_registry
(
sys_var
*
self
,
THD
*
thd
,
enum_var_type
type
)
{
use_transaction_registry
=
opt_transaction_registry
;
return
false
;
}
static
Sys_var_mybool
Sys_transaction_registry
(
"transaction_registry"
,
"Enable or disable update of transaction_registry"
,
GLOBAL_VAR
(
opt_transaction_registry
),
CMD_LINE
(
OPT_ARG
),
DEFAULT
(
TRUE
));
DEFAULT
(
TRUE
),
NO_MUTEX_GUARD
,
NOT_IN_BINLOG
,
0
,
ON_UPDATE
(
update_transaction_registry
));
static
Sys_var_ulonglong
Sys_binlog_cache_size
(
"binlog_cache_size"
,
"The size of the transactional cache for "
...
...
sql/vtmd.cc
View file @
f924a94d
...
...
@@ -255,12 +255,12 @@ VTMD_table::update(THD *thd, const char* archive_name)
}
quit:
if
(
result
||
!
use_transaction_registry
);
else
if
(
ulonglong
(
*
prepare
)(
THD
*
,
ulonglong
*
)
=
vtmd
.
table
->
file
->
ht
->
prepare_commit_versioned
)
if
(
!
result
&&
vtmd
.
table
->
file
->
ht
->
prepare_commit_versioned
)
{
DBUG_ASSERT
(
use_transaction_registry
);
// FIXME: disable survival mode while TRT is disabled
TR_table
trt
(
thd
,
true
);
ulonglong
trx_start_id
,
trx_end_id
=
prepare
(
thd
,
&
trx_start_id
);
ulonglong
trx_start_id
=
0
;
ulonglong
trx_end_id
=
vtmd
.
table
->
file
->
ht
->
prepare_commit_versioned
(
thd
,
&
trx_start_id
);
result
=
trx_end_id
&&
trt
.
update
(
trx_start_id
,
trx_end_id
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment