CUBRID Engine  latest
locator_cl.c File Reference
#include "config.h"
#include <stdio.h>
#include <assert.h>
#include <signal.h>
#include "authenticate.h"
#include "db.h"
#include "environment_variable.h"
#include "porting.h"
#include "locator_cl.h"
#include "memory_alloc.h"
#include "storage_common.h"
#include "work_space.h"
#include "object_representation.h"
#include "transform_cl.h"
#include "class_object.h"
#include "schema_manager.h"
#include "server_interface.h"
#include "locator.h"
#include "boot_cl.h"
#include "virtual_object.h"
#include "memory_hash.h"
#include "system_parameter.h"
#include "dbi.h"
#include "replication.h"
#include "transaction_cl.h"
#include "network_interface_cl.h"
#include "execute_statement.h"
#include "log_lsa.hpp"

Go to the source code of this file.

Classes

struct  locator_mflush_temp_oid
 
struct  locator_mflush_cache
 
struct  locator_cache_lock
 
struct  locator_list_nested_mops
 
struct  locator_list_keep_mops
 

Macros

#define WS_SET_FOUND_DELETED(mop)   WS_SET_DELETED(mop)
 
#define MAX_FETCH_SIZE   64
 

Typedefs

typedef struct locator_mflush_temp_oid LOCATOR_MFLUSH_TEMP_OID
 
typedef struct locator_mflush_cache LOCATOR_MFLUSH_CACHE
 
typedef struct locator_cache_lock LOCATOR_CACHE_LOCK
 
typedef struct locator_list_nested_mops LOCATOR_LIST_NESTED_MOPS
 
typedef struct locator_list_keep_mops LOCATOR_LIST_KEEP_MOPS
 

Functions

static void locator_cache_lock (MOP mop, MOBJ ignore_notgiven_object, void *xcache_lock)
 
static void locator_cache_lock_set (MOP mop, MOBJ ignore_notgiven_object, void *xlockset)
 
static LOCK locator_to_prefetched_lock (LOCK class_lock)
 
static int locator_lock (MOP mop, LC_OBJTYPE isclass, LOCK lock, LC_FETCH_VERSION_TYPE fetch_version_type)
 
static int locator_lock_class_of_instance (MOP inst_mop, MOP *class_mop, LOCK lock)
 
static int locator_lock_and_doesexist (MOP mop, LOCK lock, LC_OBJTYPE isclass)
 
static int locator_lock_set (int num_mops, MOP *vector_mop, LOCK reqobj_inst_lock, LOCK reqobj_class_lock, int quit_on_errors)
 
static int locator_set_chn_classes_objects (LC_LOCKSET *lockset)
 
static int locator_get_rest_objects_classes (LC_LOCKSET *lockset, MOP class_mop, MOBJ class_obj)
 
static int locator_lock_nested (MOP mop, LOCK lock, int prune_level, int quit_on_errors, int(*fun)(LC_LOCKSET *req, void *args), void *args)
 
static int locator_decache_lock (MOP mop, void *ignore)
 
static int locator_cache_object_class (MOP mop, LC_COPYAREA_ONEOBJ *obj, MOBJ *object_p, RECDES *recdes_p, bool *call_fun)
 
static int locator_cache_object_instance (MOP mop, MOP class_mop, MOP *hint_class_mop_p, MOBJ *hint_class_p, LC_COPYAREA_ONEOBJ *obj, MOBJ *object_p, RECDES *recdes_p, bool *call_fun)
 
static int locator_cache_not_have_object (MOP *mop_p, MOBJ *object_p, bool *call_fun, LC_COPYAREA_ONEOBJ *obj)
 
static int locator_cache_have_object (MOP *mop_p, MOBJ *object_p, RECDES *recdes_p, MOP *hint_class_mop_p, MOBJ *hint_class_p, bool *call_fun, LC_COPYAREA_ONEOBJ *obj)
 
static int locator_cache (LC_COPYAREA *copy_area, MOP hint_class_mop, MOBJ hint_class, void(*fun)(MOP mop, MOBJ object, void *args), void *args)
 
static LC_FIND_CLASSNAME locator_find_class_by_name (const char *classname, LOCK lock, MOP *class_mop)
 
static int locator_mflush (MOP mop, void *mf)
 
static int locator_mflush_initialize (LOCATOR_MFLUSH_CACHE *mflush, MOP class_mop, MOBJ clazz, HFID *hfid, bool decache, bool isone_mflush)
 
static void locator_mflush_reset (LOCATOR_MFLUSH_CACHE *mflush)
 
static int locator_mflush_reallocate_copy_area (LOCATOR_MFLUSH_CACHE *mflush, int minsize)
 
static int locator_repl_mflush (LOCATOR_MFLUSH_CACHE *mflush)
 
static int locator_repl_mflush_force (LOCATOR_MFLUSH_CACHE *mflush)
 
static void locator_repl_mflush_check_error (LC_COPYAREA *mflush)
 
static void locator_mflush_end (LOCATOR_MFLUSH_CACHE *mflush)
 
static int locator_mflush_force (LOCATOR_MFLUSH_CACHE *mflush)
 
static int locator_class_to_disk (LOCATOR_MFLUSH_CACHE *mflush, MOBJ object, bool *has_index, int *round_length_p, WS_MAP_STATUS *map_status)
 
static int locator_mem_to_disk (LOCATOR_MFLUSH_CACHE *mflush, MOBJ object, bool *has_index, int *round_length_p, WS_MAP_STATUS *map_status)
 
static void locator_mflush_set_dirty (MOP mop, MOBJ ignore_object, void *ignore_argument)
 
static void locator_keep_mops (MOP mop, MOBJ object, void *kmops)
 
static int locator_instance_decache (MOP mop, void *ignore)
 
static int locator_save_nested_mops (LC_LOCKSET *lockset, void *save_mops)
 
static LC_FIND_CLASSNAME locator_find_class_by_oid (MOP *class_mop, const char *classname, OID *class_oid, LOCK lock)
 
static LIST_MOPSlocator_fun_get_all_mops (MOP class_mop, DB_FETCH_MODE purpose, int(*fun)(MOBJ class_obj), LC_FETCH_VERSION_TYPE *force_fetch_version_type)
 
static int locator_internal_flush_instance (MOP inst_mop, bool decache)
 
static int locator_add_to_oidset_when_temp_oid (MOP mop, void *data)
 
static bool locator_can_skip_fetch_from_server (MOP mop, LOCK *lock, LC_FETCH_VERSION_TYPE fetch_version_type)
 
LC_FIND_CLASSNAME locator_reserve_class_name (const char *class_name, OID *class_oid)
 
void locator_set_sig_interrupt (int set)
 
bool locator_is_root (MOP mop)
 
int locator_is_class (MOP mop, DB_FETCH_MODE hint_purpose)
 
LOCK locator_fetch_mode_to_lock (DB_FETCH_MODE purpose, LC_OBJTYPE type, LC_FETCH_VERSION_TYPE fetch_version_type)
 
int locator_get_cache_coherency_number (MOP mop)
 
MOBJ locator_fetch_object (MOP mop, DB_FETCH_MODE purpose, LC_FETCH_VERSION_TYPE fetch_version_type)
 
MOBJ locator_fetch_class (MOP class_mop, DB_FETCH_MODE purpose)
 
MOBJ locator_fetch_class_of_instance (MOP inst_mop, MOP *class_mop, DB_FETCH_MODE purpose)
 
MOBJ locator_fetch_instance (MOP mop, DB_FETCH_MODE purpose, LC_FETCH_VERSION_TYPE fetch_version_type)
 
MOBJ locator_fetch_set (int num_mops, MOP *mop_set, DB_FETCH_MODE inst_purpose, DB_FETCH_MODE class_purpose, int quit_on_errors)
 
MOBJ locator_fetch_nested (MOP mop, DB_FETCH_MODE purpose, int prune_level, int quit_on_errors)
 
LIST_MOPSlocator_get_all_mops (MOP class_mop, DB_FETCH_MODE purpose, LC_FETCH_VERSION_TYPE *force_fetch_version_type)
 
LIST_MOPSlocator_get_all_class_mops (DB_FETCH_MODE purpose, int(*fun)(MOBJ class_obj))
 
void locator_free_list_mops (LIST_MOPS *mops)
 
MOP locator_find_class (const char *classname)
 
MOP locator_find_class_with_purpose (const char *classname, bool for_update)
 
int locator_does_exist_object (MOP mop, DB_FETCH_MODE purpose)
 
int locator_decache_all_lock_instances (MOP class_mop)
 
int locator_flush_class (MOP class_mop)
 
int locator_flush_instance (MOP mop)
 
int locator_flush_all_instances (MOP class_mop, bool decache)
 
int locator_flush_for_multi_update (MOP class_mop)
 
int locator_all_flush (void)
 
int locator_repl_flush_all (void)
 
MOP locator_add_root (OID *root_oid, MOBJ class_root)
 
MOP locator_add_class (MOBJ class_obj, const char *classname)
 
MOBJ locator_create_heap_if_needed (MOP class_mop, bool reuse_oid)
 
MOBJ locator_has_heap (MOP class_mop)
 
MOP locator_add_instance (MOBJ instance, MOP class_mop)
 
int locator_remove_class (MOP class_mop)
 
void locator_remove_instance (MOP mop)
 
MOBJ locator_update_class (MOP mop)
 
MOBJ locator_prepare_rename_class (MOP class_mop, const char *old_classname, const char *new_classname)
 
MOBJ locator_update_instance (MOP mop)
 
OIDlocator_assign_permanent_oid (MOP mop)
 
void locator_synch_isolation_incons (void)
 
static void locator_cache_lock_lockhint_classes (LC_LOCKHINT *lockhint)
 
LC_FIND_CLASSNAME locator_lockhint_classes (int num_classes, const char **many_classnames, LOCK *many_locks, int *need_subclasses, LC_PREFETCH_FLAGS *flags, int quit_on_errors, LOCK lock_rr_tran)
 
static int locator_check_object_and_get_class (MOP obj_mop, MOP *out_class_mop)
 
LC_OIDMAPlocator_add_oidset_object (LC_OIDSET *oidset, MOP obj_mop)
 
int locator_assign_oidset (LC_OIDSET *oidset, LC_OIDMAP_CALLBACK callback)
 
int locator_assign_all_permanent_oids (void)
 
int locator_flush_replication_info (REPL_INFO *repl_info)
 
int locator_get_append_lsa (struct log_lsa *lsa)
 

Variables

static volatile sig_atomic_t lc_Is_siginterrupt = false
 

Macro Definition Documentation

#define MAX_FETCH_SIZE   64

Definition at line 57 of file locator_cl.c.

Referenced by locator_get_rest_objects_classes(), and locator_lockhint_classes().

#define WS_SET_FOUND_DELETED (   mop)    WS_SET_DELETED(mop)

Definition at line 56 of file locator_cl.c.

Referenced by locator_cache_not_have_object().

Typedef Documentation

Definition at line 88 of file locator_cl.c.

Definition at line 106 of file locator_cl.c.

Definition at line 100 of file locator_cl.c.

Definition at line 68 of file locator_cl.c.

Definition at line 60 of file locator_cl.c.

Function Documentation

MOP locator_add_instance ( MOBJ  instance,
MOP  class_mop 
)
MOP locator_add_root ( OID root_oid,
MOBJ  class_root 
)
static int locator_add_to_oidset_when_temp_oid ( MOP  mop,
void *  data 
)
static
int locator_assign_all_permanent_oids ( void  )
static void locator_cache_lock_lockhint_classes ( LC_LOCKHINT lockhint)
static
static int locator_cache_object_instance ( MOP  mop,
MOP  class_mop,
MOP hint_class_mop_p,
MOBJ hint_class_p,
LC_COPYAREA_ONEOBJ obj,
MOBJ object_p,
RECDES recdes_p,
bool call_fun 
)
static
static bool locator_can_skip_fetch_from_server ( MOP  mop,
LOCK lock,
LC_FETCH_VERSION_TYPE  fetch_version_type 
)
static
static int locator_check_object_and_get_class ( MOP  obj_mop,
MOP out_class_mop 
)
static
int locator_decache_all_lock_instances ( MOP  class_mop)

Definition at line 3293 of file locator_cl.c.

References ER_FAILED, locator_decache_lock(), NO_ERROR, NULL, ws_map_class(), and WS_MAP_SUCCESS.

Referenced by locator_cache_not_have_object(), locator_cache_object_class(), and unloaddb().

Here is the caller graph for this function:

static int locator_decache_lock ( MOP  mop,
void *  ignore 
)
static

Definition at line 3278 of file locator_cl.c.

References NULL_LOCK, WS_MAP_CONTINUE, and ws_set_lock().

Referenced by locator_decache_all_lock_instances().

Here is the caller graph for this function:

MOBJ locator_fetch_class_of_instance ( MOP  inst_mop,
MOP class_mop,
DB_FETCH_MODE  purpose 
)

Definition at line 2354 of file locator_cl.c.

References LC_CLASS, locator_fetch_mode_to_lock(), locator_lock_class_of_instance(), NO_ERROR, NULL, TM_TRAN_READ_FETCH_VERSION, ws_find(), and WS_FIND_MOP_DELETED.

Referenced by fetch_class().

Here is the caller graph for this function:

MOBJ locator_fetch_nested ( MOP  mop,
DB_FETCH_MODE  purpose,
int  prune_level,
int  quit_on_errors 
)
MOBJ locator_fetch_object ( MOP  mop,
DB_FETCH_MODE  purpose,
LC_FETCH_VERSION_TYPE  fetch_version_type 
)

Definition at line 2235 of file locator_cl.c.

References LC_CLASS, LC_INSTANCE, LC_OBJECT, locator_fetch_mode_to_lock(), locator_is_root(), locator_lock(), NO_ERROR, NULL, ws_class_mop(), ws_find(), and WS_FIND_MOP_DELETED.

Referenced by cursor_fetch_oids(), and locator_is_class().

Here is the caller graph for this function:

MOP locator_find_class ( const char *  classname)
MOP locator_find_class_with_purpose ( const char *  classname,
bool  for_update 
)

Definition at line 3167 of file locator_cl.c.

References LC_CLASS, LC_CLASSNAME_EXIST, locator_fetch_mode_to_lock(), locator_find_class_by_name(), NULL, SCH_M_LOCK, and SCH_S_LOCK.

Referenced by sm_find_class_with_purpose().

Here is the caller graph for this function:

int locator_flush_replication_info ( REPL_INFO repl_info)

Definition at line 6869 of file locator_cl.c.

References repl_set_info().

Referenced by do_replicate_statement().

Here is the caller graph for this function:

LIST_MOPS* locator_get_all_class_mops ( DB_FETCH_MODE  purpose,
int(*)(MOBJ class_obj)  fun 
)

Definition at line 2861 of file locator_cl.c.

References locator_fun_get_all_mops(), NULL, and sm_Root_class_mop.

Referenced by db_get_all_chosen_classes(), and do_reclaim_class_addresses().

Here is the caller graph for this function:

LIST_MOPS* locator_get_all_mops ( MOP  class_mop,
DB_FETCH_MODE  purpose,
LC_FETCH_VERSION_TYPE force_fetch_version_type 
)
int locator_get_append_lsa ( struct log_lsa lsa)

Definition at line 6882 of file locator_cl.c.

References repl_log_get_append_lsa().

Referenced by extract_objects().

Here is the caller graph for this function:

static int locator_instance_decache ( MOP  mop,
void *  ignore 
)
static

Definition at line 5841 of file locator_cl.c.

References ws_decache(), and WS_MAP_CONTINUE.

Referenced by locator_remove_class().

Here is the caller graph for this function:

static void locator_keep_mops ( MOP  mop,
MOBJ  object,
void *  kmops 
)
static
static int locator_lock ( MOP  mop,
LC_OBJTYPE  isclass,
LOCK  lock,
LC_FETCH_VERSION_TYPE  fetch_version_type 
)
static

Definition at line 596 of file locator_cl.c.

References ARG_FILE_LINE, assert, locator_cache_lock::class_lock, locator_cache_lock::class_oid, do_Trigger_involved, er_errid(), ER_ERROR_SEVERITY, ER_FAILED, ER_FATAL_ERROR_SEVERITY, ER_GENERIC_ERROR, ER_HEAP_UNKNOWN_CLASS_OF_INSTANCE, ER_HEAP_UNKNOWN_OBJECT, ER_LK_UNILATERALLY_ABORTED, er_log_debug, er_set(), ER_WARNING_SEVERITY, error(), locator_cache_lock::fetch_version_type, locator_cache_lock::implicit_lock, IS_LOCK, locator_cache_lock::isolation, IX_LOCK, LC_CLASS, LC_FETCH_CURRENT_VERSION, LC_FETCH_CURRENT_VERSION_NO_CHECK, LC_FETCH_DIRTY_VERSION, LC_INSTANCE, locator_cache(), locator_cache_lock(), locator_can_skip_fetch_from_server(), locator_fetch(), locator_free_copy_area(), locator_to_prefetched_lock(), locator_cache_lock::lock, lock_Conv, NA_LOCK, NO_ERROR, NULL, NULL_CHN, NULL_LOCK, locator_cache_lock::oid, db_identifier::pageid, S_LOCK, SIX_LOCK, db_identifier::slotid, sm_is_reuse_oid_class(), TM_TRAN_ISOLATION, TM_TRAN_READ_FETCH_VERSION, tran_abort_only_client(), TRAN_READ_COMMITTED, db_identifier::volid, ws_chn(), ws_class_mop(), ws_decache(), ws_find(), WS_FIND_MOP_DELETED, ws_get_lock(), WS_IS_DELETED, WS_ISVID, ws_oid(), WS_SET_DELETED, and X_LOCK.

Referenced by locator_add_class(), locator_fetch_class(), locator_fetch_instance(), locator_fetch_object(), locator_find_class_by_name(), locator_find_class_by_oid(), locator_get_cache_coherency_number(), and locator_lock_set().

Here is the caller graph for this function:

static int locator_mflush ( MOP  mop,
void *  mf 
)
static

Definition at line 4507 of file locator_cl.c.

References recdes::area_size, ARG_FILE_LINE, assert, CAST_BUFLEN, locator_mflush_cache::class_mop, locator_mflush_cache::class_obj, lc_copyarea_oneobj::class_oid, class_type(), locator_mflush_cache::copy_area, COPY_OID, recdes::data, DB_FETCH_CLREAD_INSTWRITE, DB_NOT_PARTITIONED_CLASS, DB_PARTITIONED_CLASS, DB_WASTED_ALIGN, locator_mflush_cache::decache, ER_ERROR_SEVERITY, ER_GENERIC_ERROR, ER_HEAP_UNKNOWN_CLASS_OF_INSTANCE, ER_LC_NOHEAP, er_log_debug, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), lc_copyarea_oneobj::flag, locator_mflush_cache::hfid, lc_copyarea_oneobj::hfid, HFID_COPY, HFID_IS_NULL, IX_LOCK, LC_FLUSH_DELETE, LC_FLUSH_INSERT, LC_FLUSH_INSERT_PRUNE, LC_FLUSH_UPDATE, LC_FLUSH_UPDATE_PRUNE, LC_FLUSH_UPDATE_PRUNE_VERIFY, LC_INSERT_OPERATION_TYPE, LC_IS_FLUSH_INSERT, LC_NEXT_ONEOBJ_PTR_IN_COPYAREA, LC_ONEOBJ_SET_HAS_INDEX, LC_ONEOBJ_SET_HAS_UNIQUE_INDEX, LC_UPDATE_OPERATION_TYPE, recdes::length, lc_copyarea_oneobj::length, locator_class_to_disk(), locator_fetch_class(), locator_is_root(), locator_mem_to_disk(), locator_mflush_force(), db_object::lock, MAX_ALIGNMENT, lc_copy_area::mem, locator_mflush_cache::mobjs, locator_mflush_temp_oid::mop, locator_mflush_cache::mop_tail_toid, locator_mflush_cache::mop_tail_uoid, locator_mflush_cache::mop_toids, locator_mflush_cache::mop_uoids, locator_mflush_temp_oid::next, NO_ERROR, NULL, lc_copyarea_manyobjs::num_objs, locator_mflush_temp_oid::obj, locator_mflush_cache::obj, db_object::object, lc_copyarea_oneobj::offset, lc_copyarea_oneobj::oid, OID_ISNULL, OID_ISTEMP, lc_copyarea_oneobj::operation, OR_MVCC_INSERT_HEADER_SIZE, OR_MVCC_MAX_HEADER_SIZE, db_identifier::pageid, db_object::pruning_type, locator_mflush_cache::recdes, db_identifier::slotid, sm_ch_heap(), sm_class_has_unique_constraint(), sm_decache_mop(), sm_has_indexes(), sm_partitioned_class_type(), sm_Root_class_hfid, sm_Root_class_mop, vid_flush_instance(), db_identifier::volid, ws_class_mop(), ws_clean(), ws_decache(), ws_find(), WS_FIND_MOP_DELETED, WS_IS_DELETED, ws_is_same_object(), WS_ISDIRTY, WS_ISPINNED, WS_ISVID, WS_MAP_CONTINUE, WS_MAP_FAIL, and ws_oid().

Referenced by locator_all_flush(), locator_flush_all_instances(), locator_flush_class(), locator_flush_for_multi_update(), and locator_internal_flush_instance().

Here is the caller graph for this function:

static void locator_mflush_set_dirty ( MOP  mop,
MOBJ  ignore_object,
void *  ignore_argument 
)
static

Definition at line 3977 of file locator_cl.c.

References ws_dirty().

Referenced by locator_mflush_force().

Here is the caller graph for this function:

MOBJ locator_prepare_rename_class ( MOP  class_mop,
const char *  old_classname,
const char *  new_classname 
)
void locator_remove_instance ( MOP  mop)

Definition at line 5916 of file locator_cl.c.

References ws_mark_deleted().

Referenced by obj_delete().

Here is the caller graph for this function:

int locator_repl_flush_all ( void  )
static void locator_repl_mflush_check_error ( LC_COPYAREA mflush)
static
LC_FIND_CLASSNAME locator_reserve_class_name ( const char *  class_name,
OID class_oid 
)

Definition at line 179 of file locator_cl.c.

References locator_reserve_class_names().

Referenced by db_create_class(), db_create_vclass(), dbt_reserve_name(), and locator_add_root().

Here is the caller graph for this function:

void locator_set_sig_interrupt ( int  set)

Definition at line 193 of file locator_cl.c.

References lc_Is_siginterrupt, and log_set_interrupt().

Referenced by db_set_interrupt().

Here is the caller graph for this function:

void locator_synch_isolation_incons ( void  )

Definition at line 6171 of file locator_cl.c.

References locator_cache(), locator_free_copy_area(), locator_notify_isolation_incons(), NULL, TM_TRAN_ISOLATION, TRAN_REPEATABLE_READ, and TRAN_SERIALIZABLE.

Referenced by db_synchronize_cache().

Here is the caller graph for this function:

static LOCK locator_to_prefetched_lock ( LOCK  class_lock)
static

Definition at line 387 of file locator_cl.c.

References IS_WRITE_EXCLUSIVE_LOCK, NULL_LOCK, S_LOCK, SIX_LOCK, and X_LOCK.

Referenced by locator_cache_lock_set(), locator_fun_get_all_mops(), locator_lock(), and locator_lock_and_doesexist().

Here is the caller graph for this function:

MOBJ locator_update_class ( MOP  mop)

Definition at line 5938 of file locator_cl.c.

References DB_FETCH_WRITE, locator_fetch_class(), NULL, and ws_dirty().

Referenced by allocate_disk_structures(), fetch_class(), install_new_representation(), sm_drop_index(), and sm_exist_index().

Here is the caller graph for this function:

MOBJ locator_update_instance ( MOP  mop)

Definition at line 6035 of file locator_cl.c.

References DB_FETCH_WRITE, LC_FETCH_MVCC_VERSION, locator_fetch_instance(), locator_lock_set(), locator_update_tree_classes(), NULL, SCH_M_LOCK, ws_dirty(), and X_LOCK.

Referenced by fetch_instance().

Here is the caller graph for this function:

Variable Documentation

volatile sig_atomic_t lc_Is_siginterrupt = false
static

Definition at line 114 of file locator_cl.c.

Referenced by locator_set_sig_interrupt().