CUBRID Engine  latest
locator_sr.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 
20 /*
21  * locator_sr.h - Server transaction locator (interface)
22  */
23 
24 #ifndef _LOCATOR_SR_H_
25 #define _LOCATOR_SR_H_
26 
27 #ident "$Id$"
28 
29 #if !defined (SERVER_MODE) && !defined (SA_MODE)
30 #error Belongs to server module
31 #endif /* !defined (SERVER_MODE) && !defined (SA_MODE) */
32 
33 #include "config.h"
34 #include "disk_manager.h"
35 #include "error_manager.h"
36 #include "extendible_hash.h"
37 #include "heap_file.h"
38 #include "locator.h"
39 #include "lock_manager.h"
40 #include "oid.h"
41 #include "partition_sr.h"
42 #include "query_evaluator.h"
43 #include "replication.h"
44 #include "storage_common.h"
45 #include "thread_compat.hpp"
46 
47 // forward definitions
48 // *INDENT-OFF*
49 namespace cubquery
50 {
51  struct mvcc_reev_data;
52 }
54 // *INDENT-ON*
55 
56 enum
57 {
60 };
61 
63 
64 extern int locator_initialize (THREAD_ENTRY * thread_p);
65 extern void locator_finalize (THREAD_ENTRY * thread_p);
66 extern int locator_drop_transient_class_name_entries (THREAD_ENTRY * thread_p, LOG_LSA * savep_lsa);
67 extern int locator_savepoint_transient_class_name_entries (THREAD_ENTRY * thread_p, LOG_LSA * savep_lsa);
69 extern void locator_dump_class_names (THREAD_ENTRY * thread_p, FILE * out_fp);
70 
71 extern int xlc_fetch_allrefslockset (OID * oid, int chn, OID * class_oid, int class_chn, LOCK lock, int quit_on_errors,
72  int prune_level, LC_LOCKSET ** lockset, LC_COPYAREA ** fetch_area);
73 extern int locator_start_force_scan_cache (THREAD_ENTRY * thread_p, HEAP_SCANCACHE * scan_cache, const HFID * hfid,
74  const OID * class_oid, int op_type);
75 extern void locator_end_force_scan_cache (THREAD_ENTRY * thread_p, HEAP_SCANCACHE * scan_cache);
76 extern int locator_attribute_info_force (THREAD_ENTRY * thread_p, const HFID * hfid, OID * oid,
77  HEAP_CACHE_ATTRINFO * attr_info, ATTR_ID * att_id, int n_att_id,
78  LC_COPYAREA_OPERATION operation, int op_type, HEAP_SCANCACHE * scan_cache,
79  int *force_count, bool not_check_fk, REPL_INFO_TYPE repl_info,
80  int pruning_type, PRUNING_CONTEXT * pcontext,
81  FUNC_PRED_UNPACK_INFO * func_preds, MVCC_REEV_DATA * mvcc_reev_data,
82  UPDATE_INPLACE_STYLE force_update_inplace, RECDES * rec_descriptor,
83  bool need_locking);
85  RECDES * old_recdes, RECDES * new_recdes,
86  const int copyarea_length_hint, int lob_create_flag);
87 extern int locator_other_insert_delete (THREAD_ENTRY * thread_p, HFID * hfid, OID * oid, BTID * btid,
88  bool btid_dup_key_locked, HFID * newhfid, OID * newoid,
89  HEAP_CACHE_ATTRINFO * attr_info, HEAP_SCANCACHE * scan_cache, int *force_count,
90  OID * prev_oid, REPR_ID * new_reprid);
91 extern DISK_ISVALID locator_check_class (THREAD_ENTRY * thtread_p, OID * class_oid, RECDES * peek, HFID * class_hfid,
92  BTID * index_btid, bool repair);
93 extern DISK_ISVALID locator_check_by_class_oid (THREAD_ENTRY * thread_p, OID * cls_oid, HFID * hfid, BTID * index_btid,
94  bool repair);
96 extern DISK_ISVALID locator_check_btree_entries (THREAD_ENTRY * thread_p, BTID * btid, HFID * hfid, OID * class_oid,
97  int n_attr_ids, ATTR_ID * attr_ids, int *atts_prefix_length,
98  const char *btname, bool repair);
99 extern int locator_delete_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * oid, int has_index, int op_type,
100  HEAP_SCANCACHE * scan_cache, int *force_count, MVCC_REEV_DATA * mvcc_reev_data,
101  bool need_locking);
102 extern int locator_add_or_remove_index (THREAD_ENTRY * thread_p, RECDES * recdes, OID * inst_oid, OID * class_oid,
103  int is_insert, int op_type, HEAP_SCANCACHE * scan_cache, bool datayn,
104  bool replyn, HFID * hfid, FUNC_PRED_UNPACK_INFO * func_preds, bool has_BU_lock,
105  bool skip_checking_fk);
106 extern int locator_update_index (THREAD_ENTRY * thread_p, RECDES * new_recdes, RECDES * old_recdes, ATTR_ID * att_id,
107  int n_att_id, OID * oid, OID * class_oid, int op_type,
108  HEAP_SCANCACHE * scan_cache, REPL_INFO * repl_info);
109 extern int locator_delete_lob_force (THREAD_ENTRY * thread_p, OID * class_oid, OID * oid, RECDES * recdes);
110 extern PRUNING_SCAN_CACHE *locator_get_partition_scancache (PRUNING_CONTEXT * pcontext, const OID * class_oid,
111  const HFID * hfid, int op_type, bool has_function_index);
112 extern int xlocator_redistribute_partition_data (THREAD_ENTRY * thread_p, OID * class_oid, int no_oids, OID * oid_list);
113 
114 extern int locator_rv_redo_rename (THREAD_ENTRY * thread_p, LOG_RCV * rcv);
115 
116 extern SCAN_CODE locator_lock_and_get_object (THREAD_ENTRY * thread_p, const OID * oid, OID * class_oid,
117  RECDES * recdes, HEAP_SCANCACHE * scan_cache, LOCK lock, int ispeeking,
118  int old_chn, NON_EXISTENT_HANDLING non_ex_handling_type);
119 extern SCAN_CODE locator_lock_and_get_object_with_evaluation (THREAD_ENTRY * thread_p, OID * oid, OID * class_oid,
120  RECDES * recdes, HEAP_SCANCACHE * scan_cache,
121  int ispeeking, int old_chn,
122  MVCC_REEV_DATA * mvcc_reev_data,
123  NON_EXISTENT_HANDLING non_ex_handling_type);
124 extern SCAN_CODE locator_get_object (THREAD_ENTRY * thread_p, const OID * oid, OID * class_oid, RECDES * recdes,
125  HEAP_SCANCACHE * scan_cache, SCAN_OPERATION_TYPE op_type, LOCK lock_mode,
126  int ispeeking, int chn);
127 extern SCAN_OPERATION_TYPE locator_decide_operation_type (LOCK lock_mode, LC_FETCH_VERSION_TYPE fetch_version_type);
129 
130 extern int locator_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * class_oid, OID * oid, RECDES * recdes,
131  int has_index, int op_type, HEAP_SCANCACHE * scan_cache, int *force_count,
132  int pruning_type, PRUNING_CONTEXT * pcontext, FUNC_PRED_UNPACK_INFO * func_preds,
133  UPDATE_INPLACE_STYLE force_in_place, PGBUF_WATCHER * home_hint_p, bool has_BU_lock,
134  bool dont_check_fk, bool use_bulk_logging = false);
135 
136  // *INDENT-OFF*
137 extern int locator_multi_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * class_oid,
138  const std::vector<record_descriptor> &recdes, int has_index, int op_type,
139  HEAP_SCANCACHE * scan_cache, int *force_count, int pruning_type,
140  PRUNING_CONTEXT * pcontext, FUNC_PRED_UNPACK_INFO * func_preds,
141  UPDATE_INPLACE_STYLE force_in_place, bool dont_check_fk);
142 extern bool has_errors_filtered_for_insert (std::vector<int> error_filter_array);
143 // *INDENT-ON*
144 
145 
146 #endif /* _LOCATOR_SR_H_ */
LC_FETCH_VERSION_TYPE
Definition: locator.h:178
int locator_insert_force(THREAD_ENTRY *thread_p, HFID *hfid, OID *class_oid, OID *oid, RECDES *recdes, int has_index, int op_type, HEAP_SCANCACHE *scan_cache, int *force_count, int pruning_type, PRUNING_CONTEXT *pcontext, FUNC_PRED_UNPACK_INFO *func_preds, UPDATE_INPLACE_STYLE force_in_place, PGBUF_WATCHER *home_hint_p, bool has_BU_lock, bool dont_check_fk, bool use_bulk_logging=false)
Definition: locator_sr.c:4854
bool has_errors_filtered_for_insert(std::vector< int > error_filter_array)
Definition: locator_sr.c:13852
SCAN_CODE locator_lock_and_get_object(THREAD_ENTRY *thread_p, const OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, LOCK lock, int ispeeking, int old_chn, NON_EXISTENT_HANDLING non_ex_handling_type)
Definition: locator_sr.c:13286
REPL_INFO_TYPE
Definition: replication.h:43
SCAN_CODE
int locator_delete_force(THREAD_ENTRY *thread_p, HFID *hfid, OID *oid, int has_index, int op_type, HEAP_SCANCACHE *scan_cache, int *force_count, MVCC_REEV_DATA *mvcc_reev_data, bool need_locking)
Definition: locator_sr.c:5993
int locator_drop_transient_class_name_entries(THREAD_ENTRY *thread_p, LOG_LSA *savep_lsa)
Definition: locator_sr.c:1258
int locator_add_or_remove_index(THREAD_ENTRY *thread_p, RECDES *recdes, OID *inst_oid, OID *class_oid, int is_insert, int op_type, HEAP_SCANCACHE *scan_cache, bool datayn, bool replyn, HFID *hfid, FUNC_PRED_UNPACK_INFO *func_preds, bool has_BU_lock, bool skip_checking_fk)
Definition: locator_sr.c:7545
int locator_rv_redo_rename(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
Definition: locator_sr.c:12615
int locator_attribute_info_force(THREAD_ENTRY *thread_p, const HFID *hfid, OID *oid, HEAP_CACHE_ATTRINFO *attr_info, ATTR_ID *att_id, int n_att_id, LC_COPYAREA_OPERATION operation, int op_type, HEAP_SCANCACHE *scan_cache, int *force_count, bool not_check_fk, REPL_INFO_TYPE repl_info, int pruning_type, PRUNING_CONTEXT *pcontext, FUNC_PRED_UNPACK_INFO *func_preds, MVCC_REEV_DATA *mvcc_reev_data, UPDATE_INPLACE_STYLE force_update_inplace, RECDES *rec_descriptor, bool need_locking)
Definition: locator_sr.c:7311
DISK_ISVALID locator_check_btree_entries(THREAD_ENTRY *thread_p, BTID *btid, HFID *hfid, OID *class_oid, int n_attr_ids, ATTR_ID *attr_ids, int *atts_prefix_length, const char *btname, bool repair)
Definition: locator_sr.c:9276
int locator_start_force_scan_cache(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid, const OID *class_oid, int op_type)
Definition: locator_sr.c:3985
int locator_multi_insert_force(THREAD_ENTRY *thread_p, HFID *hfid, OID *class_oid, const std::vector< record_descriptor > &recdes, int has_index, int op_type, HEAP_SCANCACHE *scan_cache, int *force_count, int pruning_type, PRUNING_CONTEXT *pcontext, FUNC_PRED_UNPACK_INFO *func_preds, UPDATE_INPLACE_STYLE force_in_place, bool dont_check_fk)
Definition: locator_sr.c:13713
void THREAD_ENTRY
int ATTR_ID
LOCK
int xlocator_redistribute_partition_data(THREAD_ENTRY *thread_p, OID *class_oid, int no_oids, OID *oid_list)
Definition: locator_sr.c:12854
NON_EXISTENT_HANDLING
DISK_ISVALID locator_check_class(THREAD_ENTRY *thtread_p, OID *class_oid, RECDES *peek, HFID *class_hfid, BTID *index_btid, bool repair)
Definition: locator_sr.c:10297
int locator_initialize(THREAD_ENTRY *thread_p)
Definition: locator_sr.c:246
void locator_end_force_scan_cache(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
Definition: locator_sr.c:3999
DISK_ISVALID locator_check_class_names(THREAD_ENTRY *thread_p)
Definition: locator_sr.c:1923
PRUNING_SCAN_CACHE * locator_get_partition_scancache(PRUNING_CONTEXT *pcontext, const OID *class_oid, const HFID *hfid, int op_type, bool has_function_index)
Definition: locator_sr.c:12259
int locator_delete_lob_force(THREAD_ENTRY *thread_p, OID *class_oid, OID *oid, RECDES *recdes)
Definition: locator_sr.c:6311
int locator_savepoint_transient_class_name_entries(THREAD_ENTRY *thread_p, LOG_LSA *savep_lsa)
Definition: locator_sr.c:1604
bool locator_Dont_check_foreign_key
Definition: locator_sr.c:120
SCAN_OPERATION_TYPE
SCAN_OPERATION_TYPE locator_decide_operation_type(LOCK lock_mode, LC_FETCH_VERSION_TYPE fetch_version_type)
Definition: locator_sr.c:13649
int locator_update_index(THREAD_ENTRY *thread_p, RECDES *new_recdes, RECDES *old_recdes, ATTR_ID *att_id, int n_att_id, OID *oid, OID *class_oid, int op_type, HEAP_SCANCACHE *scan_cache, REPL_INFO *repl_info)
Definition: locator_sr.c:8147
SCAN_CODE locator_lock_and_get_object_with_evaluation(THREAD_ENTRY *thread_p, OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, int old_chn, MVCC_REEV_DATA *mvcc_reev_data, NON_EXISTENT_HANDLING non_ex_handling_type)
Definition: locator_sr.c:13034
DISK_ISVALID locator_check_all_entries_of_all_btrees(THREAD_ENTRY *thread_p, bool repair)
Definition: locator_sr.c:10501
LC_COPYAREA_OPERATION
Definition: locator.h:106
void locator_dump_class_names(THREAD_ENTRY *thread_p, FILE *out_fp)
Definition: locator_sr.c:1786
int locator_other_insert_delete(THREAD_ENTRY *thread_p, HFID *hfid, OID *oid, BTID *btid, bool btid_dup_key_locked, HFID *newhfid, OID *newoid, HEAP_CACHE_ATTRINFO *attr_info, HEAP_SCANCACHE *scan_cache, int *force_count, OID *prev_oid, REPR_ID *new_reprid)
LOCK locator_get_lock_mode_from_op_type(SCAN_OPERATION_TYPE op_type)
Definition: locator_sr.c:13688
LC_COPYAREA * locator_allocate_copy_area_by_attr_info(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, RECDES *old_recdes, RECDES *new_recdes, const int copyarea_length_hint, int lob_create_flag)
Definition: locator_sr.c:7210
int REPR_ID
enum update_inplace_style UPDATE_INPLACE_STYLE
Definition: heap_file.h:268
SCAN_CODE locator_get_object(THREAD_ENTRY *thread_p, const OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, SCAN_OPERATION_TYPE op_type, LOCK lock_mode, int ispeeking, int chn)
Definition: locator_sr.c:13175
int xlc_fetch_allrefslockset(OID *oid, int chn, OID *class_oid, int class_chn, LOCK lock, int quit_on_errors, int prune_level, LC_LOCKSET **lockset, LC_COPYAREA **fetch_area)
DISK_ISVALID
Definition: disk_manager.h:53
DISK_ISVALID locator_check_by_class_oid(THREAD_ENTRY *thread_p, OID *cls_oid, HFID *hfid, BTID *index_btid, bool repair)
Definition: locator_sr.c:10421
void locator_finalize(THREAD_ENTRY *thread_p)
Definition: locator_sr.c:364