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
44518696
Commit
44518696
authored
Nov 24, 2009
by
Konstantin Osipov
Browse files
Options
Browse Files
Download
Plain Diff
No commit message
No commit message
parents
4cff617c
4575f703
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
193 additions
and
198 deletions
+193
-198
sql/sql_insert.cc
sql/sql_insert.cc
+193
-198
No files found.
sql/sql_insert.cc
View file @
44518696
...
...
@@ -2291,9 +2291,42 @@ void kill_delayed_threads(void)
}
static
void
handle_delayed_insert_impl
(
THD
*
thd
,
Delayed_insert
*
di
)
/*
* Create a new delayed insert thread
*/
pthread_handler_t
handle_delayed_insert
(
void
*
arg
)
{
DBUG_ENTER
(
"handle_delayed_insert_impl"
);
Delayed_insert
*
di
=
(
Delayed_insert
*
)
arg
;
THD
*
thd
=
&
di
->
thd
;
pthread_detach_this_thread
();
/* Add thread to THD list so that's it's visible in 'show processlist' */
pthread_mutex_lock
(
&
LOCK_thread_count
);
thd
->
thread_id
=
thd
->
variables
.
pseudo_thread_id
=
thread_id
++
;
thd
->
set_current_time
();
threads
.
append
(
thd
);
thd
->
killed
=
abort_loop
?
THD
::
KILL_CONNECTION
:
THD
::
NOT_KILLED
;
pthread_mutex_unlock
(
&
LOCK_thread_count
);
/*
Wait until the client runs into pthread_cond_wait(),
where we free it after the table is opened and di linked in the list.
If we did not wait here, the client might detect the opened table
before it is linked to the list. It would release LOCK_delayed_create
and allow another thread to create another handler for the same table,
since it does not find one in the list.
*/
pthread_mutex_lock
(
&
di
->
mutex
);
if
(
my_thread_init
())
{
/* Can't use my_error since store_globals has not yet been called */
thd
->
stmt_da
->
set_error_status
(
thd
,
ER_OUT_OF_RESOURCES
,
ER
(
ER_OUT_OF_RESOURCES
),
NULL
);
}
else
{
DBUG_ENTER
(
"handle_delayed_insert"
);
thd
->
thread_stack
=
(
char
*
)
&
thd
;
if
(
init_thr_lock
()
||
thd
->
store_globals
())
{
...
...
@@ -2468,7 +2501,7 @@ static void handle_delayed_insert_impl(THD *thd, Delayed_insert *di)
pthread_cond_broadcast
(
&
di
->
cond_client
);
// If waiting clients
}
err:
err:
/*
mysql_lock_tables() can potentially start a transaction and write
a table map. In the event of an error, that transaction has to be
...
...
@@ -2482,47 +2515,9 @@ static void handle_delayed_insert_impl(THD *thd, Delayed_insert *di)
*/
ha_autocommit_or_rollback
(
thd
,
1
);
DBUG_VOID_RETURN
;
}
/*
* Create a new delayed insert thread
*/
pthread_handler_t
handle_delayed_insert
(
void
*
arg
)
{
Delayed_insert
*
di
=
(
Delayed_insert
*
)
arg
;
THD
*
thd
=
&
di
->
thd
;
pthread_detach_this_thread
();
/* Add thread to THD list so that's it's visible in 'show processlist' */
pthread_mutex_lock
(
&
LOCK_thread_count
);
thd
->
thread_id
=
thd
->
variables
.
pseudo_thread_id
=
thread_id
++
;
thd
->
set_current_time
();
threads
.
append
(
thd
);
thd
->
killed
=
abort_loop
?
THD
::
KILL_CONNECTION
:
THD
::
NOT_KILLED
;
pthread_mutex_unlock
(
&
LOCK_thread_count
);
/*
Wait until the client runs into pthread_cond_wait(),
where we free it after the table is opened and di linked in the list.
If we did not wait here, the client might detect the opened table
before it is linked to the list. It would release LOCK_delayed_create
and allow another thread to create another handler for the same table,
since it does not find one in the list.
*/
pthread_mutex_lock
(
&
di
->
mutex
);
if
(
my_thread_init
())
{
/* Can't use my_error since store_globals has not yet been called */
thd
->
stmt_da
->
set_error_status
(
thd
,
ER_OUT_OF_RESOURCES
,
ER
(
ER_OUT_OF_RESOURCES
),
NULL
);
goto
end
;
DBUG_LEAVE
;
}
handle_delayed_insert_impl
(
thd
,
di
);
end:
/*
di should be unlinked from the thread handler list and have no active
clients
...
...
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