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
ecc6cd95
Commit
ecc6cd95
authored
Apr 11, 2017
by
kevg
Committed by
Aleksey Midenkov
May 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: Default 'simple' algorithm for InnoDB 'AS OF' [closes #175]
parent
a1d42a6f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
14 deletions
+25
-14
mysql-test/suite/versioning/r/truncate_history.result
mysql-test/suite/versioning/r/truncate_history.result
+1
-2
sql/sql_class.h
sql/sql_class.h
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+12
-12
sql/sys_vars.cc
sql/sys_vars.cc
+6
-0
storage/heap/ha_heap.cc
storage/heap/ha_heap.cc
+5
-0
No files found.
mysql-test/suite/versioning/r/truncate_history.result
View file @
ecc6cd95
...
...
@@ -149,6 +149,7 @@ a
2
select * from t for system_time before timestamp @ts1;
a
1
select * from t for system_time before transaction 2000;
a
1
...
...
@@ -158,13 +159,11 @@ select * from t for system_time all;
a
11
22
1
2
truncate t for system_time before timestamp now(6);
select * from t for system_time all;
a
11
22
2
drop table t;
drop procedure truncate_history_of_t;
sql/sql_class.h
View file @
ecc6cd95
...
...
@@ -710,6 +710,7 @@ typedef struct system_variables
st_vers_current_time
vers_current_time
;
my_bool
vers_force
;
ulong
vers_hide
;
my_bool
vers_innodb_algorithm_simple
;
}
SV
;
/**
...
...
sql/sql_select.cc
View file @
ecc6cd95
...
...
@@ -771,8 +771,6 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr,
}
}
const
static
bool
vers_simple_select
=
false
;
for
(
table
=
tables
;
table
;
table
=
table
->
next_local
)
{
if
(
table
->
table
&&
table
->
table
->
versioned
())
...
...
@@ -831,7 +829,10 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr,
newx
Item_field
(
thd
,
&
slex
->
context
,
table
->
db
,
table
->
alias
,
fend
);
Item
*
row_end2
=
row_end
;
if
(
table
->
table
->
versioned_by_sql
())
bool
tmp_from_ib
=
table
->
table
->
s
->
table_category
==
TABLE_CATEGORY_TEMPORARY
&&
table
->
table
->
vers_start_field
()
->
type
()
==
MYSQL_TYPE_LONGLONG
;
if
(
table
->
table
->
versioned_by_sql
()
&&
!
tmp_from_ib
)
{
if
(
vers_conditions
.
unit
==
UNIT_TRX_ID
)
{
...
...
@@ -839,8 +840,9 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr,
DBUG_RETURN
(
-
1
);
}
}
else
if
(
vers_simple_select
&&
vers_conditions
.
unit
==
UNIT_TIMESTAMP
&&
vers_conditions
.
type
!=
FOR_SYSTEM_TIME_UNSPECIFIED
)
else
if
(
thd
->
variables
.
vers_innodb_algorithm_simple
&&
vers_conditions
.
unit
==
UNIT_TIMESTAMP
&&
vers_conditions
.
type
!=
FOR_SYSTEM_TIME_UNSPECIFIED
)
{
DBUG_ASSERT
(
table
->
table
->
s
&&
table
->
table
->
s
->
db_plugin
);
handlerton
*
hton
=
plugin_hton
(
table
->
table
->
s
->
db_plugin
);
...
...
@@ -859,19 +861,17 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr,
}
Item
*
cond1
=
0
,
*
cond2
=
0
,
*
curr
=
0
;
// Temporary tables of
type HEAP can be created from INNODB tables and
//
thus will
have uint64 type of sys_trx_(start|end) field.
// Temporary tables of
can be created from INNODB tables and thus will
// have uint64 type of sys_trx_(start|end) field.
// They need special handling.
TABLE
*
t
=
table
->
table
;
if
((
t
->
s
->
table_category
==
TABLE_CATEGORY_TEMPORARY
?
t
->
vers_start_field
()
->
type
()
!=
MYSQL_TYPE_LONGLONG
:
t
->
versioned_by_sql
())
||
vers_simple_select
)
if
(
tmp_from_ib
||
t
->
versioned_by_sql
()
||
thd
->
variables
.
vers_innodb_algorithm_simple
)
{
switch
(
vers_conditions
.
type
)
{
case
FOR_SYSTEM_TIME_UNSPECIFIED
:
if
(
table
->
table
->
versioned_by_sql
())
if
(
table
->
table
->
versioned_by_sql
()
&&
!
tmp_from_ib
)
{
MYSQL_TIME
max_time
;
thd
->
variables
.
time_zone
->
gmt_sec_to_TIME
(
&
max_time
,
TIMESTAMP_MAX_VALUE
);
...
...
sql/sys_vars.cc
View file @
ecc6cd95
...
...
@@ -400,6 +400,12 @@ static Sys_var_enum Sys_vers_hide(
"NEVER: don't hide system fields"
,
SESSION_VAR
(
vers_hide
),
CMD_LINE
(
OPT_ARG
),
vers_hide_keywords
,
DEFAULT
(
VERS_HIDE_AUTO
));
static
Sys_var_mybool
Sys_vers_innodb_algorithm_simple
(
"vers_innodb_algorithm_simple"
,
"Use simple algorithm of timestamp handling in InnoDB instead of TRX_SEES"
,
SESSION_VAR
(
vers_innodb_algorithm_simple
),
CMD_LINE
(
OPT_ARG
),
DEFAULT
(
TRUE
));
static
Sys_var_ulonglong
Sys_binlog_cache_size
(
"binlog_cache_size"
,
"The size of the transactional cache for "
"updates to transactional engines for the binary log. "
...
...
storage/heap/ha_heap.cc
View file @
ecc6cd95
...
...
@@ -27,6 +27,9 @@
#include "heapdef.h"
#include "sql_base.h" // enum_tdc_remove_table_type
bool
vtq_query_trx_id
(
THD
*
thd
,
void
*
out
,
ulonglong
in_trx_id
,
vtq_field_t
field
);
static
handler
*
heap_create_handler
(
handlerton
*
hton
,
TABLE_SHARE
*
table
,
MEM_ROOT
*
mem_root
);
...
...
@@ -56,6 +59,8 @@ int heap_init(void *p)
heap_hton
->
panic
=
heap_panic
;
heap_hton
->
flags
=
HTON_CAN_RECREATE
;
heap_hton
->
vers_query_trx_id
=
vtq_query_trx_id
;
return
0
;
}
...
...
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