Merge lp:~vkolesnikov/pbxt/pbxt-drizzle-merge into lp:pbxt

Proposed by Vladimir Kolesnikov
Status: Merged
Merged at revision: not available
Proposed branch: lp:~vkolesnikov/pbxt/pbxt-drizzle-merge
Merge into: lp:pbxt
Diff against target: None lines
To merge this branch: bzr merge lp:~vkolesnikov/pbxt/pbxt-drizzle-merge
Reviewer Review Type Date Requested Status
PBXT Core Pending
Review via email: mp+4920@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vladimir Kolesnikov (vkolesnikov) wrote :

some comments on changes:

1. I had to extend the scope of _try (b) {} _catch (b) {} section to include the second assignment of "thd" variable as otherwise gcc gives a warning stating that the variable can be clobbered by the longjmp.

2. added check for existence of pbxt.location.[frm|dfe] to xt_create_table_frm()

3. other changes are either Drizzle-specific fixes and don't affect MySQL code or are renames of variables, hiding of unused parameters, etc...

Revision history for this message
Paul McCullagh (paul-mccullagh) wrote :

Hi Vlad,

This was moved into the try block.

But you did not remove the copy before the try block. I assume you
just forgot...

Was it moved because of clobber warnings?

On Mar 26, 2009, at 9:55 AM, Vladimir Kolesnikov wrote:

> /* Can't do this here yet, because I need a THD! */
> try_(b) {
> + /* {MYSQL QUIRK}
> + * Sometime we have a THD,
> + * sometimes we don't.
> + * So far, I have noticed that during INSTALL PLUGIN,
> + * we have one, otherwize not.
> + */
> + if (!curr_thd) {
> + if (!(thd = (THD *) myxt_create_thread()))
> + xt_throw(self);
> + }
> +

--
Paul McCullagh
PrimeBase Technologies
www.primebase.org
www.blobstreaming.org
pbxt.blogspot.com

599. By Paul McCullagh

Merged changes for RN232

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2009-03-23 15:30:52 +0000
3+++ ChangeLog 2009-03-25 01:43:40 +0000
4@@ -3,6 +3,8 @@
5
6 ------- 1.0.08 RC - Not yet released
7
8+RN232: Merged Drizzle-specific changes into the main tree
9+
10 RN231: Fixed a bug that caused bad performance as the number of threads increased. This occurred when the number of open table handles exceeded 'table_open_cache', and MySQL started closing open table handlers. PBXT was flushing a table when all table handlers were closed. PBXT will now only do this when the FLUSH TABLES statement is used.
11
12 RN230: Improved efficiency of conflict resolution: Implemented a queue for threads waiting for a lock. Threads no longer poll to take a lock. If a temp lock is granted because of an update, then the thread granted the temp lock will also wait for the transaction that did the update to quit.
13
14=== modified file 'src/cache_xt.cc'
15--- src/cache_xt.cc 2009-03-05 13:28:59 +0000
16+++ src/cache_xt.cc 2009-03-25 01:43:40 +0000
17@@ -357,8 +357,8 @@
18 {
19 DcHandleSlotPtr hs;
20 XTIndBlockPtr block = NULL;
21- u_int hash_idx;
22- DcSegmentPtr seg;
23+ u_int hash_idx = NULL;
24+ DcSegmentPtr seg = NULL;
25 XTIndBlockPtr xblock;
26
27 /* The lock order is:
28
29=== modified file 'src/datadic_xt.cc'
30--- src/datadic_xt.cc 2009-03-25 09:31:29 +0000
31+++ src/datadic_xt.cc 2009-03-25 01:43:40 +0000
32@@ -1487,13 +1487,13 @@
33 if (lastColumn && ct_curr_column) {
34 /* This constraint has one column, the current column. */
35 XTDDColumnRef *cref;
36- char *name = xt_dup_string(self, ct_curr_column->dc_name);
37+ char *col_name = xt_dup_string(self, ct_curr_column->dc_name);
38
39 if (!(cref = new XTDDColumnRef())) {
40- xt_free(self, name);
41+ xt_free(self, col_name);
42 xt_throw_errno(XT_CONTEXT, XT_ENOMEM);
43 }
44- cref->cr_col_name = name;
45+ cref->cr_col_name = col_name;
46 ct_curr_constraint->co_cols.append(self, cref);
47 }
48 }
49@@ -2645,8 +2645,8 @@
50 /* Check that all the columns can be set to NULL! */
51 XTDDColumn *col;
52
53- for (u_int i=0; i<fk->co_cols.size(); i++) {
54- if ((col = findColumn(fk->co_cols.itemAt(i)->cr_col_name))) {
55+ for (u_int j=0; j<fk->co_cols.size(); j++) {
56+ if ((col = findColumn(fk->co_cols.itemAt(j)->cr_col_name))) {
57 if (!col->dc_null_ok)
58 xt_throw_tabcolerr(XT_CONTEXT, XT_ERR_COLUMN_IS_NOT_NULL, fk->fk_ref_tab_name, col->dc_name);
59 }
60
61=== modified file 'src/discover_xt.cc'
62--- src/discover_xt.cc 2008-10-29 10:45:13 +0000
63+++ src/discover_xt.cc 2009-03-25 01:43:40 +0000
64@@ -28,10 +28,12 @@
65 #include "item_create.h"
66 #include <m_ctype.h>
67 #else
68-#define DRIZZLE_SERVER 1
69+#include <drizzled/session.h>
70 #include <drizzled/server_includes.h>
71+#include <drizzled/sql_base.h>
72 #endif
73
74+#include "strutil_xt.h"
75 #include "ha_pbxt.h"
76 #include "discover_xt.h"
77 #include "ha_xtsys.h"
78@@ -1280,8 +1282,15 @@
79 #endif // LOCK_OPEN_HACK_REQUIRED
80
81 //------------------------------
82-int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *keys __attribute__((unused)))
83+int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *keys __attribute__((unused)), xtBool skip_existing)
84 {
85+#ifdef DRIZZLED
86+ static const char *ext = ".dfe";
87+ static const int ext_len = 4;
88+#else
89+ static const char *ext = ".frm";
90+ static const int ext_len = 4;
91+#endif
92 int err = 1;
93 //HA_CREATE_INFO create_info = {0};
94 //Alter_info alter_info;
95@@ -1295,7 +1304,9 @@
96
97 /* setup the create info */
98 mylex.create_info.db_type = hton;
99- mylex.create_info.frm_only = 1;
100+#ifndef DRIZZLED
101+ mylex.create_info.frm_only = 1;
102+#endif
103 mylex.create_info.default_table_charset = system_charset_info;
104
105 /* setup the column info. */
106@@ -1335,6 +1346,22 @@
107
108 info++;
109 }
110+
111+ if (skip_existing) {
112+ size_t db_len = strlen(db);
113+ size_t name_len = strlen(name);
114+ size_t len = db_len + 1 + name_len + ext_len + 1;
115+ char *path = (char *)xt_malloc_ns(len);
116+ memcpy(path, db, db_len);
117+ memcpy(path + db_len + 1, name, name_len);
118+ memcpy(path + db_len + 1 + name_len, ext, ext_len);
119+ path[db_len] = XT_DIR_CHAR;
120+ path[len - 1] = '\0';
121+ xtBool exists = xt_fs_exists(path);
122+ xt_free_ns(path);
123+ if (exists)
124+ goto noerror;
125+ }
126
127 /* Create an internal temp table */
128 #ifdef DRIZZLED
129@@ -1345,6 +1372,7 @@
130 goto error;
131 #endif
132
133+ noerror:
134 err = 0;
135
136 error:
137
138=== modified file 'src/discover_xt.h'
139--- src/discover_xt.h 2008-10-02 14:24:10 +0000
140+++ src/discover_xt.h 2009-03-25 01:43:40 +0000
141@@ -24,7 +24,7 @@
142 #define __DISCOVER_XT_H__
143
144 #ifdef DRIZZLED
145-#include <drizzled/common_includes.h>
146+#include <drizzled/common.h>
147 #else
148 #include "mysql_priv.h"
149 #endif
150@@ -73,7 +73,7 @@
151 const char* key_columns[8]; // The size of this can be set to what ever you need.
152 } DT_KEY_INFO;
153
154-int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *keys);
155+int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *keys, xtBool skip_existing);
156
157 #endif
158
159
160=== modified file 'src/ha_pbxt.cc'
161--- src/ha_pbxt.cc 2009-03-25 09:31:29 +0000
162+++ src/ha_pbxt.cc 2009-03-25 01:43:40 +0000
163@@ -37,11 +37,19 @@
164 #include <time.h>
165
166 #ifdef DRIZZLED
167-#include <drizzled/common_includes.h>
168+#include <drizzled/common.h>
169 #include <drizzled/plugin.h>
170+#include <mysys/my_alloc.h>
171+#include <mysys/hash.h>
172+#include <drizzled/field.h>
173+#include <drizzled/current_session.h>
174 #include <drizzled/data_home.h>
175 #include <drizzled/error.h>
176-extern ulong max_connections;
177+#include <drizzled/table.h>
178+#include <drizzled/field/timestamp.h>
179+#include <drizzled/server_includes.h>
180+extern "C" char **session_query(Session *session);
181+#define my_strdup(a,b) strdup(a)
182 #else
183 #include "mysql_priv.h"
184 #include <mysql/plugin.h>
185@@ -1140,12 +1148,23 @@
186
187 /* Can't do this here yet, because I need a THD! */
188 try_(b) {
189+ /* {MYSQL QUIRK}
190+ * Sometime we have a THD,
191+ * sometimes we don't.
192+ * So far, I have noticed that during INSTALL PLUGIN,
193+ * we have one, otherwize not.
194+ */
195+ if (!curr_thd) {
196+ if (!(thd = (THD *) myxt_create_thread()))
197+ xt_throw(self);
198+ }
199+
200 xt_open_database(self, mysql_real_data_home, TRUE);
201 pbxt_database = self->st_database;
202 xt_heap_reference(self, pbxt_database);
203 }
204 catch_(b) {
205- if (!curr_thd)
206+ if (!curr_thd && thd)
207 myxt_destroy_thread(thd, FALSE);
208 #ifndef DRIZZLED
209 myxt_mutex_lock(&LOCK_plugin);
210@@ -2213,10 +2232,10 @@
211 table->timestamp_field->set_time();
212
213 if (table->next_number_field && buf == table->record[0]) {
214- int err = update_auto_increment();
215- if (err) {
216+ int update_err = update_auto_increment();
217+ if (update_err) {
218 ha_log_pbxt_thread_error_for_mysql(pb_ignore_dup_key);
219- return err;
220+ return update_err;
221 }
222 set_auto_increment(table->next_number_field);
223 }
224@@ -4931,10 +4950,10 @@
225 xt_throw_errno(XT_CONTEXT, XT_ERR_NO_DICTIONARY);
226
227 for (int i = 0, sz = table_dic->dt_fkeys.size(); i < sz; i++) {
228- FOREIGN_KEY_INFO *info= new // assumed that C++ exceptions are disabled
229+ FOREIGN_KEY_INFO *fk_info= new // assumed that C++ exceptions are disabled
230 (thd_alloc(thd, sizeof(FOREIGN_KEY_INFO))) FOREIGN_KEY_INFO;
231
232- if (info == NULL)
233+ if (fk_info == NULL)
234 xt_throw_errno(XT_CONTEXT, XT_ENOMEM);
235
236 XTDDForeignKey *fk = table_dic->dt_fkeys.itemAt(i);
237@@ -4953,16 +4972,16 @@
238 ref_tbl_name++;
239 ref_db_name++;
240
241- info->forein_id = thd_make_lex_string(thd, 0,
242+ fk_info->forein_id = thd_make_lex_string(thd, 0,
243 fk->co_name, (uint) strlen(fk->co_name), 1);
244
245- info->referenced_db = thd_make_lex_string(thd, 0,
246+ fk_info->referenced_db = thd_make_lex_string(thd, 0,
247 ref_db_name, (uint) (ref_tbl_name - ref_db_name - 1), 1);
248
249- info->referenced_table = thd_make_lex_string(thd, 0,
250+ fk_info->referenced_table = thd_make_lex_string(thd, 0,
251 ref_tbl_name, (uint) strlen(ref_tbl_name), 1);
252
253- info->referenced_key_name = NULL;
254+ fk_info->referenced_key_name = NULL;
255
256 XTIndex *ix = fk->getReferenceIndexPtr();
257 if (ix == NULL) /* can be NULL if another thread changes referenced table at the moment */
258@@ -4983,7 +5002,7 @@
259 if (ddix->in_index == ix->mi_index_no) {
260 const char *ix_name =
261 ddix->co_name ? ddix->co_name : ddix->co_ind_name;
262- info->referenced_key_name = thd_make_lex_string(thd, 0,
263+ fk_info->referenced_key_name = thd_make_lex_string(thd, 0,
264 ix_name, (uint) strlen(ix_name), 1);
265 break;
266 }
267@@ -4991,27 +5010,27 @@
268 }
269
270 action = XTDDForeignKey::actionTypeToString(fk->fk_on_delete);
271- info->delete_method = thd_make_lex_string(thd, 0,
272+ fk_info->delete_method = thd_make_lex_string(thd, 0,
273 action, (uint) strlen(action), 1);
274 action = XTDDForeignKey::actionTypeToString(fk->fk_on_update);
275- info->update_method = thd_make_lex_string(thd, 0,
276+ fk_info->update_method = thd_make_lex_string(thd, 0,
277 action, (uint) strlen(action), 1);
278
279 const XTList<XTDDColumnRef>& cols = fk->co_cols;
280 for (int j = 0, sz2 = cols.size(); j < sz2; j++) {
281 XTDDColumnRef *col_ref= cols.itemAt(j);
282- info->foreign_fields.push_back(thd_make_lex_string(thd, 0,
283+ fk_info->foreign_fields.push_back(thd_make_lex_string(thd, 0,
284 col_ref->cr_col_name, (uint) strlen(col_ref->cr_col_name), 1));
285 }
286
287 const XTList<XTDDColumnRef>& ref_cols = fk->fk_ref_cols;
288 for (int j = 0, sz2 = ref_cols.size(); j < sz2; j++) {
289 XTDDColumnRef *col_ref= ref_cols.itemAt(j);
290- info->referenced_fields.push_back(thd_make_lex_string(thd, 0,
291+ fk_info->referenced_fields.push_back(thd_make_lex_string(thd, 0,
292 col_ref->cr_col_name, (uint) strlen(col_ref->cr_col_name), 1));
293 }
294
295- f_key_list->push_back(info);
296+ f_key_list->push_back(fk_info);
297 }
298 }
299 catch_(a) {
300@@ -5180,7 +5199,11 @@
301 };
302 #endif
303
304+#ifdef DRIZZLED
305+drizzle_declare_plugin(pbxt)
306+#else
307 mysql_declare_plugin(pbxt)
308+#endif
309 {
310 MYSQL_STORAGE_ENGINE_PLUGIN,
311 #ifndef DRIZZLED
312@@ -5227,7 +5250,11 @@
313 NULL, /* system variables */
314 NULL /* config options */
315 }
316+#ifdef DRIZZLED
317+drizzle_declare_plugin_end;
318+#else
319 mysql_declare_plugin_end;
320+#endif
321
322 #if defined(XT_WIN) && defined(XT_COREDUMP)
323
324
325=== modified file 'src/ha_pbxt.h'
326--- src/ha_pbxt.h 2009-03-23 15:30:52 +0000
327+++ src/ha_pbxt.h 2009-03-25 01:43:40 +0000
328@@ -26,7 +26,10 @@
329 #define __ha_pbxt_h__
330
331 #ifdef DRIZZLED
332-#include <drizzled/common_includes.h>
333+#include <drizzled/common.h>
334+#include <drizzled/handler.h>
335+#include <drizzled/handlerton.h>
336+#include <mysys/thr_lock.h>
337 #else
338 #include "mysql_priv.h"
339 #endif
340@@ -259,6 +262,7 @@
341 /*
342 * These hooks are suppossed to only be used by InnoDB:
343 */
344+#ifndef DRIZZLED
345 #ifdef INNODB_COMPATIBILITY_HOOKS
346 extern "C" struct charset_info_st *thd_charset(MYSQL_THD thd);
347 extern "C" char **thd_query(MYSQL_THD thd);
348@@ -274,6 +278,7 @@
349 #define thd_binlog_format(t) (t)->variables.binlog_format
350 #define thd_mark_transaction_to_rollback(t) mark_transaction_to_rollback(t, all)
351 #endif // INNODB_COMPATIBILITY_HOOKS */
352+#endif /* !DRIZZLED */
353
354 /* How to lock MySQL mutexes! */
355 #ifdef SAFE_MUTEX
356
357=== modified file 'src/ha_xtsys.cc'
358--- src/ha_xtsys.cc 2008-11-21 11:38:54 +0000
359+++ src/ha_xtsys.cc 2009-03-25 01:43:40 +0000
360@@ -35,6 +35,10 @@
361 #include <stdlib.h>
362 #include <time.h>
363
364+#ifdef DRIZZLED
365+#include <drizzled/server_includes.h>
366+#endif
367+
368 #include "ha_xtsys.h"
369 #include "ha_pbxt.h"
370
371@@ -42,6 +46,7 @@
372 #include "database_xt.h"
373 #include "discover_xt.h"
374 #include "systab_xt.h"
375+#include "xt_defs.h"
376
377 /* Note: mysql_priv.h messes with new, which caused a crash. */
378 #ifdef new
379
380=== modified file 'src/ha_xtsys.h'
381--- src/ha_xtsys.h 2008-10-02 17:11:30 +0000
382+++ src/ha_xtsys.h 2009-03-25 01:43:40 +0000
383@@ -29,7 +29,9 @@
384 #define __HA_XTSYS_H__
385
386 #ifdef DRIZZLED
387-#include <drizzled/common_includes.h>
388+#include <drizzled/common.h>
389+#include <drizzled/handler.h>
390+#include <drizzled/current_session.h>
391 #else
392 #include "mysql_priv.h"
393 #endif
394
395=== modified file 'src/heap_xt.cc'
396--- src/heap_xt.cc 2009-03-24 16:24:48 +0000
397+++ src/heap_xt.cc 2009-03-25 01:43:40 +0000
398@@ -75,7 +75,7 @@
399 #ifdef DEBUG
400 xtPublic void xt_mm_heap_reference(XTThreadPtr self, XTHeapPtr hp, u_int line, c_char *file)
401 #else
402-xtPublic void xt_heap_reference(XTThreadPtr self, XTHeapPtr hp)
403+xtPublic void xt_heap_reference(XTThreadPtr, XTHeapPtr hp)
404 #endif
405 {
406 xt_spinlock_lock(&hp->h_lock);
407
408=== modified file 'src/index_xt.cc'
409--- src/index_xt.cc 2009-03-25 09:31:29 +0000
410+++ src/index_xt.cc 2009-03-25 01:43:40 +0000
411@@ -427,13 +427,14 @@
412 bitem = base + guess * full_item_size;
413
414 switch (ind->mi_single_type) {
415- case HA_KEYTYPE_LONG_INT:
416+ case HA_KEYTYPE_LONG_INT: {
417 register xtInt4 a, b;
418
419 a = XT_GET_DISK_4(value->sv_key);
420 b = XT_GET_DISK_4(bitem);
421 r = (a < b) ? -1 : (a == b ? 0 : 1);
422 break;
423+ }
424 case HA_KEYTYPE_ULONG_INT: {
425 register xtWord4 a, b;
426
427@@ -988,7 +989,7 @@
428 /*
429 * Remove an item and save to disk.
430 */
431-static xtBool idx_remove_branch_item_right(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID address, XTIndReferencePtr iref, register XTIdxItemPtr item)
432+static xtBool idx_remove_branch_item_right(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID, XTIndReferencePtr iref, register XTIdxItemPtr item)
433 {
434 register XTIdxBranchDPtr branch = iref->ir_branch;
435 u_int size = item->i_item_size + item->i_node_ref_size;
436@@ -1016,7 +1017,7 @@
437 return OK;
438 }
439
440-static xtBool idx_remove_branch_item_left(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID address, XTIndReferencePtr iref, register XTIdxItemPtr item)
441+static xtBool idx_remove_branch_item_left(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID, XTIndReferencePtr iref, register XTIdxItemPtr item)
442 {
443 register XTIdxBranchDPtr branch = iref->ir_branch;
444 u_int size = item->i_item_size + item->i_node_ref_size;
445@@ -2667,7 +2668,7 @@
446
447 static void idx_set_index_selectivity(XTThreadPtr self __attribute__((unused)), XTOpenTablePtr ot, XTIndexPtr ind)
448 {
449- static const int MAX_RECORDS = 100;
450+ static const xtRecordID MAX_RECORDS = 100;
451
452 XTIdxSearchKeyRec search_key;
453 XTIndexSegPtr key_seg;
454@@ -2680,8 +2681,8 @@
455 u_int diff;
456 u_int j, i;
457 /* these 2 vars are used to check the overlapping if we have < 200 records */
458- int last_rec = 0; /* last record accounted in this iteration */
459- int last_iter_rec = 0; /* last record accounted in the previous iteration */
460+ xtRecordID last_rec = 0; /* last record accounted in this iteration */
461+ xtRecordID last_iter_rec = 0; /* last record accounted in the previous iteration */
462
463 xtBool (* xt_idx_iterator[2])(
464 register struct XTOpenTable *ot, register struct XTIndex *ind, register XTIdxSearchKeyPtr search_key) = {
465@@ -2932,7 +2933,7 @@
466 #endif
467
468 ind = tab->tab_dic.dic_keys;
469- for (u_int i=0; i<tab->tab_dic.dic_key_count; i++, ind++) {
470+ for (u_int k=0; k<tab->tab_dic.dic_key_count; k++, ind++) {
471 ind_count = idx_check_index(ot, *ind, TRUE);
472 block_count += ind_count;
473 }
474@@ -2963,10 +2964,10 @@
475
476 current = tab->tab_ind_free;
477 if (XT_NODE_ID(current)) {
478- u_int i = 0;
479+ u_int k = 0;
480 printf("Disk List:");
481 while (XT_NODE_ID(current)) {
482- if ((i % 40) == 0)
483+ if ((k % 40) == 0)
484 printf("\n");
485 free_count++;
486 #ifdef TRACK_ACTIVITY
487@@ -2978,9 +2979,9 @@
488 break;
489 }
490 XT_NODE_ID(current) = (xtIndexNodeID) XT_GET_DISK_8(free_block.if_next_block_8);
491- i++;
492+ k++;
493 }
494- if ((i % 40) != 0)
495+ if ((k % 40) != 0)
496 printf("\n");
497 }
498 printf("\n-----------------------------\n");
499
500=== modified file 'src/lock_xt.cc'
501--- src/lock_xt.cc 2009-03-25 09:31:29 +0000
502+++ src/lock_xt.cc 2009-03-25 01:43:40 +0000
503@@ -100,7 +100,7 @@
504 return 0;
505 }
506
507-void XTRowLockList::xt_remove_all_locks(struct XTDatabase *db, XTThreadPtr thread)
508+void XTRowLockList::xt_remove_all_locks(struct XTDatabase *, XTThreadPtr thread)
509 {
510 #ifdef XT_TRACE_LOCKS
511 xt_ttracef(xt_get_self(), "remove all locks\n");
512@@ -145,7 +145,7 @@
513 copy = group->lg_list;
514 item = group->lg_list;
515 new_count = 0;
516- for (int k=0; k<group->lg_list_in_use; k++) {
517+ for (size_t k=0; k<group->lg_list_in_use; k++) {
518 if (item->li_thread_id != thd_id) {
519 if (copy != item) {
520 copy->li_row_id = item->li_row_id;
521@@ -215,7 +215,7 @@
522 }
523 #endif
524
525-xtBool XTRowLocks::rl_lock_row(XTLockGroupPtr group, XTLockWaitPtr lw, XTRowLockListPtr lock_list, int *result)
526+xtBool XTRowLocks::rl_lock_row(XTLockGroupPtr group, XTLockWaitPtr lw, XTRowLockListPtr, int *result)
527 {
528 XTLockItemPtr item;
529 size_t index;
530@@ -450,7 +450,7 @@
531 XTLockItemPtr item;
532 size_t index;
533 xtBool lock_granted = FALSE;
534- xtThreadID locking_thread_id;
535+ xtThreadID locking_thread_id = 0;
536
537 if (!(row_id = ot->ot_temp_row_lock))
538 return;
539@@ -566,7 +566,7 @@
540
541 /* Add to the lock list: */
542 XTPermRowLockPtr locks = (XTPermRowLockPtr) lock_list->bl_data;
543- for (int i=0; i<lock_list->bl_count; i++) {
544+ for (unsigned i=0; i<lock_list->bl_count; i++) {
545 #ifdef XT_USE_TABLE_REF
546 if (locks->pr_table == ot->ot_table) {
547 #else
548@@ -1732,7 +1732,7 @@
549 #endif
550 }
551
552-xtPublic void xt_atomicrwlock_free(struct XTThread *self, XTAtomicRWLockPtr arw)
553+xtPublic void xt_atomicrwlock_free(struct XTThread *, XTAtomicRWLockPtr XT_UNUSED(arw))
554 {
555 #ifdef XT_THREAD_LOCK_INFO
556 xt_thread_lock_info_free(&arw->arw_lock_info);
557
558=== modified file 'src/lock_xt.h'
559--- src/lock_xt.h 2009-03-24 16:26:04 +0000
560+++ src/lock_xt.h 2009-03-25 01:43:40 +0000
561@@ -630,8 +630,8 @@
562 XTSpinLockRec lg_lock; /* A lock for the list. */
563 XTLockWaitPtr lg_wait_queue; /* A queue of threads waiting for a lock in this group. */
564 XTLockWaitPtr lg_wait_queue_end; /* The end of the thread queue. */
565- int lg_list_size; /* The size of the list. */
566- int lg_list_in_use; /* Number of slots on the list in use. */
567+ size_t lg_list_size; /* The size of the list. */
568+ size_t lg_list_in_use; /* Number of slots on the list in use. */
569 XTLockItemPtr lg_list; /* List of locks. */
570 } XTLockGroupRec, *XTLockGroupPtr;
571
572
573=== modified file 'src/myxt_xt.cc'
574--- src/myxt_xt.cc 2009-02-20 14:26:09 +0000
575+++ src/myxt_xt.cc 2009-03-25 01:43:40 +0000
576@@ -27,10 +27,17 @@
577 #include "xt_config.h"
578
579 #ifdef DRIZZLED
580-#define DRIZZLE_SERVER 1
581 #include <drizzled/server_includes.h>
582 #include <drizzled/plugin.h>
583 #include <drizzled/show.h>
584+#include <drizzled/field/blob.h>
585+#include <drizzled/field/enum.h>
586+#include <drizzled/field/varstring.h>
587+#include <drizzled/current_session.h>
588+#include <drizzled/sql_lex.h>
589+#include <drizzled/session.h>
590+extern "C" struct charset_info_st *session_charset(Session *session);
591+extern pthread_key_t THR_Session;
592 #else
593 #include "mysql_priv.h"
594 #include <mysql/plugin.h>
595@@ -623,7 +630,6 @@
596 case DRIZZLE_TYPE_NULL:
597 case DRIZZLE_TYPE_TIMESTAMP:
598 case DRIZZLE_TYPE_LONGLONG:
599- case DRIZZLE_TYPE_TIME:
600 case DRIZZLE_TYPE_DATETIME:
601 case DRIZZLE_TYPE_DATE:
602 case DRIZZLE_TYPE_NEWDECIMAL:
603@@ -743,7 +749,6 @@
604 case DRIZZLE_TYPE_NULL:
605 case DRIZZLE_TYPE_TIMESTAMP:
606 case DRIZZLE_TYPE_LONGLONG:
607- case DRIZZLE_TYPE_TIME:
608 case DRIZZLE_TYPE_DATETIME:
609 case DRIZZLE_TYPE_DATE:
610 case DRIZZLE_TYPE_NEWDECIMAL:
611@@ -1872,7 +1877,9 @@
612
613 static void my_close_table(TABLE *table)
614 {
615- closefrm(table, 1); // TODO: Q, why did Stewart remove this?
616+#ifndef DRIZZLED
617+ closefrm(table, 1); // TODO: Q, why did Stewart remove this?
618+#endif
619 xt_free_ns(table);
620 }
621
622@@ -2168,6 +2175,18 @@
623 seg->bit_start = ((Field_bit *) field)->bit_ofs;
624 seg->bit_pos = (uint) (((Field_bit *) field)->bit_ptr - (uchar*) table_arg->record[0]);
625 }
626+#else
627+ /* Drizzle uses HA_KEYTYPE_ULONG_INT keys for enums > 1 byte, which is not consistent with MySQL, so we fix it here */
628+ else if (field->type() == MYSQL_TYPE_ENUM) {
629+ switch (seg->length) {
630+ case 2:
631+ seg->type = HA_KEYTYPE_USHORT_INT;
632+ break;
633+ case 3:
634+ seg->type = HA_KEYTYPE_UINT24;
635+ break;
636+ }
637+ }
638 #endif
639
640 switch (seg->type) {
641@@ -2524,7 +2543,7 @@
642 if (!dic_rec_fixed) {
643 xtWord8 max_rec_size = offsetof(XTTabRecExt, re_data);
644
645- for (Field **field=my_tab->field; (curr_field = *field); field++) {
646+ for (Field **f=my_tab->field; (curr_field = *f); f++) {
647 max_data_size = curr_field->key_length();
648 enum_field_types tno = curr_field->type();
649 if (tno == MYSQL_TYPE_BLOB)
650@@ -3036,7 +3055,7 @@
651 table->field[column]->store(string, strlen(string), charset);
652 }
653
654-xtPublic int myxt_statistics_fill_table(XTThreadPtr self, void *th, void *ta, void *co, MX_CONST void *ch)
655+xtPublic int myxt_statistics_fill_table(XTThreadPtr self, void *th, void *ta, void *, MX_CONST void *ch)
656 {
657 THD *thd = (THD *) th;
658 TABLE_LIST *tables = (TABLE_LIST *) ta;
659
660=== modified file 'src/restart_xt.cc'
661--- src/restart_xt.cc 2009-03-25 09:31:29 +0000
662+++ src/restart_xt.cc 2009-03-25 01:43:40 +0000
663@@ -1772,15 +1772,15 @@
664 /* Read the checkpoint data: */
665 if (use_buffer) {
666 u_int no_of_logs;
667- xtLogID log_id;
668- xtTableID tab_id;
669+ xtLogID xt_log_id;
670+ xtTableID xt_tab_id;
671
672 xres_cp_number = XT_GET_DISK_6(use_buffer->xcp_chkpnt_no_6);
673 xres_cp_log_id = XT_GET_DISK_4(use_buffer->xcp_log_id_4);
674 xres_cp_log_offset = XT_GET_DISK_6(use_buffer->xcp_log_offs_6);
675- tab_id = XT_GET_DISK_4(use_buffer->xcp_tab_id_4);
676- if (tab_id > db->db_curr_tab_id)
677- db->db_curr_tab_id = tab_id;
678+ xt_tab_id = XT_GET_DISK_4(use_buffer->xcp_tab_id_4);
679+ if (xt_tab_id > db->db_curr_tab_id)
680+ db->db_curr_tab_id = xt_tab_id;
681 db->db_xn_curr_id = XT_GET_DISK_4(use_buffer->xcp_xact_id_4);
682 ind_rec_log_id = XT_GET_DISK_4(use_buffer->xcp_ind_rec_log_id_4);
683 ind_rec_log_offset = XT_GET_DISK_6(use_buffer->xcp_ind_rec_log_offs_6);
684@@ -1808,16 +1808,16 @@
685 * will be removed.
686 */
687 for (u_int i=0; i<no_of_logs; i++) {
688- log_id = (xtLogID) XT_GET_DISK_2(use_buffer->xcp_del_log[i]);
689+ xt_log_id = (xtLogID) XT_GET_DISK_2(use_buffer->xcp_del_log[i]);
690 #ifdef DEBUG_PRINT
691 if (i != 0)
692 printf(", ");
693- printf("%d", (int) log_id);
694+ printf("%d", (int) xt_log_id);
695 #endif
696 #ifdef DEBUG_KEEP_LOGS
697- xt_dl_set_to_delete(self, db, log_id);
698+ xt_dl_set_to_delete(self, db, xt_log_id);
699 #else
700- if (!xres_delete_data_log(db, log_id))
701+ if (!xres_delete_data_log(db, xt_log_id))
702 xt_throw(self);
703 #endif
704 }
705
706=== modified file 'src/systab_xt.cc'
707--- src/systab_xt.cc 2008-12-22 14:29:21 +0000
708+++ src/systab_xt.cc 2009-03-25 01:43:40 +0000
709@@ -30,6 +30,10 @@
710
711 #include <stdlib.h>
712 #include <time.h>
713+#ifdef DRIZZLED
714+#include <drizzled/server_includes.h>
715+#include <drizzled/current_session.h>
716+#endif
717
718 #include "ha_pbxt.h"
719 #include "systab_xt.h"
720@@ -593,7 +597,8 @@
721 current_thd, "pbxt",
722 strchr(xt_internal_tables[i].sts_path, '.') + 1,
723 xt_internal_tables[i].sts_info,
724- xt_internal_tables[i].sts_keys))
725+ xt_internal_tables[i].sts_keys,
726+ TRUE /*do not recreate*/))
727 xt_internal_tables[i].sts_exists = TRUE;
728 i++;
729 }
730
731=== modified file 'src/table_xt.cc'
732--- src/table_xt.cc 2009-03-25 09:31:29 +0000
733+++ src/table_xt.cc 2009-03-25 01:43:40 +0000
734@@ -32,7 +32,10 @@
735 #include <time.h>
736
737 #ifdef DRIZZLED
738-#include <drizzled/common_includes.h>
739+#include <drizzled/common.h>
740+#include <mysys/thr_lock.h>
741+#include <drizzled/dtcollation.h>
742+#include <drizzled/handlerton.h>
743 #else
744 #include "mysql_priv.h"
745 #endif
746
747=== modified file 'src/xaction_xt.cc'
748--- src/xaction_xt.cc 2009-03-25 09:31:29 +0000
749+++ src/xaction_xt.cc 2009-03-25 01:43:40 +0000
750@@ -462,6 +462,7 @@
751 tn_thd_id = wait_xact_ptr->xd_thread_id;
752 }
753 else {
754+ tn_thd_id = 0;
755 if (!xn_get_xact_details(db, xw->xw_xn_id, thread, &flags, &start, NULL, &tn_thd_id))
756 flags = XT_XN_XAC_ENDED | XT_XN_XAC_SWEEP;
757 }
758
759=== modified file 'src/xt_config.h'
760--- src/xt_config.h 2009-02-05 11:30:34 +0000
761+++ src/xt_config.h 2009-03-25 01:43:40 +0000
762@@ -33,6 +33,7 @@
763
764 #ifdef DRIZZLED
765 #include "drizzled/global.h"
766+const int max_connections = 500;
767 #else
768 #include <mysql_version.h>
769 #include "my_global.h"
770
771=== modified file 'src/xt_defs.h'
772--- src/xt_defs.h 2009-03-25 09:31:29 +0000
773+++ src/xt_defs.h 2009-03-25 01:43:40 +0000
774@@ -739,6 +739,17 @@
775
776 #define mysql_real_data_home drizzle_real_data_home
777
778+#define mi_int4store(T,A) { uint32_t def_temp= (uint32_t) (A);\
779+ ((unsigned char*) (T))[3]= (unsigned char) (def_temp);\
780+ ((unsigned char*) (T))[2]= (unsigned char) (def_temp >> 8);\
781+ ((unsigned char*) (T))[1]= (unsigned char) (def_temp >> 16);\
782+ ((unsigned char*) (T))[0]= (unsigned char) (def_temp >> 24); }
783+
784+#define mi_uint4korr(A) ((uint32_t) (((uint32_t) (((const unsigned char*) (A))[3])) +\
785+ (((uint32_t) (((const unsigned char*) (A))[2])) << 8) +\
786+ (((uint32_t) (((const unsigned char*) (A))[1])) << 16) +\
787+ (((uint32_t) (((const unsigned char*) (A))[0])) << 24)))
788+
789 #else // DRIZZLED
790 /* The MySQL case: */
791 #if MYSQL_VERSION_ID >= 60008

Subscribers

People subscribed via source and target branches