File double_write_buffer.cpp
FileList > cubrid > src > storage > double_write_buffer.cpp
Go to the source code of this file
#include <assert.h>
#include <math.h>
#include "double_write_buffer.hpp"
#include "system_parameter.h"
#include "thread_daemon.hpp"
#include "thread_entry_task.hpp"
#include "thread_lockfree_hash_map.hpp"
#include "thread_manager.hpp"
#include "log_append.hpp"
#include "log_impl.h"
#include "log_volids.hpp"
#include "boot_sr.h"
#include "perf_monitor.h"
#include "porting_inline.hpp"
#include "memory_wrapper.hpp"
Classes
Public Types
Public Attributes
Public Static Attributes
Public Functions
| Type |
Name |
|
REGISTER_DAEMON (dwb_flush_block)
|
|
REGISTER_DAEMON (dwb_file_sync_helper)
|
| int |
dwb_add_page (THREAD_ENTRY * thread_p, FILEIO_PAGE * io_page_p, VPID * vpid, bool ensure_metadata, DWB_SLOT ** p_dwb_slot)
|
| int |
dwb_create (THREAD_ENTRY * thread_p, const char * dwb_path_p, const char * db_name_p)
|
| void |
dwb_daemons_destroy ()
|
| void |
dwb_daemons_init ()
|
| int |
dwb_destroy (THREAD_ENTRY * thread_p)
|
| void |
dwb_file_sync_helper_daemon_init ()
|
| void |
dwb_file_sync_helper_execute (cubthread::entry & thread_ref)
|
| void |
dwb_flush_block_daemon_init ()
|
| int |
dwb_flush_force (THREAD_ENTRY * thread_p, bool * all_sync)
|
| char * |
dwb_get_volume_name (void)
|
| bool |
dwb_is_created (void)
|
| int |
dwb_load_and_recover_pages (THREAD_ENTRY * thread_p, const char * dwb_path_p, const char * db_name_p)
|
| int |
dwb_read_page (THREAD_ENTRY * thread_p, const VPID * vpid, void * io_page, bool * success)
|
| int |
dwb_recreate (THREAD_ENTRY * thread_p)
|
| int |
dwb_set_data_on_next_slot (THREAD_ENTRY * thread_p, FILEIO_PAGE * io_page_p, bool can_wait, bool ensure_metadata, DWB_SLOT ** p_dwb_slot)
|
| int |
dwb_synchronize (THREAD_ENTRY * thread_p, int vol_fd, const char * vlabel)
|
Public Static Functions
| Type |
Name |
| int |
dwb_acquire_next_slot (THREAD_ENTRY * thread_p, bool can_wait, DWB_SLOT ** p_dwb_slot)
|
| FLUSH_VOLUME_INFO * |
dwb_add_volume_to_block_flush_area (THREAD_ENTRY * thread_p, DWB_BLOCK * block, int vol_fd, bool ensure_metadata)
|
| DWB_WAIT_QUEUE_ENTRY * |
dwb_block_add_wait_queue_entry (DWB_WAIT_QUEUE * wait_queue, void * data)
|
| int |
dwb_block_create_ordered_slots (DWB_BLOCK * block, DWB_SLOT ** p_dwb_ordered_slots, unsigned int * p_ordered_slots_length)
|
| DWB_WAIT_QUEUE_ENTRY * |
dwb_block_disconnect_wait_queue_entry (DWB_WAIT_QUEUE * wait_queue, void * data)
|
| void |
dwb_block_free_wait_queue_entry (DWB_WAIT_QUEUE * wait_queue, DWB_WAIT_QUEUE_ENTRY * wait_queue_entry, int(*)(void *) func)
|
| int |
dwb_check_data_page_is_sane (THREAD_ENTRY * thread_p, DWB_BLOCK * rcv_block, DWB_SLOT * p_dwb_ordered_slots, int * p_num_recoverable_pages)
|
| int |
dwb_compare_slots (const void * arg1, const void * arg2)
|
| int |
dwb_compare_vol_fd (const void * v1, const void * v2)
|
| int |
dwb_create_blocks (THREAD_ENTRY * thread_p, unsigned int num_blocks, unsigned int num_block_pages, DWB_BLOCK ** p_blocks)
|
| int |
dwb_create_internal (THREAD_ENTRY * thread_p, const char * dwb_volume_name, UINT64 * current_position_with_flags)
|
| int |
dwb_debug_check_dwb (THREAD_ENTRY * thread_p, DWB_SLOT * p_dwb_ordered_slots, unsigned int num_pages)
|
| void |
dwb_destroy_internal (THREAD_ENTRY * thread_p, UINT64 * current_position_with_flags)
|
| void |
dwb_destroy_wait_queue (DWB_WAIT_QUEUE * wait_queue, pthread_mutex_t * mutex)
|
| void |
dwb_ends_structure_modification (THREAD_ENTRY * thread_p, UINT64 current_position_with_flags)
|
| int |
dwb_file_sync_helper (THREAD_ENTRY * thread_p)
|
| bool |
dwb_file_sync_helper_daemon_is_running (void)
|
| void |
dwb_finalize_block (DWB_BLOCK * block)
|
| int |
dwb_flush_block (THREAD_ENTRY * thread_p, DWB_BLOCK * block, bool file_sync_helper_can_flush, UINT64 * current_position_with_flags)
|
| bool |
dwb_flush_block_daemon_is_running (void)
|
| int |
dwb_flush_next_block (THREAD_ENTRY * thread_p)
|
| void |
dwb_get_next_block_for_flush (THREAD_ENTRY * thread_p, unsigned int * block_no)
|
| void |
dwb_init_slot (DWB_SLOT * slot)
|
| void |
dwb_init_wait_queue (DWB_WAIT_QUEUE * wait_queue)
|
| void |
dwb_initialize_block (DWB_BLOCK * block, unsigned int block_no, unsigned int count_wb_pages, char * write_buffer, DWB_SLOT * slots, FLUSH_VOLUME_INFO * flush_volumes_info, unsigned int count_flush_volumes_info, unsigned int max_to_flush_vdes)
|
| void |
dwb_initialize_slot (DWB_SLOT * slot, FILEIO_PAGE * io_page, unsigned int position_in_block, unsigned int block_no)
|
| bool |
dwb_is_file_sync_helper_daemon_available (void)
|
| bool |
dwb_is_flush_block_daemon_available (void)
|
| bool |
dwb_load_block_count (unsigned int * p_num_blocks)
|
| bool |
dwb_load_buffer_size (unsigned int * p_double_write_buffer_size)
|
| DWB_WAIT_QUEUE_ENTRY * |
dwb_make_wait_queue_entry (DWB_WAIT_QUEUE * wait_queue, void * data)
|
| void |
dwb_power2_ceil (unsigned int min, unsigned int max, unsigned int * p_value)
|
| void |
dwb_remove_wait_queue_entry (DWB_WAIT_QUEUE * wait_queue, pthread_mutex_t * mutex, void * data, int(*)(void *) func)
|
| void |
dwb_set_slot_data (THREAD_ENTRY * thread_p, DWB_SLOT * dwb_slot, FILEIO_PAGE * io_page_p, bool ensure_metadata)
|
| int |
dwb_set_status_resumed (void * data)
|
| void |
dwb_signal_block_completion (THREAD_ENTRY * thread_p, DWB_BLOCK * dwb_block)
|
| void |
dwb_signal_structure_modificated (THREAD_ENTRY * thread_p)
|
| int |
dwb_signal_waiting_thread (void * data)
|
| void |
dwb_signal_waiting_threads (DWB_WAIT_QUEUE * wait_queue, pthread_mutex_t * mutex)
|
| int |
dwb_slots_hash_compare_key (void * key1, void * key2)
|
| int |
dwb_slots_hash_delete (THREAD_ENTRY * thread_p, DWB_SLOT * slot)
|
| void * |
dwb_slots_hash_entry_alloc (void)
|
| int |
dwb_slots_hash_entry_free (void * entry)
|
| int |
dwb_slots_hash_entry_init (void * entry)
|
| int |
dwb_slots_hash_insert (THREAD_ENTRY * thread_p, VPID * vpid, DWB_SLOT * slot, bool * inserted)
|
| unsigned int |
dwb_slots_hash_key (void * key, int hash_table_size)
|
| int |
dwb_slots_hash_key_copy (void * src, void * dest)
|
| int |
dwb_starts_structure_modification (THREAD_ENTRY * thread_p, UINT64 * current_position_with_flags)
|
| int |
dwb_wait_for_block_completion (THREAD_ENTRY * thread_p, unsigned int block_no)
|
| int |
dwb_wait_for_strucure_modification (THREAD_ENTRY * thread_p)
|
| int |
dwb_write_block (THREAD_ENTRY * thread_p, DWB_BLOCK * block, DWB_SLOT * p_dwb_slots, unsigned int ordered_slots_length, bool file_sync_helper_can_flush, bool remove_from_hash)
|
Macros
| Type |
Name |
| define |
DWB_BLOCKS_STATUS_MASK 0xffffffff00000000
|
| define |
DWB_BLOCK_NUM_PAGES (dwb\_Global.num\_block\_pages)
|
| define |
DWB_CREATE 0x0000000040000000
|
| define |
DWB_CREATE_OR_MODIFY_MASK ([**DWB\_CREATE**](double__write__buffer_8cpp.md#define-dwb_create) \| [**DWB\_MODIFY\_STRUCTURE**](double__write__buffer_8cpp.md#define-dwb_modify_structure))
|
| define |
DWB_ENDS_BLOCK_WRITING (position_with_flags, block_no) /* multi line expression */
|
| define |
DWB_ENDS_CREATION (position_with_flags) ([**assert**](malloc__2__8__3_8c.md#define-assert) ([**DWB\_IS\_CREATED**](double__write__buffer_8cpp.md#define-dwb_is_created) (position\_with\_flags)), (position\_with\_flags) & ~[**DWB\_CREATE**](double__write__buffer_8cpp.md#define-dwb_create))
|
| define |
DWB_ENDS_MODIFYING_STRUCTURE (position_with_flags) ([**assert**](malloc__2__8__3_8c.md#define-assert) ([**DWB\_IS\_MODIFYING\_STRUCTURE**](double__write__buffer_8cpp.md#define-dwb_is_modifying_structure) (position\_with\_flags)), (position\_with\_flags) & ~[**DWB\_MODIFY\_STRUCTURE**](double__write__buffer_8cpp.md#define-dwb_modify_structure))
|
| define |
DWB_FLAG_MASK ([**DWB\_BLOCKS\_STATUS\_MASK**](double__write__buffer_8cpp.md#define-dwb_blocks_status_mask) \| [**DWB\_MODIFY\_STRUCTURE**](double__write__buffer_8cpp.md#define-dwb_modify_structure) \| [**DWB\_CREATE**](double__write__buffer_8cpp.md#define-dwb_create))
|
| define |
DWB_GET_BLOCK_NO_FROM_POSITION (position_with_flags) (([**unsigned**](broker__monitor_8c.md#function-timeout) [**int**](broker__monitor_8c.md#function-timeout)) [**DWB\_GET\_POSITION**](double__write__buffer_8cpp.md#define-dwb_get_position) (position\_with\_flags) >> ([**DWB\_LOG2\_BLOCK\_NUM\_PAGES**](double__write__buffer_8cpp.md#define-dwb_log2_block_num_pages)))
|
| define |
DWB_GET_BLOCK_STATUS (position_with_flags) ((position\_with\_flags) & [**DWB\_BLOCKS\_STATUS\_MASK**](double__write__buffer_8cpp.md#define-dwb_blocks_status_mask))
|
| define |
DWB_GET_BLOCK_VERSION (block) ([**ATOMIC\_INC\_64**](broker__monitor_8c.md#function-timeout) (&block->[**version**](structversion.md), 0ULL))
|
| define |
DWB_GET_NEXT_BLOCK_NO (block_no) ((block\_no) == ([**DWB\_NUM\_TOTAL\_BLOCKS**](double__write__buffer_8cpp.md#define-dwb_num_total_blocks) - 1) ? 0 : ((block\_no) + 1))
|
| define |
DWB_GET_NEXT_POSITION_WITH_FLAGS (position_with_flags) /* multi line expression */
|
| define |
DWB_GET_POSITION (position_with_flags) ((position\_with\_flags) & [**DWB\_POSITION\_MASK**](double__write__buffer_8cpp.md#define-dwb_position_mask))
|
| define |
DWB_GET_POSITION_IN_BLOCK (position_with_flags) (([**DWB\_GET\_POSITION**](double__write__buffer_8cpp.md#define-dwb_get_position) (position\_with\_flags)) & ([**DWB\_BLOCK\_NUM\_PAGES**](double__write__buffer_8cpp.md#define-dwb_block_num_pages) - 1))
|
| define |
DWB_GET_PREV_BLOCK (block_no) (&(dwb\_Global.blocks[[**DWB\_GET\_PREV\_BLOCK\_NO**](double__write__buffer_8cpp.md#define-dwb_get_prev_block_no)(block\_no)]))
|
| define |
DWB_GET_PREV_BLOCK_NO (block_no) ((block\_no) > 0 ? ((block\_no) - 1) : ([**DWB\_NUM\_TOTAL\_BLOCKS**](double__write__buffer_8cpp.md#define-dwb_num_total_blocks) - 1))
|
| define |
DWB_IS_ANY_BLOCK_WRITE_STARTED (position_with_flags) (((position\_with\_flags) & [**DWB\_BLOCKS\_STATUS\_MASK**](double__write__buffer_8cpp.md#define-dwb_blocks_status_mask)) != 0)
|
| define |
DWB_IS_BLOCK_WRITE_STARTED (position_with_flags, block_no) ([**assert**](malloc__2__8__3_8c.md#define-assert) (block\_no < [**DWB\_MAX\_BLOCKS**](double__write__buffer_8cpp.md#define-dwb_max_blocks)), ((position\_with\_flags) & (1[**ULL**](broker__monitor_8c.md#function-timeout) << (63 - (block\_no)))) != 0)
|
| define |
DWB_IS_CREATED (position_with_flags) (((position\_with\_flags) & [**DWB\_CREATE**](double__write__buffer_8cpp.md#define-dwb_create)) != 0)
|
| define |
DWB_IS_MODIFYING_STRUCTURE (position_with_flags) (((position\_with\_flags) & [**DWB\_MODIFY\_STRUCTURE**](double__write__buffer_8cpp.md#define-dwb_modify_structure)) != 0)
|
| define |
DWB_LOG2_BLOCK_NUM_PAGES (dwb\_Global.log2\_num\_block\_pages)
|
| define |
DWB_MAX_BLOCKS 32
|
| define |
DWB_MAX_SIZE (32 \* 1024 \* 1024)
|
| define |
DWB_MIN_BLOCKS 1
|
| define |
DWB_MIN_SIZE (512 \* 1024)
|
| define |
DWB_MODIFY_STRUCTURE 0x0000000080000000
|
| define |
DWB_NOT_CREATED_OR_MODIFYING (position_with_flags) (((position\_with\_flags) & [**DWB\_CREATE\_OR\_MODIFY\_MASK**](double__write__buffer_8cpp.md#define-dwb_create_or_modify_mask)) != [**DWB\_CREATE**](double__write__buffer_8cpp.md#define-dwb_create))
|
| define |
DWB_NUM_TOTAL_BLOCKS (dwb\_Global.num\_blocks)
|
| define |
DWB_NUM_TOTAL_PAGES (dwb\_Global.num\_pages)
|
| define |
DWB_POSITION_MASK 0x000000003fffffff
|
| define |
DWB_RESET_POSITION (position_with_flags) ((position\_with\_flags) & [**DWB\_FLAG\_MASK**](double__write__buffer_8cpp.md#define-dwb_flag_mask))
|
| define |
DWB_SLOTS_FREE_LIST_SIZE 100
|
| define |
DWB_SLOTS_HASH_SIZE 1000
|
| define |
DWB_STARTS_BLOCK_WRITING (position_with_flags, block_no) ([**assert**](malloc__2__8__3_8c.md#define-assert) (block\_no < [**DWB\_MAX\_BLOCKS**](double__write__buffer_8cpp.md#define-dwb_max_blocks)), (position\_with\_flags) \| (1[**ULL**](broker__monitor_8c.md#function-timeout) << (63 - (block\_no))))
|
| define |
DWB_STARTS_CREATION (position_with_flags) ((position\_with\_flags) \| [**DWB\_CREATE**](double__write__buffer_8cpp.md#define-dwb_create))
|
| define |
DWB_STARTS_MODIFYING_STRUCTURE (position_with_flags) ((position\_with\_flags) \| [**DWB\_MODIFY\_STRUCTURE**](double__write__buffer_8cpp.md#define-dwb_modify_structure))
|
| define |
DWB_WAIT_QUEUE_INITIALIZER {[**NULL**](freelistheap_8h.md#define-null), [**NULL**](freelistheap_8h.md#define-null), [**NULL**](freelistheap_8h.md#define-null), 0, 0}
|
| define |
dwb_Log dwb\_Global.logging\_enabled
|
| define |
dwb_check_logging () ([**dwb\_Log**](double__write__buffer_8cpp.md#define-dwb_log) = [**prm\_get\_bool\_value**](system__parameter_8h.md#function-prm_get_bool_value) (PRM\_ID\_DWB\_LOGGING))
|
| define |
dwb_log (...) [**if**](dynamic__load_8c.md#function-if) ([**dwb\_Log**](double__write__buffer_8cpp.md#define-dwb_log)) [**\_er\_log\_debug**](error__manager_8c.md#function-_er_log_debug) ([**ARG\_FILE\_LINE**](error__manager_8h.md#define-arg_file_line), "DWB: " \_\_VA\_ARGS\_\_)
|
| define |
dwb_log_error (...) [**if**](dynamic__load_8c.md#function-if) ([**dwb\_Log**](double__write__buffer_8cpp.md#define-dwb_log)) [**\_er\_log\_debug**](error__manager_8c.md#function-_er_log_debug) ([**ARG\_FILE\_LINE**](error__manager_8h.md#define-arg_file_line), "DWB [**ERROR:**](broker__monitor_8c.md#function-timeout) " \_\_VA\_ARGS\_\_)
|
Public Types Documentation
typedef DOUBLE_WRITE_BUFFER
typedef struct double_write_buffer DOUBLE_WRITE_BUFFER;
typedef DWB_BLOCK
typedef struct double_write_block DWB_BLOCK;
typedef DWB_SLOTS_HASH_ENTRY
typedef struct dwb_slots_hash_entry DWB_SLOTS_HASH_ENTRY;
typedef DWB_WAIT_QUEUE
typedef struct double_write_wait_queue DWB_WAIT_QUEUE;
typedef DWB_WAIT_QUEUE_ENTRY
typedef struct double_write_wait_queue_entry DWB_WAIT_QUEUE_ENTRY;
typedef FLUSH_VOLUME_INFO
typedef struct flush_volume_info FLUSH_VOLUME_INFO;
enum FLUSH_VOLUME_STATUS
enum FLUSH_VOLUME_STATUS {
VOLUME_NOT_FLUSHED,
VOLUME_FLUSHED_BY_DWB_FILE_SYNC_HELPER_THREAD,
VOLUME_FLUSHED_BY_DWB_FLUSH_THREAD
};
typedef dwb_hashmap_type
using dwb_hashmap_type = cubthread::lockfree_hashmap<VPID, dwb_slots_hash_entry>;
Public Attributes Documentation
variable dwb_Volume_name
char dwb_Volume_name[PATH_MAX];
Public Static Attributes Documentation
variable dwb_Global
DOUBLE_WRITE_BUFFER dwb_Global;
variable dwb_file_sync_helper_daemon
cubthread::daemon* dwb_file_sync_helper_daemon;
variable dwb_flush_block_daemon
cubthread::daemon* dwb_flush_block_daemon;
variable slots_entry_Descriptor
LF_ENTRY_DESCRIPTOR slots_entry_Descriptor;
Public Functions Documentation
function REGISTER_DAEMON
REGISTER_DAEMON (
dwb_flush_block
)
function REGISTER_DAEMON
REGISTER_DAEMON (
dwb_file_sync_helper
)
function dwb_add_page
int dwb_add_page (
THREAD_ENTRY * thread_p,
FILEIO_PAGE * io_page_p,
VPID * vpid,
bool ensure_metadata,
DWB_SLOT ** p_dwb_slot
)
function dwb_create
int dwb_create (
THREAD_ENTRY * thread_p,
const char * dwb_path_p,
const char * db_name_p
)
function dwb_daemons_destroy
void dwb_daemons_destroy ()
function dwb_daemons_init
function dwb_destroy
int dwb_destroy (
THREAD_ENTRY * thread_p
)
function dwb_file_sync_helper_daemon_init
void dwb_file_sync_helper_daemon_init ()
function dwb_file_sync_helper_execute
void dwb_file_sync_helper_execute (
cubthread::entry & thread_ref
)
function dwb_flush_block_daemon_init
void dwb_flush_block_daemon_init ()
function dwb_flush_force
int dwb_flush_force (
THREAD_ENTRY * thread_p,
bool * all_sync
)
function dwb_get_volume_name
char * dwb_get_volume_name (
void
)
function dwb_is_created
bool dwb_is_created (
void
)
function dwb_load_and_recover_pages
int dwb_load_and_recover_pages (
THREAD_ENTRY * thread_p,
const char * dwb_path_p,
const char * db_name_p
)
function dwb_read_page
int dwb_read_page (
THREAD_ENTRY * thread_p,
const VPID * vpid,
void * io_page,
bool * success
)
function dwb_recreate
int dwb_recreate (
THREAD_ENTRY * thread_p
)
function dwb_set_data_on_next_slot
int dwb_set_data_on_next_slot (
THREAD_ENTRY * thread_p,
FILEIO_PAGE * io_page_p,
bool can_wait,
bool ensure_metadata,
DWB_SLOT ** p_dwb_slot
)
function dwb_synchronize
int dwb_synchronize (
THREAD_ENTRY * thread_p,
int vol_fd,
const char * vlabel
)
Public Static Functions Documentation
function dwb_acquire_next_slot
static int dwb_acquire_next_slot (
THREAD_ENTRY * thread_p,
bool can_wait,
DWB_SLOT ** p_dwb_slot
)
function dwb_add_volume_to_block_flush_area
static FLUSH_VOLUME_INFO * dwb_add_volume_to_block_flush_area (
THREAD_ENTRY * thread_p,
DWB_BLOCK * block,
int vol_fd,
bool ensure_metadata
)
function dwb_block_add_wait_queue_entry
static DWB_WAIT_QUEUE_ENTRY * dwb_block_add_wait_queue_entry (
DWB_WAIT_QUEUE * wait_queue,
void * data
)
function dwb_block_create_ordered_slots
static int dwb_block_create_ordered_slots (
DWB_BLOCK * block,
DWB_SLOT ** p_dwb_ordered_slots,
unsigned int * p_ordered_slots_length
)
function dwb_block_disconnect_wait_queue_entry
static DWB_WAIT_QUEUE_ENTRY * dwb_block_disconnect_wait_queue_entry (
DWB_WAIT_QUEUE * wait_queue,
void * data
)
function dwb_block_free_wait_queue_entry
static void dwb_block_free_wait_queue_entry (
DWB_WAIT_QUEUE * wait_queue,
DWB_WAIT_QUEUE_ENTRY * wait_queue_entry,
int (*)( void *) func
)
function dwb_check_data_page_is_sane
static int dwb_check_data_page_is_sane (
THREAD_ENTRY * thread_p,
DWB_BLOCK * rcv_block,
DWB_SLOT * p_dwb_ordered_slots,
int * p_num_recoverable_pages
)
function dwb_compare_slots
static int dwb_compare_slots (
const void * arg1,
const void * arg2
)
function dwb_compare_vol_fd
static int dwb_compare_vol_fd (
const void * v1,
const void * v2
)
function dwb_create_blocks
static int dwb_create_blocks (
THREAD_ENTRY * thread_p,
unsigned int num_blocks,
unsigned int num_block_pages,
DWB_BLOCK ** p_blocks
)
function dwb_create_internal
static int dwb_create_internal (
THREAD_ENTRY * thread_p,
const char * dwb_volume_name,
UINT64 * current_position_with_flags
)
function dwb_debug_check_dwb
static int dwb_debug_check_dwb (
THREAD_ENTRY * thread_p,
DWB_SLOT * p_dwb_ordered_slots,
unsigned int num_pages
)
function dwb_destroy_internal
static void dwb_destroy_internal (
THREAD_ENTRY * thread_p,
UINT64 * current_position_with_flags
)
function dwb_destroy_wait_queue
static void dwb_destroy_wait_queue (
DWB_WAIT_QUEUE * wait_queue,
pthread_mutex_t * mutex
)
function dwb_ends_structure_modification
static void dwb_ends_structure_modification (
THREAD_ENTRY * thread_p,
UINT64 current_position_with_flags
)
function dwb_file_sync_helper
static int dwb_file_sync_helper (
THREAD_ENTRY * thread_p
)
function dwb_file_sync_helper_daemon_is_running
static bool dwb_file_sync_helper_daemon_is_running (
void
)
function dwb_finalize_block
static void dwb_finalize_block (
DWB_BLOCK * block
)
function dwb_flush_block
static int dwb_flush_block (
THREAD_ENTRY * thread_p,
DWB_BLOCK * block,
bool file_sync_helper_can_flush,
UINT64 * current_position_with_flags
)
function dwb_flush_block_daemon_is_running
static bool dwb_flush_block_daemon_is_running (
void
)
function dwb_flush_next_block
static int dwb_flush_next_block (
THREAD_ENTRY * thread_p
)
function dwb_get_next_block_for_flush
static void dwb_get_next_block_for_flush (
THREAD_ENTRY * thread_p,
unsigned int * block_no
)
function dwb_init_slot
static void dwb_init_slot (
DWB_SLOT * slot
)
function dwb_init_wait_queue
static void dwb_init_wait_queue (
DWB_WAIT_QUEUE * wait_queue
)
function dwb_initialize_block
static void dwb_initialize_block (
DWB_BLOCK * block,
unsigned int block_no,
unsigned int count_wb_pages,
char * write_buffer,
DWB_SLOT * slots,
FLUSH_VOLUME_INFO * flush_volumes_info,
unsigned int count_flush_volumes_info,
unsigned int max_to_flush_vdes
)
function dwb_initialize_slot
static void dwb_initialize_slot (
DWB_SLOT * slot,
FILEIO_PAGE * io_page,
unsigned int position_in_block,
unsigned int block_no
)
function dwb_is_file_sync_helper_daemon_available
static bool dwb_is_file_sync_helper_daemon_available (
void
)
function dwb_is_flush_block_daemon_available
static bool dwb_is_flush_block_daemon_available (
void
)
function dwb_load_block_count
static bool dwb_load_block_count (
unsigned int * p_num_blocks
)
function dwb_load_buffer_size
static bool dwb_load_buffer_size (
unsigned int * p_double_write_buffer_size
)
function dwb_make_wait_queue_entry
static DWB_WAIT_QUEUE_ENTRY * dwb_make_wait_queue_entry (
DWB_WAIT_QUEUE * wait_queue,
void * data
)
function dwb_power2_ceil
static void dwb_power2_ceil (
unsigned int min,
unsigned int max,
unsigned int * p_value
)
function dwb_remove_wait_queue_entry
static void dwb_remove_wait_queue_entry (
DWB_WAIT_QUEUE * wait_queue,
pthread_mutex_t * mutex,
void * data,
int (*)( void *) func
)
function dwb_set_slot_data
static void dwb_set_slot_data (
THREAD_ENTRY * thread_p,
DWB_SLOT * dwb_slot,
FILEIO_PAGE * io_page_p,
bool ensure_metadata
)
function dwb_set_status_resumed
static int dwb_set_status_resumed (
void * data
)
function dwb_signal_block_completion
static void dwb_signal_block_completion (
THREAD_ENTRY * thread_p,
DWB_BLOCK * dwb_block
)
function dwb_signal_structure_modificated
static void dwb_signal_structure_modificated (
THREAD_ENTRY * thread_p
)
function dwb_signal_waiting_thread
static int dwb_signal_waiting_thread (
void * data
)
function dwb_signal_waiting_threads
static void dwb_signal_waiting_threads (
DWB_WAIT_QUEUE * wait_queue,
pthread_mutex_t * mutex
)
function dwb_slots_hash_compare_key
static int dwb_slots_hash_compare_key (
void * key1,
void * key2
)
function dwb_slots_hash_delete
static int dwb_slots_hash_delete (
THREAD_ENTRY * thread_p,
DWB_SLOT * slot
)
function dwb_slots_hash_entry_alloc
static void * dwb_slots_hash_entry_alloc (
void
)
function dwb_slots_hash_entry_free
static int dwb_slots_hash_entry_free (
void * entry
)
function dwb_slots_hash_entry_init
static int dwb_slots_hash_entry_init (
void * entry
)
function dwb_slots_hash_insert
static int dwb_slots_hash_insert (
THREAD_ENTRY * thread_p,
VPID * vpid,
DWB_SLOT * slot,
bool * inserted
)
function dwb_slots_hash_key
static unsigned int dwb_slots_hash_key (
void * key,
int hash_table_size
)
function dwb_slots_hash_key_copy
static int dwb_slots_hash_key_copy (
void * src,
void * dest
)
function dwb_starts_structure_modification
static int dwb_starts_structure_modification (
THREAD_ENTRY * thread_p,
UINT64 * current_position_with_flags
)
function dwb_wait_for_block_completion
static int dwb_wait_for_block_completion (
THREAD_ENTRY * thread_p,
unsigned int block_no
)
function dwb_wait_for_strucure_modification
static int dwb_wait_for_strucure_modification (
THREAD_ENTRY * thread_p
)
function dwb_write_block
static int dwb_write_block (
THREAD_ENTRY * thread_p,
DWB_BLOCK * block,
DWB_SLOT * p_dwb_slots,
unsigned int ordered_slots_length,
bool file_sync_helper_can_flush,
bool remove_from_hash
)
Macro Definition Documentation
define DWB_BLOCKS_STATUS_MASK
#define DWB_BLOCKS_STATUS_MASK `0xffffffff00000000`
define DWB_BLOCK_NUM_PAGES
#define DWB_BLOCK_NUM_PAGES `(dwb_Global.num_block_pages)`
define DWB_CREATE
#define DWB_CREATE `0x0000000040000000`
define DWB_CREATE_OR_MODIFY_MASK
#define DWB_CREATE_OR_MODIFY_MASK `( DWB_CREATE | DWB_MODIFY_STRUCTURE )`
define DWB_ENDS_BLOCK_WRITING
#define DWB_ENDS_BLOCK_WRITING (
position_with_flags,
block_no
) `/* multi line expression */`
define DWB_ENDS_CREATION
#define DWB_ENDS_CREATION (
position_with_flags
) `( assert ( DWB_IS_CREATED (position_with_flags)), (position_with_flags) & ~ DWB_CREATE )`
define DWB_ENDS_MODIFYING_STRUCTURE
#define DWB_ENDS_MODIFYING_STRUCTURE (
position_with_flags
) `( assert ( DWB_IS_MODIFYING_STRUCTURE (position_with_flags)), (position_with_flags) & ~ DWB_MODIFY_STRUCTURE )`
define DWB_FLAG_MASK
#define DWB_FLAG_MASK `( DWB_BLOCKS_STATUS_MASK | DWB_MODIFY_STRUCTURE | DWB_CREATE )`
define DWB_GET_BLOCK_NO_FROM_POSITION
#define DWB_GET_BLOCK_NO_FROM_POSITION (
position_with_flags
) `(( unsigned int ) DWB_GET_POSITION (position_with_flags) >> ( DWB_LOG2_BLOCK_NUM_PAGES ))`
define DWB_GET_BLOCK_STATUS
#define DWB_GET_BLOCK_STATUS (
position_with_flags
) `((position_with_flags) & DWB_BLOCKS_STATUS_MASK )`
define DWB_GET_BLOCK_VERSION
#define DWB_GET_BLOCK_VERSION (
block
) `( ATOMIC_INC_64 (&block-> version , 0ULL))`
define DWB_GET_NEXT_BLOCK_NO
#define DWB_GET_NEXT_BLOCK_NO (
block_no
) `((block_no) == ( DWB_NUM_TOTAL_BLOCKS - 1) ? 0 : ((block_no) + 1))`
define DWB_GET_NEXT_POSITION_WITH_FLAGS
#define DWB_GET_NEXT_POSITION_WITH_FLAGS (
position_with_flags
) `/* multi line expression */`
define DWB_GET_POSITION
#define DWB_GET_POSITION (
position_with_flags
) `((position_with_flags) & DWB_POSITION_MASK )`
define DWB_GET_POSITION_IN_BLOCK
#define DWB_GET_POSITION_IN_BLOCK (
position_with_flags
) `(( DWB_GET_POSITION (position_with_flags)) & ( DWB_BLOCK_NUM_PAGES - 1))`
define DWB_GET_PREV_BLOCK
#define DWB_GET_PREV_BLOCK (
block_no
) `(&(dwb_Global.blocks[ DWB_GET_PREV_BLOCK_NO (block_no)]))`
define DWB_GET_PREV_BLOCK_NO
#define DWB_GET_PREV_BLOCK_NO (
block_no
) `((block_no) > 0 ? ((block_no) - 1) : ( DWB_NUM_TOTAL_BLOCKS - 1))`
define DWB_IS_ANY_BLOCK_WRITE_STARTED
#define DWB_IS_ANY_BLOCK_WRITE_STARTED (
position_with_flags
) `(((position_with_flags) & DWB_BLOCKS_STATUS_MASK ) != 0)`
define DWB_IS_BLOCK_WRITE_STARTED
#define DWB_IS_BLOCK_WRITE_STARTED (
position_with_flags,
block_no
) `( assert (block_no < DWB_MAX_BLOCKS ), ((position_with_flags) & (1 ULL << (63 - (block_no)))) != 0)`
define DWB_IS_CREATED
#define DWB_IS_CREATED (
position_with_flags
) `(((position_with_flags) & DWB_CREATE ) != 0)`
define DWB_IS_MODIFYING_STRUCTURE
#define DWB_IS_MODIFYING_STRUCTURE (
position_with_flags
) `(((position_with_flags) & DWB_MODIFY_STRUCTURE ) != 0)`
define DWB_LOG2_BLOCK_NUM_PAGES
#define DWB_LOG2_BLOCK_NUM_PAGES `(dwb_Global.log2_num_block_pages)`
define DWB_MAX_BLOCKS
#define DWB_MAX_BLOCKS `32`
define DWB_MAX_SIZE
#define DWB_MAX_SIZE `(32 * 1024 * 1024)`
define DWB_MIN_BLOCKS
#define DWB_MIN_BLOCKS `1`
define DWB_MIN_SIZE
#define DWB_MIN_SIZE `(512 * 1024)`
define DWB_MODIFY_STRUCTURE
#define DWB_MODIFY_STRUCTURE `0x0000000080000000`
define DWB_NOT_CREATED_OR_MODIFYING
#define DWB_NOT_CREATED_OR_MODIFYING (
position_with_flags
) `(((position_with_flags) & DWB_CREATE_OR_MODIFY_MASK ) != DWB_CREATE )`
define DWB_NUM_TOTAL_BLOCKS
#define DWB_NUM_TOTAL_BLOCKS `(dwb_Global.num_blocks)`
define DWB_NUM_TOTAL_PAGES
#define DWB_NUM_TOTAL_PAGES `(dwb_Global.num_pages)`
define DWB_POSITION_MASK
#define DWB_POSITION_MASK `0x000000003fffffff`
define DWB_RESET_POSITION
#define DWB_RESET_POSITION (
position_with_flags
) `((position_with_flags) & DWB_FLAG_MASK )`
define DWB_SLOTS_FREE_LIST_SIZE
#define DWB_SLOTS_FREE_LIST_SIZE `100`
define DWB_SLOTS_HASH_SIZE
#define DWB_SLOTS_HASH_SIZE `1000`
define DWB_STARTS_BLOCK_WRITING
#define DWB_STARTS_BLOCK_WRITING (
position_with_flags,
block_no
) `( assert (block_no < DWB_MAX_BLOCKS ), (position_with_flags) | (1 ULL << (63 - (block_no))))`
define DWB_STARTS_CREATION
#define DWB_STARTS_CREATION (
position_with_flags
) `((position_with_flags) | DWB_CREATE )`
define DWB_STARTS_MODIFYING_STRUCTURE
#define DWB_STARTS_MODIFYING_STRUCTURE (
position_with_flags
) `((position_with_flags) | DWB_MODIFY_STRUCTURE )`
define DWB_WAIT_QUEUE_INITIALIZER
#define DWB_WAIT_QUEUE_INITIALIZER `{ NULL , NULL , NULL , 0, 0}`
define dwb_Log
#define dwb_Log `dwb_Global.logging_enabled`
define dwb_check_logging
#define dwb_check_logging (
) `( dwb_Log = prm_get_bool_value ( PRM_ID_DWB_LOGGING ))`
define dwb_log
#define dwb_log (
...
) `if ( dwb_Log ) _er_log_debug ( ARG_FILE_LINE , "DWB: " __VA_ARGS__)`
define dwb_log_error
#define dwb_log_error (
...
) `if ( dwb_Log ) _er_log_debug ( ARG_FILE_LINE , "DWB ERROR: " __VA_ARGS__)`
The documentation for this class was generated from the following file cubrid/src/storage/double_write_buffer.cpp