|
Zero
0.1.0
|
Storage Manager thread. More...
#include <smthread.h>
Classes | |
| class | GlobalThreadList |
| struct | tcb_t |
Static Public Member Functions | |
| static void | timeout_to_timespec (int timeout_ms, struct timespec &when) |
| static void | detach_xct (xct_t *x) |
| static int | lock_timeout () |
| get lock_timeout value More... | |
| static void | set_lock_timeout (int i) |
| Set lock_timeout value. More... | |
| static logrec_t * | get_logbuf () |
| static logrec_t * | get_logbuf2 () |
| static xct_t * | xct () |
| return xct this thread is running More... | |
| static sm_stats_t & | TL_stats () |
| Return thread-local statistics collected for this thread. More... | |
| static long | get_TL_stat (sm_stat_id s) |
| static void | add_from_TL_stats (sm_stats_t &w) |
| Add thread-local stats into the given structure. More... | |
| static queue_based_lock_t::ext_qnode & | get_me3 () |
| TLS variables Exported to sm. More... | |
| static queue_based_lock_t::ext_qnode & | get_me2 () |
| static queue_based_lock_t::ext_qnode & | get_me1 () |
| static queue_based_lock_t::ext_qnode & | get_xlist_mutex_node () |
| static size_t | get_tcb_depth () |
| static void | add_me_to_thread_list () |
| static void | remove_me_from_thread_list () |
| template<typename F > | |
| static void | for_each_thread_stats (F &f) |
Static Private Member Functions | |
| static tcb_t *& | tcb_ptr () |
| static tcb_t & | tcb () |
| static std::shared_ptr< GlobalThreadList > | thread_list () |
Private Attributes | |
| bool | _waiting |
Friends | |
| class | smthread_init_t |
Storage Manager thread.
Associated with an smthread_t is a POSIX thread (pthread_t). This class is in essence a wrapper around POSIX threads. The maximum number of threads a server can create depends on the availability of resources internal to the pthread implementation, (in addition to system-wide parameters), so it is not possible a priori to determine whether creation of a new thread will succeed. Failure will result in a fatal error.
The storage manager keeps its own thread-local state and provides for a little more control over the starting of threads than does the POSIX interface: you can do meaningful work between the time the thread is created and the time it starts to run. The thread constructor creates the underlying pthread_t, which then awaits permission (a pthread condition variable) to continue (signalled by smthread_t::fork).
|
static |
Add thread-local stats into the given structure.
|
inlinestatic |
|
static |
skip skip
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
TLS variables Exported to sm.
skip
|
inlinestatic |
Tells how many transactions are nested.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
get lock_timeout value
|
inlinestatic |
|
inlinestatic |
Set lock_timeout value.
You can give a value WAIT_FOREVER, WAIT_IMMEDIATE, or a positive millisecond value. Every lock request made with WAIT_SPECIFIED_BY_THREAD will use this value.
A transaction can be given its own timeout on ss_m::begin_xct. The transaction's lock timeout is used for every lock request made with WAIT_SPECIFIED_BY_XCT. A transaction begun with WAIT_SPECIFIED_BY_THREAD will use the thread's lock_timeout for the transaction timeout.
All internal storage manager lock requests use WAIT_SPECIFIED_BY_XCT. Since the transaction can defer to the per-thread timeout, the client has control over which timeout to use by choosing the value given at ss_m::begin_xct.
|
inlinestaticprivate |
|
inlinestaticprivate |
returns the transaction object that is currently active. Stack of transactions this thread conveys. tail is the top of the stack, which is the transaction currently outputting logs or processing REDO/UNDOs. The head is always an empty tcb_t instance. The instance is not actually needed, but it makes easier to work with existing codes (which assume only one tcb_t instance).
|
inlinestaticprivate |
|
static |
|
inlinestatic |
Return thread-local statistics collected for this thread.
|
inlinestatic |
return xct this thread is running
|
friend |
|
private |
1.8.12