CUBRID Engine  latest
slotted_page.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "slotted_page.h"
#include "storage_common.h"
#include "memory_alloc.h"
#include "error_manager.h"
#include "system_parameter.h"
#include "memory_hash.h"
#include "object_representation.h"
#include "page_buffer.h"
#include "porting_inline.hpp"
#include "log_manager.h"
#include "critical_section.h"
#include "lock_free.h"
#include "mvcc.h"
#include "dbtype.h"
#include "thread_entry.hpp"
#include "thread_lockfree_hash_map.hpp"
#include "thread_manager.hpp"

Go to the source code of this file.

Classes

struct  spage_save_entry
 
struct  spage_save_head
 
struct  spage_header_context
 
struct  spage_slots_context
 

Macros

#define pthread_mutex_init(a, b)
 
#define pthread_mutex_destroy(a)
 
#define pthread_mutex_lock(a)   0
 
#define pthread_mutex_trylock(a)   0
 
#define pthread_mutex_unlock(a)
 
#define SPAGE_SEARCH_NEXT   1
 
#define SPAGE_SEARCH_PREV   -1
 
#define SPAGE_DB_PAGESIZE   (spage_User_page_size != 0 ? assert (spage_User_page_size == db_page_size ()), spage_User_page_size : db_page_size ())
 
#define SPAGE_VERIFY_HEADER(sphdr)
 
#define SPAGE_OVERFLOW(offset)   ((int) (offset) > SPAGE_DB_PAGESIZE)
 

Typedefs

typedef struct spage_save_entry SPAGE_SAVE_ENTRY
 
typedef struct spage_save_head SPAGE_SAVE_HEAD
 
using spage_saving_hashmap_type = cubthread::lockfree_hashmap< VPID, spage_save_head >
 
typedef struct spage_header_context SPAGE_HEADER_CONTEXT
 
typedef struct spage_slots_context SPAGE_SLOTS_CONTEXT
 

Enumerations

enum  { SPAGE_EMPTY_OFFSET = 0 }
 

Functions

static void * spage_save_head_alloc (void)
 
static int spage_save_head_free (void *entry_p)
 
static int spage_save_head_init (void *entry_p)
 
static int spage_save_head_uninit (void *entry_p)
 
static int spage_save_space (THREAD_ENTRY *thread_p, SPAGE_HEADER *sphdr, PAGE_PTR pgptr, int save)
 
static int spage_get_saved_spaces (THREAD_ENTRY *thread_p, SPAGE_HEADER *page_header_p, PAGE_PTR page_p, int *other_saved_spaces)
 
static int spage_get_saved_spaces_by_other_trans (THREAD_ENTRY *thread_p, SPAGE_HEADER *sphdr, PAGE_PTR pgptr)
 
static int spage_get_total_saved_spaces (THREAD_ENTRY *thread_p, SPAGE_HEADER *page_header_p, PAGE_PTR page_p)
 
static void spage_dump_saved_spaces_by_other_trans (THREAD_ENTRY *thread_p, FILE *fp, VPID *vpid)
 
static int spage_compare_slot_offset (const void *arg1, const void *arg2)
 
static bool spage_is_slotted_page_type (PAGE_TYPE ptype)
 
static int spage_check_space (THREAD_ENTRY *thread_p, PAGE_PTR page_p, SPAGE_HEADER *page_header_p, int space)
 
static void spage_set_slot (SPAGE_SLOT *slot_p, int offset, int length, INT16 type)
 
static int spage_find_empty_slot (THREAD_ENTRY *thread_p, PAGE_PTR pgptr, int length, INT16 type, SPAGE_SLOT **sptr, int *space, PGSLOTID *slotid)
 
static int spage_find_empty_slot_at (THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PGSLOTID slotid, int length, INT16 type, SPAGE_SLOT **sptr)
 
static void spage_shift_slot_up (PAGE_PTR page_p, SPAGE_HEADER *page_header_p, SPAGE_SLOT *slot_p)
 
static void spage_shift_slot_down (PAGE_PTR page_p, SPAGE_HEADER *page_header_p, SPAGE_SLOT *slot_p)
 
static int spage_add_new_slot (THREAD_ENTRY *thread_p, PAGE_PTR page_p, SPAGE_HEADER *page_header_p, int *out_space_p)
 
static int spage_take_slot_in_use (THREAD_ENTRY *thread_p, PAGE_PTR page_p, SPAGE_HEADER *page_header_p, PGSLOTID slot_id, SPAGE_SLOT *slot_p, int *out_space_p)
 
static int spage_check_record_for_insert (RECDES *record_descriptor_p)
 
static int spage_insert_data (THREAD_ENTRY *thread_p, PAGE_PTR pgptr, RECDES *recdes, void *slotptr)
 
static bool spage_is_record_located_at_end (SPAGE_HEADER *page_header_p, SPAGE_SLOT *slot_p)
 
static void spage_reduce_a_slot (PAGE_PTR page_p)
 
static int spage_check_updatable (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int record_descriptor_length, SPAGE_SLOT **out_slot_p, int *out_space_p, int *out_old_waste_p, int *out_new_waste_p)
 
static int spage_check_mvcc_updatable (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int mvcc_delete_record_length, int mvcc_insert_record_length)
 
static int spage_update_record_in_place (PAGE_PTR page_p, SPAGE_HEADER *page_header_p, SPAGE_SLOT *slot_p, const RECDES *record_descriptor_p, int space)
 
static int spage_update_record_after_compact (THREAD_ENTRY *thread_p, PAGE_PTR page_p, SPAGE_HEADER *page_header_p, SPAGE_SLOT *slot_p, const RECDES *record_descriptor_p, int space, int old_waste, int new_waste)
 
static SCAN_CODE spage_search_record (PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking, int direction, bool skip_empty)
 
static const char * spage_record_type_string (INT16 record_type)
 
static void spage_dump_header (FILE *fp, const SPAGE_HEADER *sphdr)
 
static void spage_dump_header_to_string (char *buffer, int size, const SPAGE_HEADER *page_header_p)
 
static void spage_dump_slots (FILE *fp, const SPAGE_SLOT *sptr, PGNSLOTS nslots, unsigned short alignment)
 
static void spage_dump_record (FILE *Fp, PAGE_PTR page_p, PGSLOTID slot_id, SPAGE_SLOT *slot_p)
 
static INLINE bool spage_is_unknown_slot (PGSLOTID slotid, SPAGE_HEADER *sphdr, SPAGE_SLOT *sptr) __attribute__((ALWAYS_INLINE))
 
static INLINE SPAGE_SLOTspage_find_slot (PAGE_PTR pgptr, SPAGE_HEADER *sphdr, PGSLOTID slotid, bool is_unknown_slot_check) __attribute__((ALWAYS_INLINE))
 
static INLINE int spage_find_slot_for_insert (THREAD_ENTRY *thread_p, PAGE_PTR pgptr, RECDES *recdes, PGSLOTID *slotid, void **slotptr, int *used_space) __attribute__((ALWAYS_INLINE))
 
static SCAN_CODE spage_get_record_data (PAGE_PTR pgptr, SPAGE_SLOT *sptr, RECDES *recdes, bool ispeeking)
 
static bool spage_has_enough_total_space (THREAD_ENTRY *thread_p, PAGE_PTR pgptr, SPAGE_HEADER *sphdr, int space)
 
static bool spage_has_enough_contiguous_space (THREAD_ENTRY *thread_p, PAGE_PTR pgptr, SPAGE_HEADER *sphdr, int space)
 
static int spage_put_helper (THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PGSLOTID slotid, int offset, const RECDES *recdes, bool is_append)
 
static void spage_add_contiguous_free_space (PAGE_PTR pgptr, int space)
 
static void spage_reduce_contiguous_free_space (PAGE_PTR pgptr, int space)
 
static INLINE void spage_verify_header (PAGE_PTR page_p) __attribute__((ALWAYS_INLINE))
 
bool spage_is_valid_anchor_type (const INT16 anchor_type)
 
void spage_free_saved_spaces (THREAD_ENTRY *thread_p, void *first_save_entry)
 
void spage_boot (THREAD_ENTRY *thread_p)
 
void spage_finalize (THREAD_ENTRY *thread_p)
 
int spage_slot_size (void)
 
int spage_header_size (void)
 
int spage_max_record_size (void)
 
PGNSLOTS spage_number_of_records (PAGE_PTR page_p)
 
PGNSLOTS spage_number_of_slots (PAGE_PTR page_p)
 
int spage_get_free_space (THREAD_ENTRY *thread_p, PAGE_PTR page_p)
 
int spage_get_free_space_without_saving (THREAD_ENTRY *thread_p, PAGE_PTR page_p, bool *need_update)
 
void spage_set_need_update_best_hint (THREAD_ENTRY *thread_p, PAGE_PTR page_p, bool need_update)
 
int spage_max_space_for_new_record (THREAD_ENTRY *thread_p, PAGE_PTR page_p)
 
void spage_collect_statistics (PAGE_PTR page_p, int *npages, int *nrecords, int *rec_length)
 
void spage_initialize (THREAD_ENTRY *thread_p, PAGE_PTR page_p, INT16 slot_type, unsigned short alignment, bool is_saving)
 
int spage_compact (THREAD_ENTRY *thread_p, PAGE_PTR page_p)
 
PGSLOTID spage_find_free_slot (PAGE_PTR page_p, SPAGE_SLOT **out_slot_p, PGSLOTID start_slot)
 
int spage_insert (THREAD_ENTRY *thread_p, PAGE_PTR page_p, RECDES *record_descriptor_p, PGSLOTID *out_slot_id_p)
 
int spage_insert_at (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p)
 
int spage_insert_for_recovery (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p)
 
PGSLOTID spage_delete (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
 
PGSLOTID spage_delete_for_recovery (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
 
int spage_update (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, const RECDES *record_descriptor_p)
 
bool spage_is_updatable (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int record_descriptor_length)
 
bool spage_is_mvcc_updatable (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int delete_record_length, int insert_record_length)
 
void spage_update_record_type (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, INT16 record_type)
 
bool spage_reclaim (THREAD_ENTRY *thread_p, PAGE_PTR page_p)
 
int spage_split (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int offset, PGSLOTID *out_new_slot_id_p)
 
int spage_take_out (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int takeout_offset, int takeout_length)
 
int spage_append (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, const RECDES *record_descriptor_p)
 
int spage_put (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int offset, const RECDES *record_descriptor_p)
 
int spage_overwrite (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int overwrite_offset, const RECDES *record_descriptor_p)
 
int spage_merge (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID first_slot_id, PGSLOTID second_slot_id)
 
SCAN_CODE spage_next_record (PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
 
SCAN_CODE spage_previous_record (PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
 
SCAN_CODE spage_get_record (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p, int is_peeking)
 
int spage_get_record_length (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
 
int spage_get_space_for_record (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
 
INT16 spage_get_record_type (PAGE_PTR page_p, PGSLOTID slot_id)
 
int spage_mark_deleted_slot_as_reusable (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
 
bool spage_is_slot_exist (PAGE_PTR page_p, PGSLOTID slot_id)
 
const char * spage_anchor_flag_string (const INT16 anchor_type)
 
const char * spage_alignment_string (unsigned short alignment)
 
void spage_dump (THREAD_ENTRY *thread_p, FILE *fp, PAGE_PTR page_p, int is_record_printed)
 
bool spage_check_num_slots (THREAD_ENTRY *thread_p, PAGE_PTR page_p)
 
int spage_check (THREAD_ENTRY *thread_p, PAGE_PTR page_p)
 
int spage_check_slot_owner (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
 
SCAN_CODE spage_next_record_dont_skip_empty (PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
 
SCAN_CODE spage_previous_record_dont_skip_empty (PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
 
SCAN_CODE spage_get_page_header_info (PAGE_PTR page_p, DB_VALUE **page_header_info)
 
int spage_get_record_offset (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
 
SPAGE_SLOTspage_get_slot (PAGE_PTR page_p, PGSLOTID slot_id)
 
void spage_vacuum_slot (THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slotid, bool reusable)
 
int spage_header_start_scan (THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
 
SCAN_CODE spage_header_next_scan (THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
 
int spage_header_end_scan (THREAD_ENTRY *thread_p, void **ptr)
 
int spage_slots_start_scan (THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
 
SCAN_CODE spage_slots_next_scan (THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
 
int spage_slots_end_scan (THREAD_ENTRY *thread_p, void **ptr)
 
bool spage_need_compact (THREAD_ENTRY *thread_p, PAGE_PTR page_p)
 

Variables

static int rv
 
static PGLENGTH spage_User_page_size
 
static LF_ENTRY_DESCRIPTOR spage_Saving_entry_descriptor
 
static spage_saving_hashmap_type spage_Saving_hashmap
 

Macro Definition Documentation

#define pthread_mutex_destroy (   a)

Definition at line 56 of file slotted_page.c.

Referenced by spage_save_head::~spage_save_head().

#define pthread_mutex_init (   a,
 
)

Definition at line 55 of file slotted_page.c.

Referenced by spage_save_head::spage_save_head(), and spage_save_head_alloc().

#define pthread_mutex_lock (   a)    0

Definition at line 57 of file slotted_page.c.

Referenced by spage_free_saved_spaces().

#define pthread_mutex_trylock (   a)    0

Definition at line 58 of file slotted_page.c.

#define pthread_mutex_unlock (   a)
#define SPAGE_SEARCH_NEXT   1
#define SPAGE_SEARCH_PREV   -1

Definition at line 64 of file slotted_page.c.

Referenced by spage_previous_record(), and spage_previous_record_dont_skip_empty().

#define SPAGE_VERIFY_HEADER (   sphdr)
Value:
do { \
assert ((sphdr) != NULL); \
assert ((sphdr)->total_free >= 0); \
assert ((sphdr)->cont_free >= 0); \
assert ((sphdr)->cont_free <= (sphdr)->total_free); \
assert ((sphdr)->offset_to_free_area < SPAGE_DB_PAGESIZE); \
assert ((sphdr)->num_records >= 0); \
assert ((sphdr)->num_slots >= 0); \
assert ((sphdr)->num_records <= (sphdr)->num_slots); \
} while (0)
#define assert(x)
#define NULL
Definition: freelistheap.h:34
#define SPAGE_DB_PAGESIZE
Definition: slotted_page.c:68

Definition at line 71 of file slotted_page.c.

Referenced by spage_add_contiguous_free_space(), spage_add_new_slot(), spage_check(), spage_check_mvcc_updatable(), spage_check_num_slots(), spage_check_slot_owner(), spage_check_updatable(), spage_collect_statistics(), spage_delete(), spage_delete_for_recovery(), spage_find_empty_slot(), spage_find_empty_slot_at(), spage_find_free_slot(), spage_find_slot(), spage_get_free_space(), spage_get_free_space_without_saving(), spage_get_page_header_info(), spage_get_record(), spage_get_record_length(), spage_get_record_offset(), spage_get_record_type(), spage_get_saved_spaces(), spage_get_slot(), spage_get_space_for_record(), spage_has_enough_contiguous_space(), spage_has_enough_total_space(), spage_insert_at(), spage_insert_for_recovery(), spage_is_slot_exist(), spage_is_unknown_slot(), spage_mark_deleted_slot_as_reusable(), spage_max_space_for_new_record(), spage_merge(), spage_need_compact(), spage_number_of_records(), spage_number_of_slots(), spage_overwrite(), spage_put_helper(), spage_reclaim(), spage_reduce_a_slot(), spage_reduce_contiguous_free_space(), spage_save_space(), spage_search_record(), spage_set_need_update_best_hint(), spage_shift_slot_down(), spage_shift_slot_up(), spage_split(), spage_take_out(), spage_take_slot_in_use(), spage_update(), spage_update_record_after_compact(), spage_update_record_in_place(), spage_update_record_type(), and spage_vacuum_slot().

Typedef Documentation

Definition at line 157 of file slotted_page.c.

Definition at line 88 of file slotted_page.c.

Definition at line 89 of file slotted_page.c.

Definition at line 165 of file slotted_page.c.

Enumeration Type Documentation

anonymous enum
Enumerator
SPAGE_EMPTY_OFFSET 

Definition at line 83 of file slotted_page.c.

Function Documentation

static void spage_add_contiguous_free_space ( PAGE_PTR  pgptr,
int  space 
)
static
static int spage_add_new_slot ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
SPAGE_HEADER page_header_p,
int *  out_space_p 
)
static
const char* spage_alignment_string ( unsigned short  alignment)

Definition at line 4166 of file slotted_page.c.

References CHAR_ALIGNMENT, DOUBLE_ALIGNMENT, INT_ALIGNMENT, and SHORT_ALIGNMENT.

Referenced by sort_spage_get_record(), spage_dump_header_to_string(), and spage_header_next_scan().

Here is the caller graph for this function:

const char* spage_anchor_flag_string ( const INT16  anchor_type)

Definition at line 4139 of file slotted_page.c.

References ANCHORED, ANCHORED_DONT_REUSE_SLOTS, assert, UNANCHORED_ANY_SEQUENCE, and UNANCHORED_KEEP_SEQUENCE.

Referenced by sort_spage_get_record(), spage_dump_header_to_string(), and spage_header_next_scan().

Here is the caller graph for this function:

int spage_append ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id,
const RECDES record_descriptor_p 
)

Definition at line 3128 of file slotted_page.c.

References spage_put_helper().

bool spage_check_num_slots ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p 
)
static int spage_check_record_for_insert ( RECDES record_descriptor_p)
static
static int spage_check_space ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
SPAGE_HEADER page_header_p,
int  space 
)
static

Definition at line 1352 of file slotted_page.c.

References SP_DOESNT_FIT, SP_ERROR, SP_SUCCESS, spage_has_enough_contiguous_space(), and spage_has_enough_total_space().

Referenced by spage_add_new_slot(), spage_find_empty_slot(), and spage_take_slot_in_use().

Here is the caller graph for this function:

static int spage_check_updatable ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id,
int  record_descriptor_length,
SPAGE_SLOT **  out_slot_p,
int *  out_space_p,
int *  out_old_waste_p,
int *  out_new_waste_p 
)
static
void spage_collect_statistics ( PAGE_PTR  page_p,
int *  npages,
int *  nrecords,
int *  rec_length 
)
static int spage_compare_slot_offset ( const void *  arg1,
const void *  arg2 
)
static

Definition at line 1135 of file slotted_page.c.

References assert, and NULL.

Referenced by spage_compact().

Here is the caller graph for this function:

PGSLOTID spage_delete ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id 
)

Definition at line 2092 of file slotted_page.c.

References spage_header::alignment, spage_header::anchor_type, ANCHORED, ANCHORED_DONT_REUSE_SLOTS, ARG_FILE_LINE, assert, ASSERT_ALIGN, spage_header::cont_free, DB_WASTED_ALIGN, DONT_FREE, ER_ERROR_SEVERITY, ER_GENERIC_ERROR, er_set(), ER_SP_UNKNOWN_SLOTID, spage_header::is_saving, NO_ERROR, NULL, NULL_SLOTID, spage_header::num_records, spage_header::offset_to_free_area, spage_slot::offset_to_record, pgbuf_get_page_id(), pgbuf_get_volume_label(), pgbuf_set_dirty(), REC_DELETED_WILL_REUSE, REC_MARKDELETED, spage_slot::record_length, spage_slot::record_type, spage_check(), SPAGE_EMPTY_OFFSET, spage_find_slot(), spage_is_record_located_at_end(), spage_is_valid_anchor_type(), spage_reduce_a_slot(), spage_save_space(), spage_shift_slot_down(), SPAGE_VERIFY_HEADER, spage_verify_header(), spage_header::total_free, UNANCHORED_ANY_SEQUENCE, and UNANCHORED_KEEP_SEQUENCE.

Referenced by btree_delete_key_from_leaf(), btree_delete_meta_record(), btree_merge_node(), btree_rv_nodehdr_undo_insert(), btree_rv_pagerec_delete(), btree_rv_record_modify_internal(), btree_split_node(), btree_split_root(), btree_split_test(), catalog_drop_directory(), catalog_drop_representation_helper(), catalog_put_representation_item(), catalog_rv_delete_redo(), ehash_delete(), ehash_distribute_records_into_two_bucket(), ehash_rv_delete(), ehash_rv_delete_redo(), heap_delete_all_page_records(), heap_delete_physical(), heap_rv_redo_delete(), log_rv_record_modify_internal(), spage_delete_for_recovery(), and spage_merge().

void spage_dump ( THREAD_ENTRY thread_p,
FILE *  fp,
PAGE_PTR  page_p,
int  is_record_printed 
)
static void spage_dump_header ( FILE *  fp,
const SPAGE_HEADER sphdr 
)
static

Definition at line 4191 of file slotted_page.c.

References spage_dump_header_to_string().

Referenced by spage_dump().

Here is the caller graph for this function:

static void spage_dump_record ( FILE *  Fp,
PAGE_PTR  page_p,
PGSLOTID  slot_id,
SPAGE_SLOT slot_p 
)
static
static void spage_dump_saved_spaces_by_other_trans ( THREAD_ENTRY thread_p,
FILE *  fp,
VPID vpid 
)
static
static void spage_dump_slots ( FILE *  fp,
const SPAGE_SLOT sptr,
PGNSLOTS  nslots,
unsigned short  alignment 
)
static

Definition at line 4239 of file slotted_page.c.

References assert, DB_WASTED_ALIGN, i, NULL, spage_slot::offset_to_record, spage_slot::record_length, spage_slot::record_type, SPAGE_EMPTY_OFFSET, and spage_record_type_string().

Referenced by spage_dump().

Here is the caller graph for this function:

void spage_finalize ( THREAD_ENTRY thread_p)

Definition at line 816 of file slotted_page.c.

References cubthread::lockfree_hashmap< Key, T >::destroy().

Referenced by boot_server_all_finalize().

Here is the caller graph for this function:

STATIC_INLINE int spage_find_slot_for_insert ( THREAD_ENTRY thread_p,
PAGE_PTR  pgptr,
RECDES recdes,
PGSLOTID slotid,
void **  slotptr,
int *  used_space 
)
static

Definition at line 1809 of file slotted_page.c.

References assert, recdes::length, NULL, NULL_SLOTID, SP_SUCCESS, spage_check(), spage_check_record_for_insert(), spage_find_empty_slot(), and recdes::type.

Referenced by spage_insert().

Here is the caller graph for this function:

int spage_get_free_space ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p 
)
SCAN_CODE spage_get_record ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id,
RECDES record_descriptor_p,
int  is_peeking 
)

Definition at line 3847 of file slotted_page.c.

References ARG_FILE_LINE, assert, ER_ERROR_SEVERITY, er_set(), ER_SP_UNKNOWN_SLOTID, recdes::length, NULL, pgbuf_get_page_id(), pgbuf_get_volume_label(), S_DOESNT_EXIST, spage_find_slot(), spage_get_record_data(), and SPAGE_VERIFY_HEADER.

Referenced by btree_build_nleafs(), btree_change_root_header_delta(), btree_check_page_key(), btree_check_pages(), btree_compress_node(), btree_delete_key_from_leaf(), btree_delete_meta_record(), btree_delete_overflow_key(), btree_dump_leaf_record(), btree_dump_page(), btree_dump_page_with_subtree(), btree_find_AR_sampling_leaf(), btree_find_boundary_leaf(), btree_find_key_from_leaf(), btree_find_key_from_nleaf(), btree_find_lower_bound_leaf(), btree_find_min_or_max_key(), btree_find_next_index_record_holding_current(), btree_find_oid_from_ovfl(), btree_find_oid_with_page_and_record(), btree_find_split_point(), btree_fix_ovfl_oid_page(), btree_get_next_node_info(), btree_get_node_header(), btree_get_num_visible_oids_from_all_ovf(), btree_get_overflow_header(), btree_get_perf_btree_page_type(), btree_get_root_header(), btree_get_stats_key(), btree_get_subtree_capacity(), btree_get_unique_statistics(), btree_get_value_from_leaf_slot(), btree_is_slot_visible(), btree_key_append_object_to_overflow(), btree_key_delete_remove_object(), btree_key_find_and_insert_delete_mvccid(), btree_key_find_and_lock_unique_of_non_unique(), btree_key_find_and_lock_unique_of_unique(), btree_key_find_first_visible_row_from_all_ovf(), btree_key_find_unique_version_oid(), btree_key_insert_delete_mvccid(), btree_key_insert_new_object(), btree_key_lock_and_append_object_unique(), btree_key_online_index_IB_insert(), btree_key_online_index_tran_delete(), btree_key_online_index_tran_insert(), btree_key_online_index_tran_insert_DF(), btree_key_process_objects(), btree_key_record_check_no_visible(), btree_key_remove_delete_mvccid(), btree_key_remove_insert_mvccid(), btree_key_remove_object_and_keep_visible_first(), btree_leaf_is_key_between_min_max(), btree_merge_node(), btree_merge_node_and_advance(), btree_merge_root(), btree_modify_overflow_link(), btree_node_common_prefix(), btree_node_header_redo_log(), btree_node_header_undo_log(), btree_node_is_compressed(), btree_node_size_uncompressed(), btree_overflow_remove_object(), btree_range_scan_advance_over_filtered_keys(), btree_range_scan_find_fk_any_object(), btree_range_scan_select_visible_oids(), btree_read_record(), btree_repair_prev_link_by_btid(), btree_replace_first_oid_with_ovfl_oid(), btree_rv_nodehdr_undoredo_update(), btree_rv_record_modify_internal(), btree_rv_util_save_page_records(), btree_search_leaf_page(), btree_search_nonleaf_page(), btree_set_split_point(), btree_split_node(), btree_split_root(), btree_split_test(), btree_verify_leaf_node(), btree_verify_nonleaf_node(), btree_verify_subtree(), catalog_adjust_directory_count(), catalog_check_class_consistency(), catalog_drop_representation_helper(), catalog_file_map_find_optimal_page(), catalog_file_map_overflow_count(), catalog_file_map_page_dump(), catalog_get_class_info(), catalog_get_record_from_page(), catalog_get_rep_dir(), catalog_get_representation_record(), catalog_put_record_into_page(), catalog_update_class_info(), ehash_binary_search_bucket(), ehash_delete(), ehash_distribute_records_into_two_bucket(), ehash_dump_bucket(), ehash_find_first_bit_position(), ehash_insert_to_bucket(), ehash_map(), ehash_merge_permanent(), ehash_rv_delete(), ehash_rv_delete_redo(), ehash_search(), record_descriptor::get(), heap_check_all_pages(), heap_copy_chain(), heap_copy_header_stats(), heap_delete_bigone(), heap_delete_home(), heap_delete_logical(), heap_delete_relocation(), heap_dump(), heap_estimate(), heap_flush(), heap_get_chain_ptr(), heap_get_class_oid_from_page(), heap_get_header_stats_ptr(), heap_get_if_diff_chn(), heap_get_last_page(), heap_get_mvcc_header(), heap_get_num_objects(), heap_get_page_info(), heap_get_record_data_when_all_ready(), heap_get_record_info(), heap_header_next_scan(), heap_ovf_find_vfid(), heap_page_get_max_mvccid(), heap_page_get_vacuum_status(), heap_page_rv_chain_update(), heap_page_set_vacuum_status_none(), heap_page_update_chain_after_mvcc_op(), heap_prepare_get_context(), heap_reinitialize_page(), heap_remove_page_on_vacuum(), heap_reuse(), heap_rv_mvcc_redo_delete_internal(), heap_rv_mvcc_undo_delete(), heap_rv_redo_reuse_page(), heap_rv_redo_reuse_page_reuse_oid(), heap_stats_find_best_page(), heap_stats_update_internal(), heap_update_home(), heap_update_logical(), heap_update_relocation(), heap_update_set_prev_version(), heap_vpid_next(), heap_vpid_prev(), heap_vpid_remove(), log_rv_record_modify_internal(), page_key_boundary::set_value(), vacuum_heap_prepare_record(), vacuum_rv_check_at_undo(), vacuum_rv_redo_vacuum_heap_page(), and xheap_reclaim_addresses().

static SCAN_CODE spage_get_record_data ( PAGE_PTR  pgptr,
SPAGE_SLOT sptr,
RECDES recdes,
bool  ispeeking 
)
static
int spage_get_record_length ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id 
)
static int spage_get_saved_spaces_by_other_trans ( THREAD_ENTRY thread_p,
SPAGE_HEADER sphdr,
PAGE_PTR  pgptr 
)
static

Definition at line 648 of file slotted_page.c.

References assert, and spage_get_saved_spaces().

SPAGE_SLOT* spage_get_slot ( PAGE_PTR  page_p,
PGSLOTID  slot_id 
)
int spage_get_space_for_record ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id 
)
static int spage_get_total_saved_spaces ( THREAD_ENTRY thread_p,
SPAGE_HEADER page_header_p,
PAGE_PTR  page_p 
)
static

Definition at line 666 of file slotted_page.c.

References spage_header::is_saving, and spage_get_saved_spaces().

Referenced by spage_get_free_space(), spage_has_enough_total_space(), and spage_max_space_for_new_record().

Here is the caller graph for this function:

static bool spage_has_enough_contiguous_space ( THREAD_ENTRY thread_p,
PAGE_PTR  pgptr,
SPAGE_HEADER sphdr,
int  space 
)
static

Definition at line 4656 of file slotted_page.c.

References assert, NO_ERROR, NULL, spage_compact(), and SPAGE_VERIFY_HEADER.

Referenced by spage_check_mvcc_updatable(), spage_check_space(), and spage_find_empty_slot().

Here is the caller graph for this function:

static bool spage_has_enough_total_space ( THREAD_ENTRY thread_p,
PAGE_PTR  pgptr,
SPAGE_HEADER sphdr,
int  space 
)
static
int spage_header_end_scan ( THREAD_ENTRY thread_p,
void **  ptr 
)

Definition at line 5048 of file slotted_page.c.

References db_private_free_and_init, NO_ERROR, and NULL.

Referenced by showstmt_scan_init().

Here is the caller graph for this function:

int spage_header_size ( void  )

Definition at line 837 of file slotted_page.c.

Referenced by btree_find_AR_sampling_leaf().

Here is the caller graph for this function:

static int spage_insert_data ( THREAD_ENTRY thread_p,
PAGE_PTR  pgptr,
RECDES recdes,
void *  slotptr 
)
static
bool spage_is_mvcc_updatable ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id,
int  delete_record_length,
int  insert_record_length 
)

Definition at line 2664 of file slotted_page.c.

References SP_SUCCESS, and spage_check_mvcc_updatable().

static bool spage_is_record_located_at_end ( SPAGE_HEADER page_header_p,
SPAGE_SLOT slot_p 
)
static
bool spage_is_slot_exist ( PAGE_PTR  page_p,
PGSLOTID  slot_id 
)

Definition at line 4078 of file slotted_page.c.

References assert, NULL, REC_DELETED_WILL_REUSE, REC_MARKDELETED, spage_slot::record_type, spage_find_slot(), and SPAGE_VERIFY_HEADER.

Referenced by heap_does_exist().

Here is the caller graph for this function:

static bool spage_is_slotted_page_type ( PAGE_TYPE  ptype)
static

Definition at line 1155 of file slotted_page.c.

References PAGE_BTREE, PAGE_CATALOG, PAGE_EHASH, and PAGE_HEAP.

Referenced by spage_compact(), spage_header_start_scan(), and spage_slots_start_scan().

Here is the caller graph for this function:

STATIC_INLINE bool spage_is_unknown_slot ( PGSLOTID  slotid,
SPAGE_HEADER sphdr,
SPAGE_SLOT sptr 
)
static

Definition at line 4560 of file slotted_page.c.

References assert, assert_release, NULL, spage_header::num_slots, spage_slot::offset_to_record, SPAGE_DB_PAGESIZE, SPAGE_EMPTY_OFFSET, SPAGE_VERIFY_HEADER, and STATIC_INLINE.

Referenced by spage_find_slot().

Here is the caller graph for this function:

bool spage_is_updatable ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id,
int  record_descriptor_length 
)

Definition at line 2643 of file slotted_page.c.

References NULL, SP_SUCCESS, and spage_check_updatable().

Referenced by heap_delete_home(), heap_delete_relocation(), heap_update_home(), heap_update_relocation(), and serial_update_serial_object().

Here is the caller graph for this function:

bool spage_is_valid_anchor_type ( const INT16  anchor_type)

Definition at line 364 of file slotted_page.c.

References ANCHORED, ANCHORED_DONT_REUSE_SLOTS, assert, UNANCHORED_ANY_SEQUENCE, and UNANCHORED_KEEP_SEQUENCE.

Referenced by sort_spage_initialize(), spage_delete(), spage_initialize(), and spage_vacuum_slot().

Here is the caller graph for this function:

int spage_max_record_size ( void  )
bool spage_need_compact ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p 
)
SCAN_CODE spage_next_record ( PAGE_PTR  page_p,
PGSLOTID out_slot_id_p,
RECDES record_descriptor_p,
int  is_peeking 
)
SCAN_CODE spage_next_record_dont_skip_empty ( PAGE_PTR  page_p,
PGSLOTID out_slot_id_p,
RECDES record_descriptor_p,
int  is_peeking 
)

Definition at line 4699 of file slotted_page.c.

References SPAGE_SEARCH_NEXT, and spage_search_record().

Referenced by heap_next_internal().

Here is the caller graph for this function:

PGNSLOTS spage_number_of_slots ( PAGE_PTR  page_p)

Definition at line 879 of file slotted_page.c.

References assert, NULL, spage_header::num_slots, and SPAGE_VERIFY_HEADER.

Referenced by btree_merge_node_and_advance(), heap_get_insert_location_with_lock(), heap_reuse(), and heap_vacuum_all_objects().

Here is the caller graph for this function:

SCAN_CODE spage_previous_record ( PAGE_PTR  page_p,
PGSLOTID out_slot_id_p,
RECDES record_descriptor_p,
int  is_peeking 
)

Definition at line 3815 of file slotted_page.c.

References SPAGE_SEARCH_PREV, and spage_search_record().

Referenced by heap_next_internal(), heap_prefetch(), and heap_scanrange_to_prior().

Here is the caller graph for this function:

SCAN_CODE spage_previous_record_dont_skip_empty ( PAGE_PTR  page_p,
PGSLOTID out_slot_id_p,
RECDES record_descriptor_p,
int  is_peeking 
)

Definition at line 4716 of file slotted_page.c.

References SPAGE_SEARCH_PREV, and spage_search_record().

Referenced by heap_next_internal().

Here is the caller graph for this function:

int spage_put ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id,
int  offset,
const RECDES record_descriptor_p 
)

Definition at line 3143 of file slotted_page.c.

References spage_put_helper().

static const char * spage_record_type_string ( INT16  record_type)
static

Definition at line 4106 of file slotted_page.c.

References assert, REC_4BIT_USED_TYPE_MAX, REC_ASSIGN_ADDRESS, REC_BIGONE, REC_DELETED_WILL_REUSE, REC_HOME, REC_MARKDELETED, REC_NEWHOME, REC_RELOCATION, and REC_UNKNOWN.

Referenced by spage_dump_slots(), and spage_slots_next_scan().

Here is the caller graph for this function:

static void spage_reduce_a_slot ( PAGE_PTR  page_p)
static
static void spage_reduce_contiguous_free_space ( PAGE_PTR  pgptr,
int  space 
)
static
static void * spage_save_head_alloc ( void  )
static

Definition at line 256 of file slotted_page.c.

References spage_save_head::mutex, NULL, and pthread_mutex_init.

static int spage_save_head_free ( void *  entry_p)
static

Definition at line 275 of file slotted_page.c.

References NO_ERROR.

static int spage_save_head_init ( void *  entry_p)
static
static int spage_save_head_uninit ( void *  entry_p)
static
static SCAN_CODE spage_search_record ( PAGE_PTR  page_p,
PGSLOTID out_slot_id_p,
RECDES record_descriptor_p,
int  is_peeking,
int  direction,
bool  skip_empty 
)
static
void spage_set_need_update_best_hint ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
bool  need_update 
)

Definition at line 962 of file slotted_page.c.

References assert, spage_header::need_update_best_hint, NULL, and SPAGE_VERIFY_HEADER.

Referenced by heap_stats_update().

Here is the caller graph for this function:

static void spage_set_slot ( SPAGE_SLOT slot_p,
int  offset,
int  length,
INT16  type 
)
static
static void spage_shift_slot_down ( PAGE_PTR  page_p,
SPAGE_HEADER page_header_p,
SPAGE_SLOT slot_p 
)
static
static void spage_shift_slot_up ( PAGE_PTR  page_p,
SPAGE_HEADER page_header_p,
SPAGE_SLOT slot_p 
)
static
int spage_slots_end_scan ( THREAD_ENTRY thread_p,
void **  ptr 
)

Definition at line 5223 of file slotted_page.c.

References db_private_free, NO_ERROR, NULL, and spage_slots_context::pgptr.

Referenced by showstmt_scan_init().

Here is the caller graph for this function:

int spage_update ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id,
const RECDES record_descriptor_p 
)

Definition at line 2562 of file slotted_page.c.

References ARG_FILE_LINE, assert, DONT_FREE, ER_ERROR_SEVERITY, ER_GENERIC_ERROR, er_set(), spage_header::is_saving, recdes::length, NO_ERROR, NULL, pgbuf_get_latch_mode(), PGBUF_LATCH_WRITE, pgbuf_set_dirty(), spage_slot::record_length, SP_ERROR, SP_SUCCESS, spage_check(), spage_check_updatable(), spage_save_space(), spage_update_record_after_compact(), spage_update_record_in_place(), SPAGE_VERIFY_HEADER, and spage_header::total_free.

Referenced by btree_build_nleafs(), btree_compress_node(), btree_insert_mvcc_delid_into_page(), btree_key_append_object_as_new_overflow(), btree_key_append_object_non_unique(), btree_key_append_object_to_overflow(), btree_key_append_object_unique(), btree_key_online_index_IB_insert(), btree_key_online_index_tran_delete(), btree_key_online_index_tran_insert(), btree_key_online_index_tran_insert_DF(), btree_key_relocate_last_into_ovf(), btree_key_remove_delete_mvccid_non_unique(), btree_key_remove_delete_mvccid_unique(), btree_key_remove_insert_mvccid(), btree_key_remove_object_and_keep_visible_first(), btree_leaf_record_replace_first_with_last(), btree_modify_leaf_ovfl_vpid(), btree_modify_overflow_link(), btree_overflow_record_replace_object(), btree_record_remove_object(), btree_replace_first_oid_with_ovfl_oid(), btree_rv_nodehdr_undoredo_update(), btree_rv_noderec_undoredo_update(), btree_rv_record_modify_internal(), catalog_adjust_directory_count(), catalog_drop_old_representations(), catalog_drop_representation_helper(), catalog_drop_representation_item(), catalog_put_record_into_page(), catalog_put_representation_item(), catalog_rv_update(), catalog_update_class_info(), ehash_merge_permanent(), heap_remove_page_on_vacuum(), heap_rv_mvcc_redo_delete_internal(), heap_rv_mvcc_undo_delete(), heap_rv_undoredo_pagehdr(), heap_update_bigone(), heap_update_physical(), heap_vpid_remove(), log_rv_record_modify_internal(), serial_update_serial_object(), vacuum_heap_record_insid_and_prev_version(), vacuum_rv_check_at_undo(), vacuum_rv_redo_vacuum_heap_page(), and xheap_reclaim_addresses().

void spage_update_record_type ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
PGSLOTID  slot_id,
INT16  record_type 
)

Variable Documentation

int rv
static

Definition at line 60 of file slotted_page.c.

Referenced by spage_free_saved_spaces().

LF_ENTRY_DESCRIPTOR spage_Saving_entry_descriptor
static
Initial value:
= {
offsetof (SPAGE_SAVE_HEAD, rstack),
offsetof (SPAGE_SAVE_HEAD, next),
offsetof (SPAGE_SAVE_HEAD, del_id),
offsetof (SPAGE_SAVE_HEAD, vpid),
offsetof (SPAGE_SAVE_HEAD, mutex),
}
static int spage_save_head_uninit(void *entry_p)
Definition: slotted_page.c:308
static API_MUTEX mutex
Definition: api_util.c:72
static int spage_save_head_init(void *entry_p)
Definition: slotted_page.c:287
int lf_callback_vpid_compare(void *vpid_1, void *vpid_2)
Definition: lock_free.c:154
unsigned int lf_callback_vpid_hash(void *vpid, int htsize)
Definition: lock_free.c:140
#define NULL
Definition: freelistheap.h:34
static int spage_save_head_free(void *entry_p)
Definition: slotted_page.c:275
static void * spage_save_head_alloc(void)
Definition: slotted_page.c:256
#define LF_EM_USING_MUTEX
Definition: lock_free.h:60
int lf_callback_vpid_copy(void *src, void *dest)
Definition: lock_free.c:169

Definition at line 128 of file slotted_page.c.

spage_saving_hashmap_type spage_Saving_hashmap
static

Definition at line 154 of file slotted_page.c.

PGLENGTH spage_User_page_size
static

Definition at line 66 of file slotted_page.c.

Referenced by spage_boot().