Merge lp:~brianaker/drizzle/error-cleanup into lp:drizzle/7.0

Proposed by Brian Aker on 2011-02-05
Status: Merged
Approved by: Brian Aker on 2011-02-05
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
Reviewer Review Type Date Requested Status
Drizzle Developers 2011-02-05 Pending
Review via email: mp+48712@code.launchpad.net
To post a comment you must log in.
lp:~brianaker/drizzle/error-cleanup updated on 2011-02-06
2148. By Lee Bieber on 2011-02-06

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 */
6
7 {
8- table::Cache::singleton().mutex().lock(); /* Lock for FLUSH TABLES for open table */
9+ boost::mutex::scoped_lock scopedLock(table::Cache::singleton().mutex());
10
11 /*
12 Actually try to find the table in the open_cache.
13@@ -1053,7 +1053,6 @@
14 /* Avoid self-deadlocks by detecting self-dependencies. */
15 if (table->open_placeholder && table->in_use == this)
16 {
17- table::Cache::singleton().mutex().unlock();
18 my_error(ER_UPDATE_TABLE_USED, MYF(0), table->getShare()->getTableName());
19 return NULL;
20 }
21@@ -1088,20 +1087,24 @@
22 {
23 /* wait_for_conditionwill unlock table::Cache::singleton().mutex() for us */
24 wait_for_condition(table::Cache::singleton().mutex(), COND_refresh);
25+ scopedLock.release();
26 }
27 else
28 {
29- table::Cache::singleton().mutex().unlock();
30+ scopedLock.unlock();
31 }
32+
33 /*
34 There is a refresh in progress for this table.
35 Signal the caller that it has to try again.
36 */
37 if (refresh)
38 *refresh= true;
39+
40 return NULL;
41 }
42 }
43+
44 if (table)
45 {
46 table::getUnused().unlink(static_cast<table::Concurrent *>(table));
47@@ -1125,7 +1128,6 @@
48 */
49 if (!(table= table_cache_insert_placeholder(lock_table_identifier)))
50 {
51- table::Cache::singleton().mutex().unlock();
52 return NULL;
53 }
54 /*
55@@ -1136,7 +1138,6 @@
56 table->open_placeholder= true;
57 table->setNext(open_tables);
58 open_tables= table;
59- table::Cache::singleton().mutex().unlock();
60
61 return table ;
62 }
63@@ -1149,7 +1150,6 @@
64 table= new_table;
65 if (new_table == NULL)
66 {
67- table::Cache::singleton().mutex().unlock();
68 return NULL;
69 }
70
71@@ -1157,15 +1157,13 @@
72 if (error != 0)
73 {
74 delete new_table;
75- table::Cache::singleton().mutex().unlock();
76 return NULL;
77 }
78 (void)table::Cache::singleton().insert(new_table);
79 }
80 }
81+ }
82
83- table::Cache::singleton().mutex().unlock();
84- }
85 if (refresh)
86 {
87 table->setNext(open_tables); /* Link into simple list */
88
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
94 /* Functions defined in this cursor */
95
96-void open_table_error(TableShare *share, int error, int db_errno,
97- myf errortype, int errarg);
98-
99 /*************************************************************************/
100
101 // @note this should all be the destructor
102@@ -82,6 +79,7 @@
103 if (db_stat)
104 error= cursor->close();
105 _alias.clear();
106+
107 if (field)
108 {
109 for (Field **ptr=field ; *ptr ; ptr++)
110@@ -112,6 +110,8 @@
111 uint32_t db_stat_arg)
112 {
113 setShare(share);
114+ in_use= session;
115+
116 field= NULL;
117
118 cursor= NULL;
119@@ -124,7 +124,6 @@
120 tablenr= 0;
121 db_stat= db_stat_arg;
122
123- in_use= session;
124 record[0]= (unsigned char *) NULL;
125 record[1]= (unsigned char *) NULL;
126
127@@ -1646,25 +1645,14 @@
128 query_id(0),
129 quick_condition_rows(0),
130 timestamp_field_type(TIMESTAMP_NO_AUTO_SET),
131- map(0)
132+ map(0),
133+ quick_rows(),
134+ const_key_parts(),
135+ quick_key_parts(),
136+ quick_n_ranges()
137 {
138 record[0]= (unsigned char *) 0;
139 record[1]= (unsigned char *) 0;
140-
141- reginfo.reset();
142- covering_keys.reset();
143- quick_keys.reset();
144- merge_keys.reset();
145-
146- keys_in_use_for_query.reset();
147- keys_in_use_for_group_by.reset();
148- keys_in_use_for_order_by.reset();
149-
150- memset(quick_rows, 0, sizeof(ha_rows) * MAX_KEY);
151- memset(const_key_parts, 0, sizeof(ha_rows) * MAX_KEY);
152-
153- memset(quick_key_parts, 0, sizeof(unsigned int) * MAX_KEY);
154- memset(quick_n_ranges, 0, sizeof(unsigned int) * MAX_KEY);
155 }
156
157 /*****************************************************************************
158
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 }
164
165 Cursor *cursor; /**< Pointer to the storage engine's Cursor managing this table */
166+
167 private:
168 Table *next;
169+
170 public:
171 Table *getNext() const
172 {
173@@ -314,8 +316,10 @@
174 The set is implemented as a bitmap.
175 */
176 key_map keys_in_use_for_query;
177+
178 /* Map of keys that can be used to calculate GROUP BY without sorting */
179 key_map keys_in_use_for_group_by;
180+
181 /* Map of keys that can be used to calculate ORDER BY without sorting */
182 key_map keys_in_use_for_order_by;
183
184
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 getTableMessage()->set_schema(identifier_arg.getSchemaName());
190 }
191
192-int TableShare::inner_parse_table_proto(Session& session, message::Table &table)
193+bool TableShare::parse_table_proto(Session& session, message::Table &table)
194 {
195- int local_error= 0;
196+ drizzled::error_t local_error= EE_OK;
197
198 if (! table.IsInitialized())
199 {
200@@ -1057,9 +1057,9 @@
201 {
202 if (fo.scale() > DECIMAL_MAX_SCALE)
203 {
204- local_error= 4;
205+ local_error= ER_NOT_FORM_FILE;
206
207- return local_error;
208+ return true;
209 }
210 decimals= static_cast<uint8_t>(fo.scale());
211 }
212@@ -1113,9 +1113,8 @@
213 decimals != NOT_FIXED_DEC)
214 {
215 my_error(ER_M_BIGGER_THAN_D, MYF(0), pfield.name().c_str());
216- local_error= 1;
217-
218- return local_error;
219+ local_error= ER_M_BIGGER_THAN_D;
220+ return true;
221 }
222 break;
223 }
224@@ -1254,9 +1253,9 @@
225 if (res != 0 && res != 3) /* @TODO Huh? */
226 {
227 my_error(ER_INVALID_DEFAULT, MYF(0), f->field_name);
228- local_error= 1;
229+ local_error= ER_INVALID_DEFAULT;
230
231- return local_error;
232+ return true;
233 }
234 }
235 else if (f->real_type() == DRIZZLE_TYPE_ENUM && (f->flags & NOT_NULL_FLAG))
236@@ -1468,9 +1467,9 @@
237 &next_number_keypart)) < 0)
238 {
239 /* Wrong field definition */
240- local_error= 4;
241+ local_error= ER_NOT_FORM_FILE;
242
243- return local_error;
244+ return true;
245 }
246 else
247 {
248@@ -1495,24 +1494,8 @@
249 all_set.resize(_field_size);
250 all_set.set();
251
252- return local_error;
253-}
254-
255-int TableShare::parse_table_proto(Session& session, message::Table &table)
256-{
257- int local_error= inner_parse_table_proto(session, table);
258-
259- if (not local_error)
260- return 0;
261-
262- error= local_error;
263- open_errno= errno;
264- errarg= 0;
265- open_table_error(local_error, open_errno, 0);
266-
267- return local_error;
268-}
269-
270+ return local_error != EE_OK;
271+}
272
273 /*
274 Read table definition from a binary / text based .frm cursor
275
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 private:
281 void init(const char *new_table_name,
282 const char *new_path);
283-public:
284
285+protected:
286 void open_table_error(int pass_error, int db_errno, int pass_errarg);
287
288+public:
289+
290 static TableShare::shared_ptr getShareCreate(Session *session,
291 const identifier::Table &identifier,
292 int &error);
293@@ -723,10 +725,7 @@
294 Table &outparam,
295 bool &error_reported);
296 public:
297- int parse_table_proto(Session& session, message::Table &table);
298-
299-private:
300- int inner_parse_table_proto(Session& session, message::Table &table);
301+ bool parse_table_proto(Session& session, message::Table &table);
302 };
303
304 } /* namespace drizzled */

Subscribers

People subscribed via source and target branches