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
e5b98b91
Commit
e5b98b91
authored
Feb 16, 2011
by
Mikael Ronström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Defined private interface to THD variables, first step to plugin API
parent
503294a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
215 additions
and
1 deletion
+215
-1
include/mysql/thread_pool_priv.h
include/mysql/thread_pool_priv.h
+19
-1
sql/sql_class.cc
sql/sql_class.cc
+196
-0
No files found.
include/mysql/thread_pool_priv.h
View file @
e5b98b91
...
@@ -39,8 +39,26 @@
...
@@ -39,8 +39,26 @@
#include <table.h>
#include <table.h>
/* Needed to get access to scheduler variables */
/* Needed to get access to scheduler variables */
void
*
thd_get_scheduler
(
THD
*
thd
);
void
*
thd_get_scheduler_data
(
THD
*
thd
);
void
thd_set_scheduler_data
(
THD
*
thd
,
void
*
data
);
PSI_thread
*
thd_get_psi
(
THD
*
thd
);
PSI_thread
*
thd_get_psi
(
THD
*
thd
);
void
thd_set_psi
(
THD
*
thd
,
PSI_thread
*
psi
);
/* Interface to THD variables and functions */
void
thd_set_killed
(
THD
*
thd
);
void
thd_clear_errors
(
THD
*
thd
);
void
thd_set_thread_stack
(
THD
*
thd
,
char
*
stack_start
);
void
thd_lock_connection_data
(
THD
*
thd
);
void
thd_unlock_connection_data
(
THD
*
thd
);
void
thd_close_connection
(
THD
*
thd
);
THD
*
thd_get_current_thd
();
void
thd_new_connection_setup
(
THD
*
thd
,
char
*
stack_start
);
void
thd_lock_data
(
THD
*
thd
);
void
thd_unlock_data
(
THD
*
thd
);
bool
thd_is_transaction_active
(
THD
*
thd
);
int
thd_connection_has_data
(
THD
*
thd
);
void
thd_set_net_read_write
(
THD
*
thd
,
uint
val
);
void
thd_set_mysys_var
(
THD
*
thd
,
st_my_thread_var
*
mysys_var
);
/*
/*
The thread pool must be able to execute commands using the connection
The thread pool must be able to execute commands using the connection
...
...
sql/sql_class.cc
View file @
e5b98b91
...
@@ -217,26 +217,222 @@ bool foreign_key_prefix(Key *a, Key *b)
...
@@ -217,26 +217,222 @@ bool foreign_key_prefix(Key *a, Key *b)
** Thread specific functions
** Thread specific functions
****************************************************************************/
****************************************************************************/
/**
Get reference to scheduler data object
@param thd THD object
@retval Scheduler data object on THD
*/
void
*
thd_get_scheduler_data
(
THD
*
thd
)
void
*
thd_get_scheduler_data
(
THD
*
thd
)
{
{
return
thd
->
scheduler
.
data
;
return
thd
->
scheduler
.
data
;
}
}
/**
Set reference to Scheduler data object for THD object
@param thd THD object
@param psi Scheduler data object to set on THD
*/
void
thd_set_scheduler_data
(
THD
*
thd
,
void
*
data
)
void
thd_set_scheduler_data
(
THD
*
thd
,
void
*
data
)
{
{
thd
->
scheduler
.
data
=
data
;
thd
->
scheduler
.
data
=
data
;
}
}
/**
Get reference to Performance Schema object for THD object
@param thd THD object
@retval Performance schema object for thread on THD
*/
PSI_thread
*
thd_get_psi
(
THD
*
thd
)
PSI_thread
*
thd_get_psi
(
THD
*
thd
)
{
{
return
thd
->
scheduler
.
m_psi
;
return
thd
->
scheduler
.
m_psi
;
}
}
/**
Set reference to Performance Schema object for THD object
@param thd THD object
@param psi Performance schema object for thread
*/
void
thd_set_psi
(
THD
*
thd
,
PSI_thread
*
psi
)
void
thd_set_psi
(
THD
*
thd
,
PSI_thread
*
psi
)
{
{
thd
->
scheduler
.
m_psi
=
psi
;
thd
->
scheduler
.
m_psi
=
psi
;
}
}
/**
Set the state on connection to killed
@param thd THD object
*/
void
thd_set_killed
(
THD
*
thd
)
{
thd
->
killed
=
THD
::
KILL_CONNECTION
;
}
/**
Clear errors from the previous THD
@param thd THD object
*/
void
thd_clear_errors
(
THD
*
thd
)
{
my_errno
=
0
;
thd
->
mysys_var
->
abort
=
0
;
}
/**
Set thread stack in THD object
@param thd Thread object
@param stack_start Start of stack to set in THD object
*/
void
thd_set_thread_stack
(
THD
*
thd
,
char
*
stack_start
)
{
thd
->
thread_stack
=
stack_start
;
}
/**
Lock connection data for the set of connections this connection
belongs to
@param thd THD object
*/
void
thd_lock_connection_data
(
THD
*
thd
)
{
(
void
)
thd
;
mysql_mutex_lock
(
&
LOCK_thread_count
);
}
/**
Lock connection data for the set of connections this connection
belongs to
@param thd THD object
*/
void
thd_unlock_connection_data
(
THD
*
thd
)
{
(
void
)
thd
;
mysql_cond_broadcast
(
&
COND_thread_count
);
mysql_mutex_unlock
(
&
LOCK_thread_count
);
}
/**
Close the socket used by this connection
@param thd THD object
*/
void
thd_close_connection
(
THD
*
thd
)
{
if
(
thd
->
net
.
vio
)
vio_close
(
thd
->
net
.
vio
);
}
/**
Get current THD object from thread local data
@retval The THD object for the thread, NULL if not connection thread
*/
THD
*
thd_get_current_thd
()
{
return
current_thd
;
}
/**
Set up various THD data for a new connection
thd_new_connection_setup
@param thd THD object
@param stack_start Start of stack for connection
*/
void
thd_new_connection_setup
(
THD
*
thd
,
char
*
stack_start
)
{
#ifdef HAVE_PSI_INTERFACE
if
(
PSI_server
)
thd_set_psi
(
thd
,
PSI_server
->
new_thread
(
key_thread_one_connection
,
thd
,
thd_get_thread_id
((
MYSQL_THD
)
thd
)));
#endif
thd
->
set_time
();
thd
->
prior_thr_create_utime
=
thd
->
thr_create_utime
=
thd
->
start_utime
=
my_micro_time
();
threads
.
append
(
thd
);
thd_unlock_connection_data
(
thd
);
DBUG_PRINT
(
"info"
,
(
"init new connection. thd: 0x%lx fd: %d"
,
(
ulong
)
thd
,
thd
->
net
.
vio
->
sd
));
thd_set_thread_stack
(
thd
,
stack_start
);
}
/**
Lock data that needs protection in THD object
@param thd THD object
*/
void
thd_lock_data
(
THD
*
thd
)
{
mysql_mutex_lock
(
&
thd
->
LOCK_thd_data
);
}
/**
Unlock data that needs protection in THD object
@param thd THD object
*/
void
thd_unlock_data
(
THD
*
thd
)
{
mysql_mutex_unlock
(
&
thd
->
LOCK_thd_data
);
}
/**
Support method to check if connection has already started transcaction
@param client_cntx Low level client context
@retval TRUE if connection already started transaction
*/
bool
thd_is_transaction_active
(
THD
*
thd
)
{
return
thd
->
transaction
.
is_active
();
}
/**
Check if there is buffered data on the socket representing the connection
@param thd THD object
*/
int
thd_connection_has_data
(
THD
*
thd
)
{
Vio
*
vio
=
thd
->
net
.
vio
;
return
vio
->
has_data
(
vio
);
}
/**
Set reading/writing on socket, used by SHOW PROCESSLIST
@param thd THD object
@param val Value to set it to (0 or 1)
*/
void
thd_set_net_read_write
(
THD
*
thd
,
uint
val
)
{
thd
->
net
.
reading_or_writing
=
val
;
}
/**
Set reference to mysys variable in THD object
@param thd THD object
@param mysys_var Reference to set
*/
void
thd_set_mysys_var
(
THD
*
thd
,
st_my_thread_var
*
mysys_var
)
{
thd
->
set_mysys_var
(
mysys_var
);
}
/*
/*
The following functions form part of the C plugin API
The following functions form part of the C plugin API
*/
*/
...
...
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