CUBRID Engine  latest
query_reevaluation.hpp
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 // Predicate re-evaluation - part of MVCC read committed re-evaluation of modified object
21 //
22 
23 #ifndef _QUERY_REEVALUATION_HPP_
24 #define _QUERY_REEVALUATION_HPP_
25 
26 #include "dbtype_def.h" // OID, DB_LOGICAL
27 
28 #include "query_evaluator.h" // FILTER_INFO, QPROC_QUALIFICATION, scan_attrs
29 
30 // forward definitions
31 struct db_value;
32 struct lc_copy_area;
33 struct heap_cache_attrinfo;
34 struct recdes;
35 struct scan_id_struct;
36 struct val_descr;
37 
38 namespace cubxasl
39 {
40  struct pred_expr;
41 }
42 
43 /* type of reevaluation */
45 {
48 };
50 
51 namespace cubquery
52 {
53  /* describes an assignment used in MVCC reevaluation */
55  {
56  int att_id; /* index in the class attributes array */
57  db_value *constant; /* constant to be assigned to an attribute or NULL */
58  regu_variable_node *regu_right; /* regu variable for right side of an assignment */
59  update_mvcc_reev_assignment *next; /* link to the next assignment */
60  };
61 
62  /* class info for UPDATE/DELETE MVCC condition reevaluation */
64  {
65  int class_index; /* index of class in select list */
66  OID cls_oid; /* OID of class */
67  OID *inst_oid; /* OID of instance involved in condition */
68  filter_info data_filter; /* data filter */
69  filter_info key_filter; /* key_filter */
70  filter_info range_filter; /* range filter */
71  QPROC_QUALIFICATION qualification; /* see QPROC_QUALIFICATION; used for both input and output parameter */
72  regu_variable_list_node *rest_regu_list; /* regulator variable list */
73  scan_attrs *rest_attrs; /* attribute info for attribute that is not involved in current filter */
74  upddel_mvcc_cond_reeval *next; /* next upddel_mvcc_cond_reeval structure that will be processed on
75  * reevaluation */
76 
77  void init (scan_id_struct &sid);
78  };
79 
80  /* data for MVCC condition reevaluation */
82  {
83  upddel_mvcc_cond_reeval *mvcc_cond_reev_list; /* list of classes that are referenced in condition */
84 
85  /* information for class that is currently updated/deleted */
86  upddel_mvcc_cond_reeval *curr_upddel; /* pointer to the reevaluation data for class that is currently updated/
87  * deleted or NULL if it is not involved in reevaluation */
88  int curr_extra_assign_cnt; /* length of curr_extra_assign_reev array */
89  upddel_mvcc_cond_reeval **curr_extra_assign_reev; /* classes involved in the right side of assignments and are
90  * not part of conditions to be reevaluated */
91  update_mvcc_reev_assignment *curr_assigns; /* list of assignments to the attributes of this class */
92  heap_cache_attrinfo *curr_attrinfo; /* attribute info for performing assignments */
93 
95  lc_copy_area *copyarea; /* used to build the tuple to be stored to disk after reevaluation */
96  val_descr *vd; /* values descriptor */
97  recdes *new_recdes; /* record descriptor after assignment reevaluation */
98  };
99 
100  /* Structure used in condition reevaluation at SELECT */
102  {
103  filter_info *range_filter; /* filter for range predicate. Used only at index scan */
104  filter_info *key_filter; /* key filter */
105  filter_info *data_filter; /* data filter */
106 
107  QPROC_QUALIFICATION *qualification; /* address of a variable that contains qualification value */
108 
109  void set_filters (upddel_mvcc_cond_reeval &ureev);
110  };
111 
112  /* Used in condition reevaluation for UPDATE/DELETE */
114  {
116  union
117  {
118  mvcc_update_reev_data *upddel_reev_data; /* data for reevaluation at UPDATE/DELETE */
119  mvcc_scan_reev_data *select_reev_data; /* data for reevaluation at SELECT */
120  };
121  DB_LOGICAL filter_result; /* the result of reevaluation if successful */
122 
123  void set_update_reevaluation (mvcc_update_reev_data &urd);
124  void set_scan_reevaluation (mvcc_scan_reev_data &scan);
125  };
126 } // namespace cubquery
127 
133 
134 #endif // _QUERY_REEVALUATION_HPP_
update_mvcc_reev_assignment * curr_assigns
enum mvcc_reev_data_type MVCC_REEV_DATA_TYPE
mvcc_reev_data_type
QPROC_QUALIFICATION * qualification
update_mvcc_reev_assignment * next
upddel_mvcc_cond_reeval * mvcc_cond_reev_list
mvcc_scan_reev_data * select_reev_data
regu_variable_list_node * rest_regu_list
QPROC_QUALIFICATION
DB_LOGICAL
Definition: dbtype_def.h:1218
upddel_mvcc_cond_reeval ** curr_extra_assign_reev
mvcc_update_reev_data * upddel_reev_data
upddel_mvcc_cond_reeval * curr_upddel