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
c6cd64f3
Commit
c6cd64f3
authored
Jan 17, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.2 into bb-10.2-ext
parents
656f66de
f4401738
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
65 additions
and
36 deletions
+65
-36
sql/sp_head.cc
sql/sp_head.cc
+4
-4
sql/sql_class.cc
sql/sql_class.cc
+9
-5
sql/sql_class.h
sql/sql_class.h
+23
-14
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+4
-4
storage/innobase/btr/btr0cur.cc
storage/innobase/btr/btr0cur.cc
+1
-1
storage/innobase/srv/srv0start.cc
storage/innobase/srv/srv0start.cc
+23
-7
No files found.
sql/sp_head.cc
View file @
c6cd64f3
...
...
@@ -1127,7 +1127,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
We should also save Item tree change list to avoid rollback something
too early in the calling query.
*/
thd
->
change_list
.
move_elements_to
(
&
old_change_list
);
thd
->
Item_change_list
::
move_elements_to
(
&
old_change_list
);
/*
Cursors will use thd->packet, so they may corrupt data which was prepared
for sending by upper level. OTOH cursors in the same routine can share this
...
...
@@ -1266,8 +1266,8 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
/* Restore all saved */
thd
->
server_status
=
(
thd
->
server_status
&
~
status_backup_mask
)
|
old_server_status
;
old_packet
.
swap
(
thd
->
packet
);
DBUG_ASSERT
(
thd
->
change_list
.
is_empty
());
old_change_list
.
move_elements_to
(
&
thd
->
change_list
);
DBUG_ASSERT
(
thd
->
Item_change_list
::
is_empty
());
old_change_list
.
move_elements_to
(
thd
);
thd
->
lex
=
old_lex
;
thd
->
set_query_id
(
old_query_id
);
DBUG_ASSERT
(
!
thd
->
derived_tables
);
...
...
@@ -3043,7 +3043,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
bool
parent_modified_non_trans_table
=
thd
->
transaction
.
stmt
.
modified_non_trans_table
;
thd
->
transaction
.
stmt
.
modified_non_trans_table
=
FALSE
;
DBUG_ASSERT
(
!
thd
->
derived_tables
);
DBUG_ASSERT
(
thd
->
change_list
.
is_empty
());
DBUG_ASSERT
(
thd
->
Item_change_list
::
is_empty
());
/*
Use our own lex.
We should not save old value since it is saved/restored in
...
...
sql/sql_class.cc
View file @
c6cd64f3
...
...
@@ -2720,7 +2720,9 @@ struct Item_change_record: public ilink
thd->mem_root (due to possible set_n_backup_active_arena called for thd).
*/
void
THD
::
nocheck_register_item_tree_change
(
Item
**
place
,
Item
*
old_value
,
void
Item_change_list
::
nocheck_register_item_tree_change
(
Item
**
place
,
Item
*
old_value
,
MEM_ROOT
*
runtime_memroot
)
{
Item_change_record
*
change
;
...
...
@@ -2762,7 +2764,9 @@ void THD::nocheck_register_item_tree_change(Item **place, Item *old_value,
changes to substitute the same reference at both locations L1 and L2.
*/
void
THD
::
check_and_register_item_tree_change
(
Item
**
place
,
Item
**
new_value
,
void
Item_change_list
::
check_and_register_item_tree_change
(
Item
**
place
,
Item
**
new_value
,
MEM_ROOT
*
runtime_memroot
)
{
Item_change_record
*
change
;
...
...
@@ -2778,7 +2782,7 @@ void THD::check_and_register_item_tree_change(Item **place, Item **new_value,
}
void
THD
::
rollback_item_tree_changes
()
void
Item_change_list
::
rollback_item_tree_changes
()
{
I_List_iterator
<
Item_change_record
>
it
(
change_list
);
Item_change_record
*
change
;
...
...
sql/sql_class.h
View file @
c6cd64f3
...
...
@@ -1271,7 +1271,21 @@ class Security_context {
*/
struct
Item_change_record
;
typedef
I_List
<
Item_change_record
>
Item_change_list
;
class
Item_change_list
{
I_List
<
Item_change_record
>
change_list
;
public:
void
nocheck_register_item_tree_change
(
Item
**
place
,
Item
*
old_value
,
MEM_ROOT
*
runtime_memroot
);
void
check_and_register_item_tree_change
(
Item
**
place
,
Item
**
new_value
,
MEM_ROOT
*
runtime_memroot
);
void
rollback_item_tree_changes
();
void
move_elements_to
(
Item_change_list
*
to
)
{
change_list
.
move_elements_to
(
&
to
->
change_list
);
}
bool
is_empty
()
{
return
change_list
.
is_empty
();
}
};
/**
...
...
@@ -2032,6 +2046,14 @@ void dbug_serve_apcs(THD *thd, int n_calls);
*/
class
THD
:
public
Statement
,
/*
This is to track items changed during execution of a prepared
statement/stored procedure. It's created by
nocheck_register_item_tree_change() in memory root of THD,
and freed in rollback_item_tree_changes().
For conventional execution it's always empty.
*/
public
Item_change_list
,
public
MDL_context_owner
,
public
Open_tables_state
{
...
...
@@ -2511,14 +2533,6 @@ class THD :public Statement,
#ifdef SIGNAL_WITH_VIO_CLOSE
Vio
*
active_vio
;
#endif
/*
This is to track items changed during execution of a prepared
statement/stored procedure. It's created by
nocheck_register_item_tree_change() in memory root of THD, and freed in
rollback_item_tree_changes(). For conventional execution it's always
empty.
*/
Item_change_list
change_list
;
/*
A permanent memory area of the statement. For conventional
...
...
@@ -3645,11 +3659,6 @@ class THD :public Statement,
*/
memcpy
((
char
*
)
place
,
new_value
,
sizeof
(
*
new_value
));
}
void
nocheck_register_item_tree_change
(
Item
**
place
,
Item
*
old_value
,
MEM_ROOT
*
runtime_memroot
);
void
check_and_register_item_tree_change
(
Item
**
place
,
Item
**
new_value
,
MEM_ROOT
*
runtime_memroot
);
void
rollback_item_tree_changes
();
/*
Cleanup statement parse state (parse tree, lex) and execution
...
...
sql/sql_parse.cc
View file @
c6cd64f3
...
...
@@ -7957,7 +7957,7 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
sp_cache_enforce_limit
(
thd
->
sp_func_cache
,
stored_program_cache_size
);
thd
->
end_statement
();
thd
->
cleanup_after_query
();
DBUG_ASSERT
(
thd
->
change_list
.
is_empty
());
DBUG_ASSERT
(
thd
->
Item_change_list
::
is_empty
());
}
else
{
...
...
sql/sql_prepare.cc
View file @
c6cd64f3
...
...
@@ -3876,7 +3876,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
If called from a stored procedure, ensure that we won't rollback
external changes when cleaning up after validation.
*/
DBUG_ASSERT
(
thd
->
change_list
.
is_empty
());
DBUG_ASSERT
(
thd
->
Item_change_list
::
is_empty
());
/*
Marker used to release metadata locks acquired while the prepared
...
...
@@ -4353,7 +4353,7 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable)
bool
error
;
Query_arena
*
save_stmt_arena
=
thd
->
stmt_arena
;
Item_change_list
save_change_list
;
thd
->
change_list
.
move_elements_to
(
&
save_change_list
);
thd
->
Item_change_list
::
move_elements_to
(
&
save_change_list
);
state
=
STMT_CONVENTIONAL_EXECUTION
;
...
...
@@ -4372,7 +4372,7 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable)
thd
->
restore_backup_statement
(
this
,
&
stmt_backup
);
thd
->
stmt_arena
=
save_stmt_arena
;
save_change_list
.
move_elements_to
(
&
thd
->
change_list
);
save_change_list
.
move_elements_to
(
thd
);
/* Items and memory will freed in destructor */
...
...
@@ -4600,7 +4600,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
If the free_list is not empty, we'll wrongly free some externally
allocated items when cleaning up after execution of this statement.
*/
DBUG_ASSERT
(
thd
->
change_list
.
is_empty
());
DBUG_ASSERT
(
thd
->
Item_change_list
::
is_empty
());
/*
The only case where we should have items in the thd->free_list is
...
...
storage/innobase/btr/btr0cur.cc
View file @
c6cd64f3
...
...
@@ -3694,7 +3694,7 @@ btr_cur_update_in_place(
#ifdef BTR_CUR_HASH_ADAPT
{
rw_lock_t
*
ahi_latch
=
block
->
index
?
btr_get_search_latch
(
block
->
index
)
:
NULL
;
?
btr_get_search_latch
(
index
)
:
NULL
;
if
(
ahi_latch
)
{
/* TO DO: Can we skip this if none of the fields
index->search_info->curr_n_fields
...
...
storage/innobase/srv/srv0start.cc
View file @
c6cd64f3
...
...
@@ -1446,6 +1446,7 @@ srv_prepare_to_delete_redo_log_files(
<<
" bytes; LSN="
<<
flushed_lsn
;
}
srv_start_lsn
=
flushed_lsn
;
/* Flush the old log files. */
log_mutex_exit
();
...
...
@@ -2246,17 +2247,32 @@ innobase_start_or_create_for_mysql()
recv_sys
->
dblwr
.
pages
.
clear
();
if
(
err
==
DB_SUCCESS
)
{
/* Initialize the change buffer. */
err
=
dict_boot
();
if
(
err
!=
DB_SUCCESS
)
{
return
(
srv_init_abort
(
err
));
}
switch
(
srv_operation
)
{
case
SRV_OPERATION_NORMAL
:
case
SRV_OPERATION_RESTORE_EXPORT
:
/* Initialize the change buffer. */
err
=
dict_boot
();
if
(
err
!=
DB_SUCCESS
)
{
return
(
srv_init_abort
(
err
));
}
/* This must precede
recv_apply_hashed_log_recs(true). */
/* This must precede
recv_apply_hashed_log_recs(true). */
trx_sys_init_at_db_start
();
break
;
case
SRV_OPERATION_RESTORE_DELTA
:
case
SRV_OPERATION_BACKUP
:
ut_ad
(
!
"wrong mariabackup mode"
);
/* fall through */
case
SRV_OPERATION_RESTORE
:
/* mariabackup --prepare only deals with
the redo log and the data files, not with
transactions or the data dictionary. */
break
;
}
if
(
srv_force_recovery
<
SRV_FORCE_NO_LOG_REDO
)
{
/* Apply the hashed log records to the
...
...
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