CUBRID Engine  latest
locator.c File Reference
#include "locator.h"
#include "config.h"
#include "porting.h"
#include "memory_alloc.h"
#include "oid.h"
#include "object_representation.h"
#include "error_manager.h"
#include "storage_common.h"
#include "thread_compat.hpp"
#include <stdio.h>
#include <string.h>
#include <assert.h>
Include dependency graph for locator.c:

Go to the source code of this file.

Classes

struct  locator_global
 
struct  locator_global::locator_global_copyareas
 
struct  locator_global::locator_global_lockset_areas
 
struct  locator_global::locator_global_lockhint_areas
 
struct  locator_global::locator_global_packed_areas
 

Macros

#define pthread_mutex_init(a, b)
 
#define pthread_mutex_destroy(a)
 
#define pthread_mutex_lock(a)   0
 
#define pthread_mutex_unlock(a)
 
#define LOCATOR_NKEEP_LIMIT   (2)
 
#define LOCATOR_CACHED_COPYAREA_SIZE_LIMIT   (IO_MAX_PAGE_SIZE * 2 + sizeof (LC_COPYAREA))
 

Typedefs

typedef struct locator_global LOCATOR_GLOBAL
 

Functions

static char * locator_allocate_packed (int packed_size)
 
static char * locator_reallocate_packed (char *packed, int packed_size)
 
static void locator_free_packed (char *packed_area, int packed_size)
 
static int locator_initialize_lockset (LC_LOCKSET *lockset, int length, int max_reqobjs, LOCK reqobj_inst_lock, LOCK reqobj_class_lock, int quit_on_errors)
 
static char * locator_pack_lockset_header (char *packed, LC_LOCKSET *lockset)
 
static char * locator_pack_lockset_classes (char *packed, LC_LOCKSET *lockset)
 
static char * locator_pack_lockset_objects (char *packed, LC_LOCKSET *lockset)
 
static char * locator_unpack_lockset_header (char *unpacked, LC_LOCKSET *lockset)
 
static char * locator_unpack_lockset_classes (char *unpacked, LC_LOCKSET *lockset)
 
static char * locator_unpack_lockset_objects (char *unpacked, LC_LOCKSET *lockset)
 
static int locator_initialize_lockhint (LC_LOCKHINT *lockhint, int length, int max_classes, bool quit_on_errors)
 
static char * locator_pack_lockhint_header (char *packed, LC_LOCKHINT *lockhint)
 
static char * locator_pack_lockhint_classes (char *packed, LC_LOCKHINT *lockhint)
 
static char * locator_unpack_lockhint_header (char *unpacked, LC_LOCKHINT *lockhint)
 
static char * locator_unpack_lockhint_classes (char *unpacked, LC_LOCKHINT *lockhint)
 
static bool locator_is_hfid_equal (HFID *hfid1_p, HFID *hfid2_p)
 
void locator_initialize_areas (void)
 
void locator_free_areas (void)
 
LC_COPYAREAlocator_allocate_copy_area_by_length (int min_length)
 
LC_COPYAREAlocator_reallocate_copy_area_by_length (LC_COPYAREA *old_area, int new_length)
 
void locator_free_copy_area (LC_COPYAREA *copyarea)
 
char * locator_pack_copy_area_descriptor (int num_objs, LC_COPYAREA *copyarea, char *desc, int desc_len)
 
char * locator_unpack_copy_area_descriptor (int num_objs, LC_COPYAREA *copyarea, char *desc)
 
int locator_send_copy_area (LC_COPYAREA *copyarea, char **contents_ptr, int *contents_length, char **desc_ptr, int *desc_length)
 
LC_COPYAREAlocator_recv_allocate_copyarea (int num_objs, char **packed_desc, int packed_desc_length, char **contents_ptr, int contents_length)
 
LC_LOCKSETlocator_allocate_lockset (int max_reqobjs, LOCK reqobj_inst_lock, LOCK reqobj_class_lock, int quit_on_errors)
 
LC_LOCKSETlocator_reallocate_lockset (LC_LOCKSET *lockset, int max_reqobjs)
 
void locator_free_lockset (LC_LOCKSET *lockset)
 
LC_LOCKSETlocator_allocate_and_unpack_lockset (char *unpacked, int unpacked_size, bool unpack_classes, bool unpack_objects, bool reg_unpacked)
 
int locator_pack_lockset (LC_LOCKSET *lockset, bool pack_classes, bool pack_objects)
 
int locator_unpack_lockset (LC_LOCKSET *lockset, bool unpack_classes, bool unpack_objects)
 
LC_LOCKHINTlocator_allocate_lockhint (int max_classes, bool quit_on_errors)
 
LC_LOCKHINTlocator_reallocate_lockhint (LC_LOCKHINT *lockhint, int max_classes)
 
void locator_free_lockhint (LC_LOCKHINT *lockhint)
 
LC_LOCKHINTlocator_allocate_and_unpack_lockhint (char *unpacked, int unpacked_size, bool unpack_classes, bool reg_unpacked)
 
int locator_pack_lockhint (LC_LOCKHINT *lockhint, bool pack_classes)
 
int locator_unpack_lockhint (LC_LOCKHINT *lockhint, bool unpack_classes)
 
LC_OIDSETlocator_make_oid_set (void)
 
void locator_clear_oid_set (THREAD_ENTRY *thread_p, LC_OIDSET *oidset)
 
void locator_free_oid_set (THREAD_ENTRY *thread_p, LC_OIDSET *oidset)
 
LC_OIDMAPlocator_add_oid_set (THREAD_ENTRY *thread_p, LC_OIDSET *set, HFID *heap, OID *class_oid, OID *obj_oid)
 
int locator_get_packed_oid_set_size (LC_OIDSET *oidset)
 
char * locator_pack_oid_set (char *buffer, LC_OIDSET *oidset)
 
bool locator_unpack_oid_set_to_exist (char *buffer, LC_OIDSET *use)
 
LC_OIDSETlocator_unpack_oid_set_to_new (THREAD_ENTRY *thread_p, char *buffer)
 
bool locator_manyobj_flag_is_set (LC_COPYAREA_MANYOBJS *copyarea, enum MULTI_UPDATE_FLAG muf)
 
void locator_manyobj_flag_remove (LC_COPYAREA_MANYOBJS *copyarea, enum MULTI_UPDATE_FLAG muf)
 
void locator_manyobj_flag_set (LC_COPYAREA_MANYOBJS *copyarea, enum MULTI_UPDATE_FLAG muf)
 

Variables

static int rv
 
static LOCATOR_GLOBAL locator_Keep
 
static LC_COPYAREA packed_req_area_ptrs [LOCATOR_NKEEP_LIMIT]
 
static bool locator_Is_initialized = false
 

Macro Definition Documentation

#define LOCATOR_CACHED_COPYAREA_SIZE_LIMIT   (IO_MAX_PAGE_SIZE * 2 + sizeof (LC_COPYAREA))

Definition at line 60 of file locator.c.

Referenced by locator_free_copy_area().

#define LOCATOR_NKEEP_LIMIT   (2)
#define pthread_mutex_destroy (   a)

Definition at line 48 of file locator.c.

Referenced by locator_free_areas().

#define pthread_mutex_init (   a,
 
)

Definition at line 47 of file locator.c.

Referenced by locator_initialize_areas().

Typedef Documentation

Definition at line 63 of file locator.c.

Function Documentation

LC_LOCKHINT* locator_allocate_and_unpack_lockhint ( char *  unpacked,
int  unpacked_size,
bool  unpack_classes,
bool  reg_unpacked 
)
LC_LOCKSET* locator_allocate_and_unpack_lockset ( char *  unpacked,
int  unpacked_size,
bool  unpack_classes,
bool  unpack_objects,
bool  reg_unpacked 
)
static char * locator_allocate_packed ( int  packed_size)
static
void locator_free_copy_area ( LC_COPYAREA copyarea)

Definition at line 534 of file locator.c.

References locator_global::locator_global_copyareas::areas, locator_global::copy_areas, free_and_init, lc_copy_area::length, LOCATOR_CACHED_COPYAREA_SIZE_LIMIT, LOCATOR_NKEEP_LIMIT, lc_copy_area::mem, MEM_REGION_SCRAMBLE, locator_global::locator_global_copyareas::number, pthread_mutex_lock, pthread_mutex_unlock, and rv.

Referenced by locator_allocate_copy_area_by_attr_info(), locator_attribute_info_force(), locator_force(), locator_fun_get_all_mops(), locator_get_rest_objects_classes(), locator_insert_force(), locator_lock(), locator_lock_and_doesexist(), locator_lock_class_of_instance(), locator_lock_nested(), locator_lockhint_classes(), locator_mflush_end(), locator_mflush_reallocate_copy_area(), locator_mvcc_reev_cond_assigns(), locator_reallocate_copy_area_by_length(), locator_recv_allocate_copyarea(), locator_repl_mflush_force(), locator_synch_isolation_incons(), locator_update_force(), net_client_request_recv_copyarea(), process_class(), qexec_execute_delete(), qexec_execute_update(), qexec_oid_of_duplicate_key_update(), qexec_remove_duplicates_for_replace(), slocator_does_exist(), slocator_fetch(), slocator_fetch_all(), slocator_fetch_all_reference_lockset(), slocator_fetch_lockhint_classes(), slocator_fetch_lockset(), slocator_find_lockhint_class_oids(), slocator_force(), slocator_get_class(), slocator_notify_isolation_incons(), slocator_repl_force(), xlocator_fetch(), xlocator_fetch_all(), xlocator_fetch_lockhint_classes(), xlocator_fetch_lockset(), xlocator_lock_and_fetch_all(), xlocator_notify_isolation_incons(), and xlocator_upgrade_instances_domain().

void locator_free_oid_set ( THREAD_ENTRY thread_p,
LC_OIDSET oidset 
)
int locator_get_packed_oid_set_size ( LC_OIDSET oidset)

Definition at line 2363 of file locator.c.

References lc_oidset::classes, cubregex::count(), lc_class_oidset::next, NULL, lc_oidset::num_classes, lc_class_oidset::num_oids, OR_HFID_SIZE, OR_INT_SIZE, and OR_OID_SIZE.

Referenced by locator_assign_oid_batch().

Here is the caller graph for this function:

static int locator_initialize_lockhint ( LC_LOCKHINT lockhint,
int  length,
int  max_classes,
bool  quit_on_errors 
)
static
static bool locator_is_hfid_equal ( HFID hfid1_p,
HFID hfid2_p 
)
static

Definition at line 152 of file locator.c.

References vfid::fileid, hfid::hpgid, hfid::vfid, and vfid::volid.

Referenced by locator_add_oid_set().

Here is the caller graph for this function:

LC_OIDSET* locator_make_oid_set ( void  )

Definition at line 2116 of file locator.c.

References db_private_alloc, and NULL.

Referenced by col_permanent_oids(), ldr_assign_all_perm_oids(), locator_assign_all_permanent_oids(), and tf_add_fixup().

Here is the caller graph for this function:

bool locator_manyobj_flag_is_set ( LC_COPYAREA_MANYOBJS copyarea,
enum MULTI_UPDATE_FLAG  muf 
)

Definition at line 2597 of file locator.c.

References lc_copyarea_manyobjs::multi_update_flags.

Referenced by locator_force(), locator_force_for_multi_update(), locator_manyobj_flag_remove(), and xlocator_force().

Here is the caller graph for this function:

void locator_manyobj_flag_remove ( LC_COPYAREA_MANYOBJS copyarea,
enum MULTI_UPDATE_FLAG  muf 
)

Definition at line 2603 of file locator.c.

References assert, locator_manyobj_flag_is_set(), and lc_copyarea_manyobjs::multi_update_flags.

Referenced by locator_force().

Here is the caller graph for this function:

void locator_manyobj_flag_set ( LC_COPYAREA_MANYOBJS copyarea,
enum MULTI_UPDATE_FLAG  muf 
)

Definition at line 2610 of file locator.c.

References lc_copyarea_manyobjs::multi_update_flags.

Referenced by locator_flush_for_multi_update().

Here is the caller graph for this function:

char* locator_pack_copy_area_descriptor ( int  num_objs,
LC_COPYAREA copyarea,
char *  desc,
int  desc_len 
)
static char * locator_pack_lockhint_classes ( char *  packed,
LC_LOCKHINT lockhint 
)
static
static char * locator_pack_lockhint_header ( char *  packed,
LC_LOCKHINT lockhint 
)
static

Definition at line 1916 of file locator.c.

References lc_lock_hint::max_classes, lc_lock_hint::num_classes, lc_lock_hint::num_classes_processed, or_pack_int(), and lc_lock_hint::quit_on_errors.

Referenced by locator_pack_lockhint().

Here is the caller graph for this function:

static char * locator_pack_lockset_classes ( char *  packed,
LC_LOCKSET lockset 
)
static

Definition at line 1371 of file locator.c.

References lc_lockset_classof::chn, lc_lock_set::classes, i, lc_lockset_classof::oid, or_pack_int(), and or_pack_oid().

Referenced by locator_pack_lockset().

Here is the caller graph for this function:

static char * locator_pack_lockset_objects ( char *  packed,
LC_LOCKSET lockset 
)
static

Definition at line 1396 of file locator.c.

References lc_lockset_reqobj::chn, lc_lockset_reqobj::class_index, i, lc_lock_set::objects, lc_lockset_reqobj::oid, or_pack_int(), and or_pack_oid().

Referenced by locator_pack_lockset().

Here is the caller graph for this function:

LC_LOCKHINT* locator_reallocate_lockhint ( LC_LOCKHINT lockhint,
int  max_classes 
)

Definition at line 1731 of file locator.c.

References lc_lock_hint::classes, lc_lock_hint::length, lc_lock_hint::max_classes, lc_lock_hint::mem, and NULL.

Referenced by locator_guess_sub_classes().

Here is the caller graph for this function:

LC_LOCKSET* locator_reallocate_lockset ( LC_LOCKSET lockset,
int  max_reqobjs 
)

Definition at line 1091 of file locator.c.

References lc_lock_set::classes, lc_lock_set::length, lc_lock_set::max_reqobjs, lc_lock_set::mem, NULL, lc_lock_set::num_reqobjs, and lc_lock_set::objects.

Referenced by locator_all_reference_lockset().

Here is the caller graph for this function:

static char * locator_reallocate_packed ( char *  packed,
int  packed_size 
)
static

Definition at line 332 of file locator.c.

Referenced by locator_pack_lockhint(), and locator_pack_lockset().

Here is the caller graph for this function:

int locator_unpack_lockhint ( LC_LOCKHINT lockhint,
bool  unpack_classes 
)

Definition at line 2083 of file locator.c.

References CAST_BUFLEN, locator_unpack_lockhint_classes(), locator_unpack_lockhint_header(), and lc_lock_hint::packed.

Referenced by locator_allocate_and_unpack_lockhint(), and locator_fetch_lockhint_classes().

Here is the caller graph for this function:

static char * locator_unpack_lockhint_classes ( char *  unpacked,
LC_LOCKHINT lockhint 
)
static
static char * locator_unpack_lockhint_header ( char *  unpacked,
LC_LOCKHINT lockhint 
)
static

Definition at line 2035 of file locator.c.

References lc_lock_hint::max_classes, lc_lock_hint::num_classes, lc_lock_hint::num_classes_processed, or_unpack_int(), and lc_lock_hint::quit_on_errors.

Referenced by locator_unpack_lockhint().

Here is the caller graph for this function:

int locator_unpack_lockset ( LC_LOCKSET lockset,
bool  unpack_classes,
bool  unpack_objects 
)
static char * locator_unpack_lockset_classes ( char *  unpacked,
LC_LOCKSET lockset 
)
static

Definition at line 1536 of file locator.c.

References lc_lockset_classof::chn, lc_lock_set::classes, i, lc_lockset_classof::oid, or_unpack_int(), and or_unpack_oid().

Referenced by locator_unpack_lockset().

Here is the caller graph for this function:

static char * locator_unpack_lockset_objects ( char *  unpacked,
LC_LOCKSET lockset 
)
static

Definition at line 1561 of file locator.c.

References lc_lockset_reqobj::chn, lc_lockset_reqobj::class_index, i, lc_lock_set::objects, lc_lockset_reqobj::oid, or_unpack_int(), and or_unpack_oid().

Referenced by locator_unpack_lockset().

Here is the caller graph for this function:

bool locator_unpack_oid_set_to_exist ( char *  buffer,
LC_OIDSET use 
)

Variable Documentation

bool locator_Is_initialized = false
static

Definition at line 107 of file locator.c.

Referenced by locator_free_areas(), and locator_initialize_areas().

LOCATOR_GLOBAL locator_Keep
static

Definition at line 103 of file locator.c.

LC_COPYAREA packed_req_area_ptrs[LOCATOR_NKEEP_LIMIT]
static

Definition at line 105 of file locator.c.