|
Zero
0.1.0
|
The background thread for pre-allocation and garbage collection of object pools used in RAW-style lock manager. More...
#include <lock_raw.h>
Public Member Functions | |
| RawLockBackgroundThread (const sm_options &options, GcPoolForest< RawLock > *lock_pool, GcPoolForest< RawXct > *xct_pool) | |
| ~RawLockBackgroundThread () | |
| void | start () |
| void | stop_synchronous () |
| void | wakeup () |
| void | run_main () |
Static Public Member Functions | |
| static void * | pthread_main (void *t) |
Protected Attributes | |
| pthread_t | _thread |
| pthread_attr_t | _join_attr |
| pthread_mutex_t | _interval_mutex |
| pthread_cond_t | _interval_cond |
| bool | _stop_requested |
| bool | _running |
| int | _dummy_lsn_lock |
| int | _dummy_lsn_xct |
| uint32_t | _generation_count |
| uint32_t | _init_generation_count |
| uint32_t | _free_segment_count |
| uint32_t | _max_segment_count |
| uint32_t | _internal_milliseconds |
| uint32_t | _lockpool_initseg |
| uint32_t | _xctpool_initseg |
| size_t | _lockpool_segsize |
| size_t | _xctpool_segsize |
| GcPoolForest< RawLock > * | _lock_pool |
| GcPoolForest< RawXct > * | _xct_pool |
The background thread for pre-allocation and garbage collection of object pools used in RAW-style lock manager.
The background thread takes intervals between pre-allocation and garbage collection, but might be invoked by hurried transactions by calling wakeup() method.
| RawLockBackgroundThread::RawLockBackgroundThread | ( | const sm_options & | options, |
| GcPoolForest< RawLock > * | lock_pool, | ||
| GcPoolForest< RawXct > * | xct_pool | ||
| ) |
| RawLockBackgroundThread::~RawLockBackgroundThread | ( | ) |
|
static |
Handler for pthread_create. Parameter is this.
| void RawLockBackgroundThread::run_main | ( | ) |
Gut of this class.
| void RawLockBackgroundThread::start | ( | ) |
Start running this thread.
| void RawLockBackgroundThread::stop_synchronous | ( | ) |
Request this thread to stop and wait until it stops.
| void RawLockBackgroundThread::wakeup | ( | ) |
Wakeup this thread to do its job.
|
protected |
When there is no log manager, we still need to do something to invoke retiring. We use this counter to immitate LSN moving forward and retire the last generation. It's unsafe, but so are all no-log executions.
|
protected |
|
protected |
We start pre-allocating segments in current generation if we have less than this number of free segments. sm_rawlock_gc_free_segment_count.
|
protected |
We start retiring generations when there are more than this number of generations. sm_rawlock_gc_generation_count.
|
protected |
When we start up, we pre-allocate this many generations. sm_rawlock_gc_init_generation_count.
|
protected |
How many milliseconds do we sleep as interval. sm_rawlock_gc_interval_ms.
|
protected |
Pthread Condition for taking internal sleep.
|
protected |
Pthread Mutex for taking internal sleep.
|
protected |
To join the thread.
|
protected |
The RawLock pool to take care of.
|
protected |
When we create a new lock generation, we initially pre-allocate this number of segments. sm_rawlock_lockpool_initseg.
|
protected |
How many objects we create in each segment of _lock_pool. sm_rawlock_lockpool_segsize.
|
protected |
We advance generation when there are this number of segments in current generation. sm_rawlock_gc_max_segment_count.
|
protected |
|
protected |
Turned on to stop this thread.
|
protected |
The background pthread thread.
|
protected |
The RawXct pool to take care of.
|
protected |
When we create a new xct generation, we initially pre-allocate this number of segments. sm_rawlock_xctpool_initseg.
|
protected |
How many objects we create in each segment of _xct_pool. sm_rawlock_xctpool_segsize.
1.8.12