Merge lp:~brianaker/drizzle/error-cleanup into lp:drizzle/7.0
- error-cleanup
- Merge into 7.0
Proposed by
Brian Aker
Status: | Merged |
---|---|
Approved by: | Brian Aker |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2148 |
Proposed branch: | lp:~brianaker/drizzle/error-cleanup |
Merge into: | lp:drizzle/7.0 |
Diff against target: |
304 lines (+35/-63) 5 files modified
drizzled/sql_base.cc (+7/-9) drizzled/table.cc (+8/-20) drizzled/table.h (+4/-0) drizzled/table/instance/base.cc (+12/-29) drizzled/table/instance/base.h (+4/-5) |
To merge this branch: | bzr merge lp:~brianaker/drizzle/error-cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Developers | Pending | ||
Review via email: mp+48712@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 2148. By Lee Bieber
-
Merge Brian - table error updates
Merge Brian - parser updates
Merge Brian - more catalog work
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'drizzled/sql_base.cc' | |||
2 | --- drizzled/sql_base.cc 2011-02-04 08:47:29 +0000 | |||
3 | +++ drizzled/sql_base.cc 2011-02-05 21:31:52 +0000 | |||
4 | @@ -1001,7 +1001,7 @@ | |||
5 | 1001 | */ | 1001 | */ |
6 | 1002 | 1002 | ||
7 | 1003 | { | 1003 | { |
9 | 1004 | table::Cache::singleton().mutex().lock(); /* Lock for FLUSH TABLES for open table */ | 1004 | boost::mutex::scoped_lock scopedLock(table::Cache::singleton().mutex()); |
10 | 1005 | 1005 | ||
11 | 1006 | /* | 1006 | /* |
12 | 1007 | Actually try to find the table in the open_cache. | 1007 | Actually try to find the table in the open_cache. |
13 | @@ -1053,7 +1053,6 @@ | |||
14 | 1053 | /* Avoid self-deadlocks by detecting self-dependencies. */ | 1053 | /* Avoid self-deadlocks by detecting self-dependencies. */ |
15 | 1054 | if (table->open_placeholder && table->in_use == this) | 1054 | if (table->open_placeholder && table->in_use == this) |
16 | 1055 | { | 1055 | { |
17 | 1056 | table::Cache::singleton().mutex().unlock(); | ||
18 | 1057 | my_error(ER_UPDATE_TABLE_USED, MYF(0), table->getShare()->getTableName()); | 1056 | my_error(ER_UPDATE_TABLE_USED, MYF(0), table->getShare()->getTableName()); |
19 | 1058 | return NULL; | 1057 | return NULL; |
20 | 1059 | } | 1058 | } |
21 | @@ -1088,20 +1087,24 @@ | |||
22 | 1088 | { | 1087 | { |
23 | 1089 | /* wait_for_conditionwill unlock table::Cache::singleton().mutex() for us */ | 1088 | /* wait_for_conditionwill unlock table::Cache::singleton().mutex() for us */ |
24 | 1090 | wait_for_condition(table::Cache::singleton().mutex(), COND_refresh); | 1089 | wait_for_condition(table::Cache::singleton().mutex(), COND_refresh); |
25 | 1090 | scopedLock.release(); | ||
26 | 1091 | } | 1091 | } |
27 | 1092 | else | 1092 | else |
28 | 1093 | { | 1093 | { |
30 | 1094 | table::Cache::singleton().mutex().unlock(); | 1094 | scopedLock.unlock(); |
31 | 1095 | } | 1095 | } |
32 | 1096 | |||
33 | 1096 | /* | 1097 | /* |
34 | 1097 | There is a refresh in progress for this table. | 1098 | There is a refresh in progress for this table. |
35 | 1098 | Signal the caller that it has to try again. | 1099 | Signal the caller that it has to try again. |
36 | 1099 | */ | 1100 | */ |
37 | 1100 | if (refresh) | 1101 | if (refresh) |
38 | 1101 | *refresh= true; | 1102 | *refresh= true; |
39 | 1103 | |||
40 | 1102 | return NULL; | 1104 | return NULL; |
41 | 1103 | } | 1105 | } |
42 | 1104 | } | 1106 | } |
43 | 1107 | |||
44 | 1105 | if (table) | 1108 | if (table) |
45 | 1106 | { | 1109 | { |
46 | 1107 | table::getUnused().unlink(static_cast<table::Concurrent *>(table)); | 1110 | table::getUnused().unlink(static_cast<table::Concurrent *>(table)); |
47 | @@ -1125,7 +1128,6 @@ | |||
48 | 1125 | */ | 1128 | */ |
49 | 1126 | if (!(table= table_cache_insert_placeholder(lock_table_identifier))) | 1129 | if (!(table= table_cache_insert_placeholder(lock_table_identifier))) |
50 | 1127 | { | 1130 | { |
51 | 1128 | table::Cache::singleton().mutex().unlock(); | ||
52 | 1129 | return NULL; | 1131 | return NULL; |
53 | 1130 | } | 1132 | } |
54 | 1131 | /* | 1133 | /* |
55 | @@ -1136,7 +1138,6 @@ | |||
56 | 1136 | table->open_placeholder= true; | 1138 | table->open_placeholder= true; |
57 | 1137 | table->setNext(open_tables); | 1139 | table->setNext(open_tables); |
58 | 1138 | open_tables= table; | 1140 | open_tables= table; |
59 | 1139 | table::Cache::singleton().mutex().unlock(); | ||
60 | 1140 | 1141 | ||
61 | 1141 | return table ; | 1142 | return table ; |
62 | 1142 | } | 1143 | } |
63 | @@ -1149,7 +1150,6 @@ | |||
64 | 1149 | table= new_table; | 1150 | table= new_table; |
65 | 1150 | if (new_table == NULL) | 1151 | if (new_table == NULL) |
66 | 1151 | { | 1152 | { |
67 | 1152 | table::Cache::singleton().mutex().unlock(); | ||
68 | 1153 | return NULL; | 1153 | return NULL; |
69 | 1154 | } | 1154 | } |
70 | 1155 | 1155 | ||
71 | @@ -1157,15 +1157,13 @@ | |||
72 | 1157 | if (error != 0) | 1157 | if (error != 0) |
73 | 1158 | { | 1158 | { |
74 | 1159 | delete new_table; | 1159 | delete new_table; |
75 | 1160 | table::Cache::singleton().mutex().unlock(); | ||
76 | 1161 | return NULL; | 1160 | return NULL; |
77 | 1162 | } | 1161 | } |
78 | 1163 | (void)table::Cache::singleton().insert(new_table); | 1162 | (void)table::Cache::singleton().insert(new_table); |
79 | 1164 | } | 1163 | } |
80 | 1165 | } | 1164 | } |
81 | 1165 | } | ||
82 | 1166 | 1166 | ||
83 | 1167 | table::Cache::singleton().mutex().unlock(); | ||
84 | 1168 | } | ||
85 | 1169 | if (refresh) | 1167 | if (refresh) |
86 | 1170 | { | 1168 | { |
87 | 1171 | table->setNext(open_tables); /* Link into simple list */ | 1169 | table->setNext(open_tables); /* Link into simple list */ |
88 | 1172 | 1170 | ||
89 | === modified file 'drizzled/table.cc' | |||
90 | --- drizzled/table.cc 2011-02-02 17:37:40 +0000 | |||
91 | +++ drizzled/table.cc 2011-02-05 21:31:52 +0000 | |||
92 | @@ -69,9 +69,6 @@ | |||
93 | 69 | 69 | ||
94 | 70 | /* Functions defined in this cursor */ | 70 | /* Functions defined in this cursor */ |
95 | 71 | 71 | ||
96 | 72 | void open_table_error(TableShare *share, int error, int db_errno, | ||
97 | 73 | myf errortype, int errarg); | ||
98 | 74 | |||
99 | 75 | /*************************************************************************/ | 72 | /*************************************************************************/ |
100 | 76 | 73 | ||
101 | 77 | // @note this should all be the destructor | 74 | // @note this should all be the destructor |
102 | @@ -82,6 +79,7 @@ | |||
103 | 82 | if (db_stat) | 79 | if (db_stat) |
104 | 83 | error= cursor->close(); | 80 | error= cursor->close(); |
105 | 84 | _alias.clear(); | 81 | _alias.clear(); |
106 | 82 | |||
107 | 85 | if (field) | 83 | if (field) |
108 | 86 | { | 84 | { |
109 | 87 | for (Field **ptr=field ; *ptr ; ptr++) | 85 | for (Field **ptr=field ; *ptr ; ptr++) |
110 | @@ -112,6 +110,8 @@ | |||
111 | 112 | uint32_t db_stat_arg) | 110 | uint32_t db_stat_arg) |
112 | 113 | { | 111 | { |
113 | 114 | setShare(share); | 112 | setShare(share); |
114 | 113 | in_use= session; | ||
115 | 114 | |||
116 | 115 | field= NULL; | 115 | field= NULL; |
117 | 116 | 116 | ||
118 | 117 | cursor= NULL; | 117 | cursor= NULL; |
119 | @@ -124,7 +124,6 @@ | |||
120 | 124 | tablenr= 0; | 124 | tablenr= 0; |
121 | 125 | db_stat= db_stat_arg; | 125 | db_stat= db_stat_arg; |
122 | 126 | 126 | ||
123 | 127 | in_use= session; | ||
124 | 128 | record[0]= (unsigned char *) NULL; | 127 | record[0]= (unsigned char *) NULL; |
125 | 129 | record[1]= (unsigned char *) NULL; | 128 | record[1]= (unsigned char *) NULL; |
126 | 130 | 129 | ||
127 | @@ -1646,25 +1645,14 @@ | |||
128 | 1646 | query_id(0), | 1645 | query_id(0), |
129 | 1647 | quick_condition_rows(0), | 1646 | quick_condition_rows(0), |
130 | 1648 | timestamp_field_type(TIMESTAMP_NO_AUTO_SET), | 1647 | timestamp_field_type(TIMESTAMP_NO_AUTO_SET), |
132 | 1649 | map(0) | 1648 | map(0), |
133 | 1649 | quick_rows(), | ||
134 | 1650 | const_key_parts(), | ||
135 | 1651 | quick_key_parts(), | ||
136 | 1652 | quick_n_ranges() | ||
137 | 1650 | { | 1653 | { |
138 | 1651 | record[0]= (unsigned char *) 0; | 1654 | record[0]= (unsigned char *) 0; |
139 | 1652 | record[1]= (unsigned char *) 0; | 1655 | record[1]= (unsigned char *) 0; |
140 | 1653 | |||
141 | 1654 | reginfo.reset(); | ||
142 | 1655 | covering_keys.reset(); | ||
143 | 1656 | quick_keys.reset(); | ||
144 | 1657 | merge_keys.reset(); | ||
145 | 1658 | |||
146 | 1659 | keys_in_use_for_query.reset(); | ||
147 | 1660 | keys_in_use_for_group_by.reset(); | ||
148 | 1661 | keys_in_use_for_order_by.reset(); | ||
149 | 1662 | |||
150 | 1663 | memset(quick_rows, 0, sizeof(ha_rows) * MAX_KEY); | ||
151 | 1664 | memset(const_key_parts, 0, sizeof(ha_rows) * MAX_KEY); | ||
152 | 1665 | |||
153 | 1666 | memset(quick_key_parts, 0, sizeof(unsigned int) * MAX_KEY); | ||
154 | 1667 | memset(quick_n_ranges, 0, sizeof(unsigned int) * MAX_KEY); | ||
155 | 1668 | } | 1656 | } |
156 | 1669 | 1657 | ||
157 | 1670 | /***************************************************************************** | 1658 | /***************************************************************************** |
158 | 1671 | 1659 | ||
159 | === modified file 'drizzled/table.h' | |||
160 | --- drizzled/table.h 2011-02-02 17:37:40 +0000 | |||
161 | +++ drizzled/table.h 2011-02-05 21:31:52 +0000 | |||
162 | @@ -91,8 +91,10 @@ | |||
163 | 91 | } | 91 | } |
164 | 92 | 92 | ||
165 | 93 | Cursor *cursor; /**< Pointer to the storage engine's Cursor managing this table */ | 93 | Cursor *cursor; /**< Pointer to the storage engine's Cursor managing this table */ |
166 | 94 | |||
167 | 94 | private: | 95 | private: |
168 | 95 | Table *next; | 96 | Table *next; |
169 | 97 | |||
170 | 96 | public: | 98 | public: |
171 | 97 | Table *getNext() const | 99 | Table *getNext() const |
172 | 98 | { | 100 | { |
173 | @@ -314,8 +316,10 @@ | |||
174 | 314 | The set is implemented as a bitmap. | 316 | The set is implemented as a bitmap. |
175 | 315 | */ | 317 | */ |
176 | 316 | key_map keys_in_use_for_query; | 318 | key_map keys_in_use_for_query; |
177 | 319 | |||
178 | 317 | /* Map of keys that can be used to calculate GROUP BY without sorting */ | 320 | /* Map of keys that can be used to calculate GROUP BY without sorting */ |
179 | 318 | key_map keys_in_use_for_group_by; | 321 | key_map keys_in_use_for_group_by; |
180 | 322 | |||
181 | 319 | /* Map of keys that can be used to calculate ORDER BY without sorting */ | 323 | /* Map of keys that can be used to calculate ORDER BY without sorting */ |
182 | 320 | key_map keys_in_use_for_order_by; | 324 | key_map keys_in_use_for_order_by; |
183 | 321 | 325 | ||
184 | 322 | 326 | ||
185 | === modified file 'drizzled/table/instance/base.cc' | |||
186 | --- drizzled/table/instance/base.cc 2011-02-04 09:30:58 +0000 | |||
187 | +++ drizzled/table/instance/base.cc 2011-02-05 21:31:52 +0000 | |||
188 | @@ -576,9 +576,9 @@ | |||
189 | 576 | getTableMessage()->set_schema(identifier_arg.getSchemaName()); | 576 | getTableMessage()->set_schema(identifier_arg.getSchemaName()); |
190 | 577 | } | 577 | } |
191 | 578 | 578 | ||
193 | 579 | int TableShare::inner_parse_table_proto(Session& session, message::Table &table) | 579 | bool TableShare::parse_table_proto(Session& session, message::Table &table) |
194 | 580 | { | 580 | { |
196 | 581 | int local_error= 0; | 581 | drizzled::error_t local_error= EE_OK; |
197 | 582 | 582 | ||
198 | 583 | if (! table.IsInitialized()) | 583 | if (! table.IsInitialized()) |
199 | 584 | { | 584 | { |
200 | @@ -1057,9 +1057,9 @@ | |||
201 | 1057 | { | 1057 | { |
202 | 1058 | if (fo.scale() > DECIMAL_MAX_SCALE) | 1058 | if (fo.scale() > DECIMAL_MAX_SCALE) |
203 | 1059 | { | 1059 | { |
205 | 1060 | local_error= 4; | 1060 | local_error= ER_NOT_FORM_FILE; |
206 | 1061 | 1061 | ||
208 | 1062 | return local_error; | 1062 | return true; |
209 | 1063 | } | 1063 | } |
210 | 1064 | decimals= static_cast<uint8_t>(fo.scale()); | 1064 | decimals= static_cast<uint8_t>(fo.scale()); |
211 | 1065 | } | 1065 | } |
212 | @@ -1113,9 +1113,8 @@ | |||
213 | 1113 | decimals != NOT_FIXED_DEC) | 1113 | decimals != NOT_FIXED_DEC) |
214 | 1114 | { | 1114 | { |
215 | 1115 | my_error(ER_M_BIGGER_THAN_D, MYF(0), pfield.name().c_str()); | 1115 | my_error(ER_M_BIGGER_THAN_D, MYF(0), pfield.name().c_str()); |
219 | 1116 | local_error= 1; | 1116 | local_error= ER_M_BIGGER_THAN_D; |
220 | 1117 | 1117 | return true; | |
218 | 1118 | return local_error; | ||
221 | 1119 | } | 1118 | } |
222 | 1120 | break; | 1119 | break; |
223 | 1121 | } | 1120 | } |
224 | @@ -1254,9 +1253,9 @@ | |||
225 | 1254 | if (res != 0 && res != 3) /* @TODO Huh? */ | 1253 | if (res != 0 && res != 3) /* @TODO Huh? */ |
226 | 1255 | { | 1254 | { |
227 | 1256 | my_error(ER_INVALID_DEFAULT, MYF(0), f->field_name); | 1255 | my_error(ER_INVALID_DEFAULT, MYF(0), f->field_name); |
229 | 1257 | local_error= 1; | 1256 | local_error= ER_INVALID_DEFAULT; |
230 | 1258 | 1257 | ||
232 | 1259 | return local_error; | 1258 | return true; |
233 | 1260 | } | 1259 | } |
234 | 1261 | } | 1260 | } |
235 | 1262 | else if (f->real_type() == DRIZZLE_TYPE_ENUM && (f->flags & NOT_NULL_FLAG)) | 1261 | else if (f->real_type() == DRIZZLE_TYPE_ENUM && (f->flags & NOT_NULL_FLAG)) |
236 | @@ -1468,9 +1467,9 @@ | |||
237 | 1468 | &next_number_keypart)) < 0) | 1467 | &next_number_keypart)) < 0) |
238 | 1469 | { | 1468 | { |
239 | 1470 | /* Wrong field definition */ | 1469 | /* Wrong field definition */ |
241 | 1471 | local_error= 4; | 1470 | local_error= ER_NOT_FORM_FILE; |
242 | 1472 | 1471 | ||
244 | 1473 | return local_error; | 1472 | return true; |
245 | 1474 | } | 1473 | } |
246 | 1475 | else | 1474 | else |
247 | 1476 | { | 1475 | { |
248 | @@ -1495,24 +1494,8 @@ | |||
249 | 1495 | all_set.resize(_field_size); | 1494 | all_set.resize(_field_size); |
250 | 1496 | all_set.set(); | 1495 | all_set.set(); |
251 | 1497 | 1496 | ||
270 | 1498 | return local_error; | 1497 | return local_error != EE_OK; |
271 | 1499 | } | 1498 | } |
254 | 1500 | |||
255 | 1501 | int TableShare::parse_table_proto(Session& session, message::Table &table) | ||
256 | 1502 | { | ||
257 | 1503 | int local_error= inner_parse_table_proto(session, table); | ||
258 | 1504 | |||
259 | 1505 | if (not local_error) | ||
260 | 1506 | return 0; | ||
261 | 1507 | |||
262 | 1508 | error= local_error; | ||
263 | 1509 | open_errno= errno; | ||
264 | 1510 | errarg= 0; | ||
265 | 1511 | open_table_error(local_error, open_errno, 0); | ||
266 | 1512 | |||
267 | 1513 | return local_error; | ||
268 | 1514 | } | ||
269 | 1515 | |||
272 | 1516 | 1499 | ||
273 | 1517 | /* | 1500 | /* |
274 | 1518 | Read table definition from a binary / text based .frm cursor | 1501 | Read table definition from a binary / text based .frm cursor |
275 | 1519 | 1502 | ||
276 | === modified file 'drizzled/table/instance/base.h' | |||
277 | --- drizzled/table/instance/base.h 2011-02-03 23:29:20 +0000 | |||
278 | +++ drizzled/table/instance/base.h 2011-02-05 21:31:52 +0000 | |||
279 | @@ -652,10 +652,12 @@ | |||
280 | 652 | private: | 652 | private: |
281 | 653 | void init(const char *new_table_name, | 653 | void init(const char *new_table_name, |
282 | 654 | const char *new_path); | 654 | const char *new_path); |
283 | 655 | public: | ||
284 | 656 | 655 | ||
285 | 656 | protected: | ||
286 | 657 | void open_table_error(int pass_error, int db_errno, int pass_errarg); | 657 | void open_table_error(int pass_error, int db_errno, int pass_errarg); |
287 | 658 | 658 | ||
288 | 659 | public: | ||
289 | 660 | |||
290 | 659 | static TableShare::shared_ptr getShareCreate(Session *session, | 661 | static TableShare::shared_ptr getShareCreate(Session *session, |
291 | 660 | const identifier::Table &identifier, | 662 | const identifier::Table &identifier, |
292 | 661 | int &error); | 663 | int &error); |
293 | @@ -723,10 +725,7 @@ | |||
294 | 723 | Table &outparam, | 725 | Table &outparam, |
295 | 724 | bool &error_reported); | 726 | bool &error_reported); |
296 | 725 | public: | 727 | public: |
301 | 726 | int parse_table_proto(Session& session, message::Table &table); | 728 | bool parse_table_proto(Session& session, message::Table &table); |
298 | 727 | |||
299 | 728 | private: | ||
300 | 729 | int inner_parse_table_proto(Session& session, message::Table &table); | ||
302 | 730 | }; | 729 | }; |
303 | 731 | 730 | ||
304 | 732 | } /* namespace drizzled */ | 731 | } /* namespace drizzled */ |