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
5dea5165
Commit
5dea5165
authored
Oct 20, 2016
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IB: optimized update for non-versioned fields
Fixes #53
parent
01c9d1c9
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
57 additions
and
24 deletions
+57
-24
mysql-test/suite/versioning/r/update.result
mysql-test/suite/versioning/r/update.result
+25
-12
mysql-test/suite/versioning/t/auto_increment.test
mysql-test/suite/versioning/t/auto_increment.test
+1
-0
mysql-test/suite/versioning/t/update.test
mysql-test/suite/versioning/t/update.test
+7
-8
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+17
-1
storage/innobase/include/row0upd.h
storage/innobase/include/row0upd.h
+1
-0
storage/innobase/row/row0ins.cc
storage/innobase/row/row0ins.cc
+2
-2
storage/innobase/row/row0mysql.cc
storage/innobase/row/row0mysql.cc
+2
-1
storage/innobase/row/row0upd.cc
storage/innobase/row/row0upd.cc
+2
-0
No files found.
mysql-test/suite/versioning/r/update.result
View file @
5dea5165
...
...
@@ -56,19 +56,19 @@ begin
set @str= concat('
create table t1 (
id bigint primary key,
a
int,
b
int without system versioning)
x
int,
y
int without system versioning)
with system versioning
engine ', engine);
prepare stmt from @str; execute stmt; drop prepare stmt;
insert into t1 values(1, 1, 1);
set @ins_t= now(6);
select sys_trx_start into @tmp1 from t1;
update t1 set
a=11, b=11 where id=
1;
select @tmp1 < sys_trx_start
, a, b
from t1;
update t1 set
x= 11, y= 11 where id =
1;
select @tmp1 < sys_trx_start
as A1, x, y
from t1;
select sys_trx_start into @tmp1 from t1;
update t1 set
b=1 where id=
1;
select @tmp1 = sys_trx_start
, b
from t1;
update t1 set
y= 1 where id =
1;
select @tmp1 = sys_trx_start
as A2, x
from t1;
drop table t1;
end~~
create procedure test_03(
...
...
@@ -292,15 +292,15 @@ x y
8 8000
9 9000
call test_02('timestamp(6)', 'myisam', 'sys_end');
@tmp1 < sys_trx_start a b
A1 x y
1 11 11
@tmp1 = sys_trx_start b
1 1
A2 x
1 1
1
call test_02('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
@tmp1 < sys_trx_start a b
A1 x y
1 11 11
@tmp1 = sys_trx_start b
0
1
A2 x
1 1
1
call test_03('timestamp(6)', 'myisam', 'sys_end');
x y
1 1
...
...
@@ -489,6 +489,15 @@ B1 salary
1 2500
B2 salary
1 2500
call test_07('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
A1 name
1 Jerry
A2 name
1 Jerry
B1 salary
1 2500
B2 salary
1 2500
call verify_vtq;
No A B C D
1 1 1 1 1
...
...
@@ -509,6 +518,10 @@ No A B C D
16 1 1 1 1
17 1 1 1 1
18 1 1 1 1
19 1 1 1 1
20 1 1 1 1
21 1 1 1 1
22 1 1 1 1
drop procedure test_01;
drop procedure test_02;
drop procedure test_03;
...
...
mysql-test/suite/versioning/t/auto_increment.test
View file @
5dea5165
...
...
@@ -65,3 +65,4 @@ call verify_vtq;
drop
procedure
test_01
;
drop
procedure
verify_vtq
;
mysql-test/suite/versioning/t/update.test
View file @
5dea5165
...
...
@@ -43,20 +43,20 @@ begin
set
@
str
=
concat
(
'
create table t1 (
id bigint primary key,
a
int,
b
int without system versioning)
x
int,
y
int without system versioning)
with system versioning
engine '
,
engine
);
prepare
stmt
from
@
str
;
execute
stmt
;
drop
prepare
stmt
;
insert
into
t1
values
(
1
,
1
,
1
);
set
@
ins_t
=
now
(
6
);
select
sys_trx_start
into
@
tmp1
from
t1
;
update
t1
set
a
=
11
,
b
=
11
where
id
=
1
;
select
@
tmp1
<
sys_trx_start
,
a
,
b
from
t1
;
update
t1
set
x
=
11
,
y
=
11
where
id
=
1
;
select
@
tmp1
<
sys_trx_start
as
A1
,
x
,
y
from
t1
;
select
sys_trx_start
into
@
tmp1
from
t1
;
update
t1
set
b
=
1
where
id
=
1
;
select
@
tmp1
=
sys_trx_start
,
b
from
t1
;
update
t1
set
y
=
1
where
id
=
1
;
select
@
tmp1
=
sys_trx_start
as
A2
,
x
from
t1
;
drop
table
t1
;
end
~~
...
...
@@ -252,8 +252,7 @@ call test_06('timestamp(6)', 'myisam', 'sys_end');
call
test_06
(
'bigint unsigned'
,
'innodb'
,
'commit_ts(sys_end)'
);
call
test_07
(
'timestamp(6)'
,
'myisam'
,
'sys_end'
);
# Issue #53
# call test_07('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
call
test_07
(
'bigint unsigned'
,
'innodb'
,
'commit_ts(sys_end)'
);
call
verify_vtq
;
...
...
storage/innobase/handler/ha_innodb.cc
View file @
5dea5165
...
...
@@ -8959,6 +8959,8 @@ calc_row_difference(
/* We use upd_buff to convert changed fields */
buf
=
(
byte
*
)
upd_buff
;
prebuilt
->
upd_node
->
versioned
=
false
;
for
(
i
=
0
;
i
<
table
->
s
->
fields
;
i
++
)
{
field
=
table
->
field
[
i
];
bool
is_virtual
=
innobase_is_v_fld
(
field
);
...
...
@@ -9199,6 +9201,13 @@ calc_row_difference(
}
n_changed
++
;
if
(
!
prebuilt
->
upd_node
->
versioned
&&
DICT_TF2_FLAG_IS_SET
(
prebuilt
->
table
,
DICT_TF2_VERSIONED
)
&&
!
(
field
->
flags
&
WITHOUT_SYSTEM_VERSIONING_FLAG
))
{
prebuilt
->
upd_node
->
versioned
=
true
;
}
/* If an FTS indexed column was changed by this
UPDATE then we need to inform the FTS sub-system.
...
...
@@ -9303,6 +9312,13 @@ calc_row_difference(
innodb_table
,
ufield
,
&
trx
->
fts_next_doc_id
);
++
n_changed
;
if
(
!
prebuilt
->
upd_node
->
versioned
&&
DICT_TF2_FLAG_IS_SET
(
prebuilt
->
table
,
DICT_TF2_VERSIONED
)
&&
!
(
field
->
flags
&
WITHOUT_SYSTEM_VERSIONING_FLAG
))
{
prebuilt
->
upd_node
->
versioned
=
true
;
}
}
else
{
/* We have a Doc ID column, but none of FTS indexed
columns are touched, nor the Doc ID column, so set
...
...
@@ -9486,7 +9502,7 @@ ha_innobase::update_row(
error
=
row_update_for_mysql
((
byte
*
)
old_row
,
m_prebuilt
);
if
(
error
==
DB_SUCCESS
&&
DICT_TF2_FLAG_IS_SET
(
m_prebuilt
->
table
,
DICT_TF2_VERSIONED
)
)
{
if
(
error
==
DB_SUCCESS
&&
m_prebuilt
->
upd_node
->
versioned
)
{
if
(
trx
->
id
!=
static_cast
<
trx_id_t
>
(
table
->
vers_start_field
()
->
val_int
()))
error
=
row_insert_for_mysql
((
byte
*
)
old_row
,
m_prebuilt
,
true
);
}
...
...
storage/innobase/include/row0upd.h
View file @
5dea5165
...
...
@@ -582,6 +582,7 @@ struct upd_node_t{
compilation; speeds up execution:
UPD_NODE_NO_ORD_CHANGE and
UPD_NODE_NO_SIZE_CHANGE, ORed */
bool
versioned
;
/* update is versioned */
/*----------------------*/
/* Local storage for this graph node */
ulint
state
;
/*!< node execution state */
...
...
storage/innobase/row/row0ins.cc
View file @
5dea5165
...
...
@@ -2854,7 +2854,7 @@ row_ins_sec_index_entry_low(
cursor
.
thr
=
thr
;
cursor
.
rtr_info
=
NULL
;
ut_ad
(
thr_get_trx
(
thr
)
->
id
!=
0
);
ut_ad
(
t
rx
&&
trx
->
id
!=
0
||
t
hr_get_trx
(
thr
)
->
id
!=
0
);
mtr_start
(
&
mtr
);
mtr
.
set_named_space
(
index
->
space
);
...
...
@@ -3890,7 +3890,7 @@ void vers_notify_vtq(trx_t* trx)
timeval
begin_ts
,
commit_ts
;
begin_ts
.
tv_sec
=
trx
->
start_time
;
begin_ts
.
tv_usec
=
trx
->
start_time_micro
;
ut_usectime
((
ulint
*
)
&
commit_ts
.
tv_sec
,
(
ulint
*
)
&
commit_ts
.
tv_usec
);
ut_usectime
((
ulong
*
)
&
commit_ts
.
tv_sec
,
(
ulong
*
)
&
commit_ts
.
tv_usec
);
dict_table_copy_types
(
row
,
dict_sys
->
sys_vtq
);
set_row_field_8
(
row
,
DICT_FLD__SYS_VTQ__TRX_ID
,
trx
->
id
,
heap
);
...
...
storage/innobase/row/row0mysql.cc
View file @
5dea5165
...
...
@@ -1957,7 +1957,8 @@ row_update_for_mysql_using_upd_graph(
prebuilt
->
clust_pcur
);
}
if
(
DICT_TF2_FLAG_IS_SET
(
node
->
table
,
DICT_TF2_VERSIONED
))
if
(
DICT_TF2_FLAG_IS_SET
(
node
->
table
,
DICT_TF2_VERSIONED
)
&&
(
node
->
is_delete
||
node
->
versioned
))
{
/* System Versioning: modify update vector to set
sys_trx_start (or sys_trx_end in case of DELETE)
...
...
storage/innobase/row/row0upd.cc
View file @
5dea5165
...
...
@@ -442,6 +442,8 @@ upd_node_create(
node
->
common
.
type
=
QUE_NODE_UPDATE
;
node
->
state
=
UPD_NODE_UPDATE_CLUSTERED
;
node
->
heap
=
mem_heap_create
(
128
);
node
->
cmpl_info
=
0
;
node
->
versioned
=
false
;
node
->
magic_n
=
UPD_NODE_MAGIC_N
;
return
(
node
);
...
...
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