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
f9714ef6
Commit
f9714ef6
authored
Nov 15, 2017
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: open TRT only after versioned write [#305]
parent
a1e5b4a3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
28 deletions
+31
-28
sql/handler.cc
sql/handler.cc
+6
-17
sql/handler.h
sql/handler.h
+1
-11
sql/sql_class.cc
sql/sql_class.cc
+7
-0
sql/sql_class.h
sql/sql_class.h
+3
-0
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+9
-0
storage/innobase/handler/ha_innodb.h
storage/innobase/handler/ha_innodb.h
+2
-0
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+3
-0
No files found.
sql/handler.cc
View file @
f9714ef6
...
...
@@ -1416,22 +1416,13 @@ int ha_commit_trans(THD *thd, bool all)
if
(
rw_trans
||
thd
->
lex
->
sql_command
==
SQLCOM_ALTER_TABLE
)
{
for
(
Ha_trx_info
*
hi
=
ha_info
;
hi
;
hi
=
hi
->
next
()
)
if
(
opt_transaction_registry
&&
thd
->
vers_update_trt
)
{
handlerton
*
ht
=
hi
->
ht
();
if
(
opt_transaction_registry
&&
(
ht
->
flags
&
HTON_NATIVE_SYS_VERSIONING
)
&&
(
thd
->
lex
->
sql_command
==
SQLCOM_ALTER_TABLE
?
hi
->
is_trx_tmp_read_write
()
:
hi
->
is_trx_read_write
()))
{
TR_table
trt
(
thd
,
true
);
if
(
trt
.
update
())
goto
err
;
if
(
all
)
commit_one_phase_2
(
thd
,
false
,
&
thd
->
transaction
.
stmt
,
false
);
break
;
}
TR_table
trt
(
thd
,
true
);
if
(
trt
.
update
())
goto
err
;
if
(
all
)
commit_one_phase_2
(
thd
,
false
,
&
thd
->
transaction
.
stmt
,
false
);
}
}
...
...
@@ -4075,8 +4066,6 @@ void handler::mark_trx_read_write_internal()
*/
if
(
table_share
==
NULL
||
table_share
->
tmp_table
==
NO_TMP_TABLE
)
ha_info
->
set_trx_read_write
();
else
ha_info
->
set_trx_tmp_read_write
();
}
}
...
...
sql/handler.h
View file @
f9714ef6
...
...
@@ -1582,21 +1582,11 @@ class Ha_trx_info
DBUG_ASSERT
(
is_started
());
m_flags
|=
(
int
)
TRX_READ_WRITE
;
}
void
set_trx_tmp_read_write
()
{
DBUG_ASSERT
(
is_started
());
m_flags
|=
(
int
)
TRX_TMP_READ_WRITE
;
}
bool
is_trx_read_write
()
const
{
DBUG_ASSERT
(
is_started
());
return
m_flags
&
(
int
)
TRX_READ_WRITE
;
}
bool
is_trx_tmp_read_write
()
const
{
DBUG_ASSERT
(
is_started
());
return
m_flags
&
(
int
)
(
TRX_READ_WRITE
|
TRX_TMP_READ_WRITE
);
}
bool
is_started
()
const
{
return
m_ht
!=
NULL
;
}
/** Mark this transaction read-write if the argument is read-write. */
void
coalesce_trx_with
(
const
Ha_trx_info
*
stmt_trx
)
...
...
@@ -1621,7 +1611,7 @@ class Ha_trx_info
return
m_ht
;
}
private:
enum
{
TRX_READ_ONLY
=
0
,
TRX_READ_WRITE
=
1
,
TRX_TMP_READ_WRITE
=
2
};
enum
{
TRX_READ_ONLY
=
0
,
TRX_READ_WRITE
=
1
};
/** Auxiliary, used for ha_list management */
Ha_trx_info
*
m_next
;
/**
...
...
sql/sql_class.cc
View file @
f9714ef6
...
...
@@ -716,6 +716,11 @@ Time_zone * thd_get_timezone(THD * thd)
return
thd
->
variables
.
time_zone
;
}
void
thd_vers_update_trt
(
THD
*
thd
)
{
thd
->
vers_update_trt
=
true
;
}
THD
::
THD
(
my_thread_id
id
,
bool
is_wsrep_applier
)
:
Statement
(
&
main_lex
,
&
main_mem_root
,
STMT_CONVENTIONAL_EXECUTION
,
/* statement id */
0
),
...
...
@@ -1348,6 +1353,8 @@ void THD::init(void)
wsrep_skip_wsrep_GTID
=
false
;
#endif
/* WITH_WSREP */
vers_update_trt
=
false
;
if
(
variables
.
sql_log_bin
)
variables
.
option_bits
|=
OPTION_BIN_LOG
;
else
...
...
sql/sql_class.h
View file @
f9714ef6
...
...
@@ -4542,6 +4542,9 @@ class THD :public Statement,
/* Handling of timeouts for commands */
thr_timer_t
query_timer
;
bool
vers_update_trt
;
public
:
void
set_query_timer
()
{
...
...
storage/innobase/handler/ha_innodb.cc
View file @
f9714ef6
...
...
@@ -8380,6 +8380,9 @@ ha_innobase::write_row(
/* Step-5: Execute insert graph that will result in actual insert. */
error
=
row_insert_for_mysql
((
byte
*
)
record
,
m_prebuilt
,
vers_set_fields
);
if
(
m_prebuilt
->
trx
->
vers_update_trt
)
thd_vers_update_trt
(
m_user_thd
);
DEBUG_SYNC
(
m_user_thd
,
"ib_after_row_insert"
);
/* Step-6: Handling of errors related to auto-increment. */
...
...
@@ -9199,6 +9202,9 @@ ha_innobase::update_row(
error
=
row_insert_for_mysql
((
byte
*
)
old_row
,
m_prebuilt
,
ROW_INS_HISTORICAL
);
}
if
(
m_prebuilt
->
trx
->
vers_update_trt
)
thd_vers_update_trt
(
m_user_thd
);
if
(
error
==
DB_SUCCESS
&&
autoinc
)
{
/* A value for an AUTO_INCREMENT column
was specified in the UPDATE statement. */
...
...
@@ -9318,6 +9324,9 @@ ha_innobase::delete_row(
error
=
row_update_for_mysql
(
m_prebuilt
,
vers_set_fields
);
if
(
m_prebuilt
->
trx
->
vers_update_trt
)
thd_vers_update_trt
(
m_user_thd
);
innobase_srv_conc_exit_innodb
(
m_prebuilt
);
/* Tell the InnoDB server that there might be work for
...
...
storage/innobase/handler/ha_innodb.h
View file @
f9714ef6
...
...
@@ -586,6 +586,8 @@ bool thd_is_strict_mode(const MYSQL_THD thd);
*/
extern
void
mysql_bin_log_commit_pos
(
THD
*
thd
,
ulonglong
*
out_pos
,
const
char
**
out_file
);
extern
void
thd_vers_update_trt
(
THD
*
thd
);
/** Get the partition_info working copy.
@param thd Thread object.
@return NULL or pointer to partition_info working copy. */
...
...
storage/innobase/handler/handler0alter.cc
View file @
f9714ef6
...
...
@@ -7079,6 +7079,9 @@ ha_innobase::inplace_alter_table(
ctx
->
m_stage
,
add_v
,
eval_table
,
ha_alter_info
->
handler_flags
&
Alter_inplace_info
::
ALTER_DROP_HISTORICAL
);
if
(
m_prebuilt
->
trx
->
vers_update_trt
)
thd_vers_update_trt
(
m_user_thd
);
#ifndef DBUG_OFF
oom:
#endif
/* !DBUG_OFF */
...
...
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