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
72dd813f
Commit
72dd813f
authored
Feb 27, 2018
by
Aleksey Midenkov
Committed by
Sergei Golubchik
Apr 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-15427 IB: TRX_ID based operations inside transaction generate history
[closes tempesta-tech#472]
parent
a4251d6f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
19 deletions
+70
-19
mysql-test/suite/versioning/r/trx_id.result
mysql-test/suite/versioning/r/trx_id.result
+34
-8
mysql-test/suite/versioning/t/trx_id.test
mysql-test/suite/versioning/t/trx_id.test
+34
-8
sql/table.cc
sql/table.cc
+1
-3
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+1
-0
No files found.
mysql-test/suite/versioning/r/trx_id.result
View file @
72dd813f
set default_storage_engine= innodb;
create or replace table t1 (
x int,
sys_trx_start bigint(20) unsigned as row start invisible,
sys_trx_end bigint(20) unsigned as row end invisible,
period for system_time (sys_trx_start, sys_trx_end)
) with system versioning
engine innodb
;
) with system versioning;
insert into t1 (x) values (1);
# ALTER ADD SYSTEM VERSIONING should write to mysql.transaction_registry
set @@system_versioning_alter_history=keep;
create or replace table t1 (x int)
engine innodb
;
create or replace table t1 (x int);
insert into t1 values (1);
alter table t1
add column s bigint unsigned as row start,
...
...
@@ -19,7 +20,7 @@ select s from t1 into @trx_start;
select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start;
count(*) = 1
1
create or replace table t1 (x int)
engine innodb
;
create or replace table t1 (x int);
select count(*) from mysql.transaction_registry into @tmp;
alter table t1
add column s bigint unsigned as row start,
...
...
@@ -30,7 +31,7 @@ algorithm=inplace;
select count(*) = @tmp from mysql.transaction_registry;
count(*) = @tmp
1
create or replace table t1 (x int)
engine innodb
;
create or replace table t1 (x int);
insert into t1 values (1);
alter table t1
add column s bigint unsigned as row start,
...
...
@@ -42,7 +43,7 @@ select s from t1 into @trx_start;
select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start;
count(*) = 1
1
create or replace table t1 (x int)
engine innodb
;
create or replace table t1 (x int);
select count(*) from mysql.transaction_registry into @tmp;
alter table t1
add column s bigint unsigned as row start,
...
...
@@ -59,7 +60,7 @@ x int,
sys_start bigint unsigned as row start invisible,
sys_end bigint unsigned as row end invisible,
period for system_time (sys_start, sys_end)
)
engine innodb
with system versioning;
) with system versioning;
insert into t1 values (1);
alter table t1 drop column sys_start, drop column sys_end;
select row_end = 18446744073709551615 as transaction_based from t1 for system_time all;
...
...
@@ -71,7 +72,7 @@ x int,
sys_start bigint(20) unsigned as row start invisible,
sys_end bigint(20) unsigned as row end invisible,
period for system_time (sys_start, sys_end)
) with system versioning
engine innodb
;
) with system versioning;
set transaction isolation level read committed;
start transaction;
insert into t1 values (1);
...
...
@@ -128,4 +129,29 @@ x
1
2
3
drop table t1;
#
# MDEV-15427 IB: TRX_ID based operations inside transaction generate history
#
create or replace table t1(
x int(10),
row_start bigint(20) unsigned as row start,
row_end bigint(20) unsigned as row end,
period for system_time(row_start, row_end)
) with system versioning;
begin;
insert into t1 (x) values (1);
delete from t1;
commit;
select x from t1 for system_time all;
x
insert into t1 (x) values (2);
begin;
update t1 set x= 3;
update t1 set x= 4;
commit;
select x, row_start < row_end from t1 for system_time all;
x row_start < row_end
4 1
2 1
drop database test;
create database test;
mysql-test/suite/versioning/t/trx_id.test
View file @
72dd813f
--
source
include
/
have_innodb
.
inc
--
source
include
/
not_embedded
.
inc
set
default_storage_engine
=
innodb
;
create
or
replace
table
t1
(
x
int
,
sys_trx_start
bigint
(
20
)
unsigned
as
row
start
invisible
,
sys_trx_end
bigint
(
20
)
unsigned
as
row
end
invisible
,
period
for
system_time
(
sys_trx_start
,
sys_trx_end
)
)
with
system
versioning
engine
innodb
;
)
with
system
versioning
;
insert
into
t1
(
x
)
values
(
1
);
--
echo
# ALTER ADD SYSTEM VERSIONING should write to mysql.transaction_registry
set
@@
system_versioning_alter_history
=
keep
;
create
or
replace
table
t1
(
x
int
)
engine
innodb
;
create
or
replace
table
t1
(
x
int
);
insert
into
t1
values
(
1
);
alter
table
t1
add
column
s
bigint
unsigned
as
row
start
,
...
...
@@ -24,7 +26,7 @@ alter table t1
select
s
from
t1
into
@
trx_start
;
select
count
(
*
)
=
1
from
mysql
.
transaction_registry
where
transaction_id
=
@
trx_start
;
create
or
replace
table
t1
(
x
int
)
engine
innodb
;
create
or
replace
table
t1
(
x
int
);
select
count
(
*
)
from
mysql
.
transaction_registry
into
@
tmp
;
alter
table
t1
add
column
s
bigint
unsigned
as
row
start
,
...
...
@@ -34,7 +36,7 @@ alter table t1
algorithm
=
inplace
;
select
count
(
*
)
=
@
tmp
from
mysql
.
transaction_registry
;
create
or
replace
table
t1
(
x
int
)
engine
innodb
;
create
or
replace
table
t1
(
x
int
);
insert
into
t1
values
(
1
);
alter
table
t1
add
column
s
bigint
unsigned
as
row
start
,
...
...
@@ -45,7 +47,7 @@ alter table t1
select
s
from
t1
into
@
trx_start
;
select
count
(
*
)
=
1
from
mysql
.
transaction_registry
where
transaction_id
=
@
trx_start
;
create
or
replace
table
t1
(
x
int
)
engine
innodb
;
create
or
replace
table
t1
(
x
int
);
select
count
(
*
)
from
mysql
.
transaction_registry
into
@
tmp
;
alter
table
t1
add
column
s
bigint
unsigned
as
row
start
,
...
...
@@ -62,7 +64,7 @@ create or replace table t1 (
sys_start
bigint
unsigned
as
row
start
invisible
,
sys_end
bigint
unsigned
as
row
end
invisible
,
period
for
system_time
(
sys_start
,
sys_end
)
)
engine
innodb
with
system
versioning
;
)
with
system
versioning
;
insert
into
t1
values
(
1
);
alter
table
t1
drop
column
sys_start
,
drop
column
sys_end
;
select
row_end
=
18446744073709551615
as
transaction_based
from
t1
for
system_time
all
;
...
...
@@ -73,7 +75,7 @@ create or replace table t1 (
sys_start
bigint
(
20
)
unsigned
as
row
start
invisible
,
sys_end
bigint
(
20
)
unsigned
as
row
end
invisible
,
period
for
system_time
(
sys_start
,
sys_end
)
)
with
system
versioning
engine
innodb
;
)
with
system
versioning
;
set
transaction
isolation
level
read
committed
;
start
transaction
;
...
...
@@ -116,4 +118,28 @@ select * from t1 for system_time as of timestamp @ts2;
select
*
from
t1
for
system_time
as
of
transaction
@
trx_id3
;
select
*
from
t1
for
system_time
as
of
timestamp
@
ts3
;
drop
table
t1
;
--
echo
#
--
echo
# MDEV-15427 IB: TRX_ID based operations inside transaction generate history
--
echo
#
create
or
replace
table
t1
(
x
int
(
10
),
row_start
bigint
(
20
)
unsigned
as
row
start
,
row_end
bigint
(
20
)
unsigned
as
row
end
,
period
for
system_time
(
row_start
,
row_end
)
)
with
system
versioning
;
begin
;
insert
into
t1
(
x
)
values
(
1
);
delete
from
t1
;
commit
;
select
x
from
t1
for
system_time
all
;
insert
into
t1
(
x
)
values
(
2
);
begin
;
update
t1
set
x
=
3
;
update
t1
set
x
=
4
;
commit
;
select
x
,
row_start
<
row_end
from
t1
for
system_time
all
;
drop
database
test
;
create
database
test
;
sql/table.cc
View file @
72dd813f
...
...
@@ -6403,11 +6403,9 @@ void TABLE::mark_columns_needed_for_delete()
if
(
need_signal
)
file
->
column_bitmaps_signal
();
/*
For System Versioning we have to write and read Sys_end.
*/
if
(
s
->
versioned
)
{
bitmap_set_bit
(
read_set
,
s
->
vers_start_field
()
->
field_index
);
bitmap_set_bit
(
read_set
,
s
->
vers_end_field
()
->
field_index
);
bitmap_set_bit
(
write_set
,
s
->
vers_end_field
()
->
field_index
);
}
...
...
storage/innobase/handler/ha_innodb.cc
View file @
72dd813f
...
...
@@ -8948,6 +8948,7 @@ ha_innobase::delete_row(
/* This is a delete */
m_prebuilt
->
upd_node
->
is_delete
=
table
->
versioned_write
(
VERS_TRX_ID
)
&&
table
->
vers_end_field
()
->
is_max
()
&&
trx
->
id
!=
table
->
vers_start_id
()
?
VERSIONED_DELETE
:
PLAIN_DELETE
;
...
...
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