Merge lp:~vkolesnikov/pbxt/pbxt-drizzle-merge into lp:pbxt
- pbxt-drizzle-merge
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PBXT Core | Pending | ||
Review via email: mp+4920@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Vladimir Kolesnikov (vkolesnikov) wrote : | # |
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_
> + xt_throw(self);
> + }
> +
--
Paul McCullagh
PrimeBase Technologies
www.primebase.org
www.blobstreami
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 | 3 | 3 | ||
6 | 4 | ------- 1.0.08 RC - Not yet released | 4 | ------- 1.0.08 RC - Not yet released |
7 | 5 | 5 | ||
8 | 6 | RN232: Merged Drizzle-specific changes into the main tree | ||
9 | 7 | |||
10 | 6 | 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. | 8 | 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 | 7 | 9 | ||
12 | 8 | 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. | 10 | 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 | 9 | 11 | ||
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 | 357 | { | 357 | { |
19 | 358 | DcHandleSlotPtr hs; | 358 | DcHandleSlotPtr hs; |
20 | 359 | XTIndBlockPtr block = NULL; | 359 | XTIndBlockPtr block = NULL; |
23 | 360 | u_int hash_idx; | 360 | u_int hash_idx = NULL; |
24 | 361 | DcSegmentPtr seg; | 361 | DcSegmentPtr seg = NULL; |
25 | 362 | XTIndBlockPtr xblock; | 362 | XTIndBlockPtr xblock; |
26 | 363 | 363 | ||
27 | 364 | /* The lock order is: | 364 | /* The lock order is: |
28 | 365 | 365 | ||
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 | 1487 | if (lastColumn && ct_curr_column) { | 1487 | if (lastColumn && ct_curr_column) { |
34 | 1488 | /* This constraint has one column, the current column. */ | 1488 | /* This constraint has one column, the current column. */ |
35 | 1489 | XTDDColumnRef *cref; | 1489 | XTDDColumnRef *cref; |
37 | 1490 | char *name = xt_dup_string(self, ct_curr_column->dc_name); | 1490 | char *col_name = xt_dup_string(self, ct_curr_column->dc_name); |
38 | 1491 | 1491 | ||
39 | 1492 | if (!(cref = new XTDDColumnRef())) { | 1492 | if (!(cref = new XTDDColumnRef())) { |
41 | 1493 | xt_free(self, name); | 1493 | xt_free(self, col_name); |
42 | 1494 | xt_throw_errno(XT_CONTEXT, XT_ENOMEM); | 1494 | xt_throw_errno(XT_CONTEXT, XT_ENOMEM); |
43 | 1495 | } | 1495 | } |
45 | 1496 | cref->cr_col_name = name; | 1496 | cref->cr_col_name = col_name; |
46 | 1497 | ct_curr_constraint->co_cols.append(self, cref); | 1497 | ct_curr_constraint->co_cols.append(self, cref); |
47 | 1498 | } | 1498 | } |
48 | 1499 | } | 1499 | } |
49 | @@ -2645,8 +2645,8 @@ | |||
50 | 2645 | /* Check that all the columns can be set to NULL! */ | 2645 | /* Check that all the columns can be set to NULL! */ |
51 | 2646 | XTDDColumn *col; | 2646 | XTDDColumn *col; |
52 | 2647 | 2647 | ||
55 | 2648 | for (u_int i=0; i<fk->co_cols.size(); i++) { | 2648 | for (u_int j=0; j<fk->co_cols.size(); j++) { |
56 | 2649 | if ((col = findColumn(fk->co_cols.itemAt(i)->cr_col_name))) { | 2649 | if ((col = findColumn(fk->co_cols.itemAt(j)->cr_col_name))) { |
57 | 2650 | if (!col->dc_null_ok) | 2650 | if (!col->dc_null_ok) |
58 | 2651 | xt_throw_tabcolerr(XT_CONTEXT, XT_ERR_COLUMN_IS_NOT_NULL, fk->fk_ref_tab_name, col->dc_name); | 2651 | xt_throw_tabcolerr(XT_CONTEXT, XT_ERR_COLUMN_IS_NOT_NULL, fk->fk_ref_tab_name, col->dc_name); |
59 | 2652 | } | 2652 | } |
60 | 2653 | 2653 | ||
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 | 28 | #include "item_create.h" | 28 | #include "item_create.h" |
66 | 29 | #include <m_ctype.h> | 29 | #include <m_ctype.h> |
67 | 30 | #else | 30 | #else |
69 | 31 | #define DRIZZLE_SERVER 1 | 31 | #include <drizzled/session.h> |
70 | 32 | #include <drizzled/server_includes.h> | 32 | #include <drizzled/server_includes.h> |
71 | 33 | #include <drizzled/sql_base.h> | ||
72 | 33 | #endif | 34 | #endif |
73 | 34 | 35 | ||
74 | 36 | #include "strutil_xt.h" | ||
75 | 35 | #include "ha_pbxt.h" | 37 | #include "ha_pbxt.h" |
76 | 36 | #include "discover_xt.h" | 38 | #include "discover_xt.h" |
77 | 37 | #include "ha_xtsys.h" | 39 | #include "ha_xtsys.h" |
78 | @@ -1280,8 +1282,15 @@ | |||
79 | 1280 | #endif // LOCK_OPEN_HACK_REQUIRED | 1282 | #endif // LOCK_OPEN_HACK_REQUIRED |
80 | 1281 | 1283 | ||
81 | 1282 | //------------------------------ | 1284 | //------------------------------ |
83 | 1283 | 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))) | 1285 | 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 | 1284 | { | 1286 | { |
85 | 1287 | #ifdef DRIZZLED | ||
86 | 1288 | static const char *ext = ".dfe"; | ||
87 | 1289 | static const int ext_len = 4; | ||
88 | 1290 | #else | ||
89 | 1291 | static const char *ext = ".frm"; | ||
90 | 1292 | static const int ext_len = 4; | ||
91 | 1293 | #endif | ||
92 | 1285 | int err = 1; | 1294 | int err = 1; |
93 | 1286 | //HA_CREATE_INFO create_info = {0}; | 1295 | //HA_CREATE_INFO create_info = {0}; |
94 | 1287 | //Alter_info alter_info; | 1296 | //Alter_info alter_info; |
95 | @@ -1295,7 +1304,9 @@ | |||
96 | 1295 | 1304 | ||
97 | 1296 | /* setup the create info */ | 1305 | /* setup the create info */ |
98 | 1297 | mylex.create_info.db_type = hton; | 1306 | mylex.create_info.db_type = hton; |
100 | 1298 | mylex.create_info.frm_only = 1; | 1307 | #ifndef DRIZZLED |
101 | 1308 | mylex.create_info.frm_only = 1; | ||
102 | 1309 | #endif | ||
103 | 1299 | mylex.create_info.default_table_charset = system_charset_info; | 1310 | mylex.create_info.default_table_charset = system_charset_info; |
104 | 1300 | 1311 | ||
105 | 1301 | /* setup the column info. */ | 1312 | /* setup the column info. */ |
106 | @@ -1335,6 +1346,22 @@ | |||
107 | 1335 | 1346 | ||
108 | 1336 | info++; | 1347 | info++; |
109 | 1337 | } | 1348 | } |
110 | 1349 | |||
111 | 1350 | if (skip_existing) { | ||
112 | 1351 | size_t db_len = strlen(db); | ||
113 | 1352 | size_t name_len = strlen(name); | ||
114 | 1353 | size_t len = db_len + 1 + name_len + ext_len + 1; | ||
115 | 1354 | char *path = (char *)xt_malloc_ns(len); | ||
116 | 1355 | memcpy(path, db, db_len); | ||
117 | 1356 | memcpy(path + db_len + 1, name, name_len); | ||
118 | 1357 | memcpy(path + db_len + 1 + name_len, ext, ext_len); | ||
119 | 1358 | path[db_len] = XT_DIR_CHAR; | ||
120 | 1359 | path[len - 1] = '\0'; | ||
121 | 1360 | xtBool exists = xt_fs_exists(path); | ||
122 | 1361 | xt_free_ns(path); | ||
123 | 1362 | if (exists) | ||
124 | 1363 | goto noerror; | ||
125 | 1364 | } | ||
126 | 1338 | 1365 | ||
127 | 1339 | /* Create an internal temp table */ | 1366 | /* Create an internal temp table */ |
128 | 1340 | #ifdef DRIZZLED | 1367 | #ifdef DRIZZLED |
129 | @@ -1345,6 +1372,7 @@ | |||
130 | 1345 | goto error; | 1372 | goto error; |
131 | 1346 | #endif | 1373 | #endif |
132 | 1347 | 1374 | ||
133 | 1375 | noerror: | ||
134 | 1348 | err = 0; | 1376 | err = 0; |
135 | 1349 | 1377 | ||
136 | 1350 | error: | 1378 | error: |
137 | 1351 | 1379 | ||
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 | 24 | #define __DISCOVER_XT_H__ | 24 | #define __DISCOVER_XT_H__ |
143 | 25 | 25 | ||
144 | 26 | #ifdef DRIZZLED | 26 | #ifdef DRIZZLED |
146 | 27 | #include <drizzled/common_includes.h> | 27 | #include <drizzled/common.h> |
147 | 28 | #else | 28 | #else |
148 | 29 | #include "mysql_priv.h" | 29 | #include "mysql_priv.h" |
149 | 30 | #endif | 30 | #endif |
150 | @@ -73,7 +73,7 @@ | |||
151 | 73 | const char* key_columns[8]; // The size of this can be set to what ever you need. | 73 | const char* key_columns[8]; // The size of this can be set to what ever you need. |
152 | 74 | } DT_KEY_INFO; | 74 | } DT_KEY_INFO; |
153 | 75 | 75 | ||
155 | 76 | int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *keys); | 76 | 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 | 77 | 77 | ||
157 | 78 | #endif | 78 | #endif |
158 | 79 | 79 | ||
159 | 80 | 80 | ||
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 | 37 | #include <time.h> | 37 | #include <time.h> |
165 | 38 | 38 | ||
166 | 39 | #ifdef DRIZZLED | 39 | #ifdef DRIZZLED |
168 | 40 | #include <drizzled/common_includes.h> | 40 | #include <drizzled/common.h> |
169 | 41 | #include <drizzled/plugin.h> | 41 | #include <drizzled/plugin.h> |
170 | 42 | #include <mysys/my_alloc.h> | ||
171 | 43 | #include <mysys/hash.h> | ||
172 | 44 | #include <drizzled/field.h> | ||
173 | 45 | #include <drizzled/current_session.h> | ||
174 | 42 | #include <drizzled/data_home.h> | 46 | #include <drizzled/data_home.h> |
175 | 43 | #include <drizzled/error.h> | 47 | #include <drizzled/error.h> |
177 | 44 | extern ulong max_connections; | 48 | #include <drizzled/table.h> |
178 | 49 | #include <drizzled/field/timestamp.h> | ||
179 | 50 | #include <drizzled/server_includes.h> | ||
180 | 51 | extern "C" char **session_query(Session *session); | ||
181 | 52 | #define my_strdup(a,b) strdup(a) | ||
182 | 45 | #else | 53 | #else |
183 | 46 | #include "mysql_priv.h" | 54 | #include "mysql_priv.h" |
184 | 47 | #include <mysql/plugin.h> | 55 | #include <mysql/plugin.h> |
185 | @@ -1140,12 +1148,23 @@ | |||
186 | 1140 | 1148 | ||
187 | 1141 | /* Can't do this here yet, because I need a THD! */ | 1149 | /* Can't do this here yet, because I need a THD! */ |
188 | 1142 | try_(b) { | 1150 | try_(b) { |
189 | 1151 | /* {MYSQL QUIRK} | ||
190 | 1152 | * Sometime we have a THD, | ||
191 | 1153 | * sometimes we don't. | ||
192 | 1154 | * So far, I have noticed that during INSTALL PLUGIN, | ||
193 | 1155 | * we have one, otherwize not. | ||
194 | 1156 | */ | ||
195 | 1157 | if (!curr_thd) { | ||
196 | 1158 | if (!(thd = (THD *) myxt_create_thread())) | ||
197 | 1159 | xt_throw(self); | ||
198 | 1160 | } | ||
199 | 1161 | |||
200 | 1143 | xt_open_database(self, mysql_real_data_home, TRUE); | 1162 | xt_open_database(self, mysql_real_data_home, TRUE); |
201 | 1144 | pbxt_database = self->st_database; | 1163 | pbxt_database = self->st_database; |
202 | 1145 | xt_heap_reference(self, pbxt_database); | 1164 | xt_heap_reference(self, pbxt_database); |
203 | 1146 | } | 1165 | } |
204 | 1147 | catch_(b) { | 1166 | catch_(b) { |
206 | 1148 | if (!curr_thd) | 1167 | if (!curr_thd && thd) |
207 | 1149 | myxt_destroy_thread(thd, FALSE); | 1168 | myxt_destroy_thread(thd, FALSE); |
208 | 1150 | #ifndef DRIZZLED | 1169 | #ifndef DRIZZLED |
209 | 1151 | myxt_mutex_lock(&LOCK_plugin); | 1170 | myxt_mutex_lock(&LOCK_plugin); |
210 | @@ -2213,10 +2232,10 @@ | |||
211 | 2213 | table->timestamp_field->set_time(); | 2232 | table->timestamp_field->set_time(); |
212 | 2214 | 2233 | ||
213 | 2215 | if (table->next_number_field && buf == table->record[0]) { | 2234 | if (table->next_number_field && buf == table->record[0]) { |
216 | 2216 | int err = update_auto_increment(); | 2235 | int update_err = update_auto_increment(); |
217 | 2217 | if (err) { | 2236 | if (update_err) { |
218 | 2218 | ha_log_pbxt_thread_error_for_mysql(pb_ignore_dup_key); | 2237 | ha_log_pbxt_thread_error_for_mysql(pb_ignore_dup_key); |
220 | 2219 | return err; | 2238 | return update_err; |
221 | 2220 | } | 2239 | } |
222 | 2221 | set_auto_increment(table->next_number_field); | 2240 | set_auto_increment(table->next_number_field); |
223 | 2222 | } | 2241 | } |
224 | @@ -4931,10 +4950,10 @@ | |||
225 | 4931 | xt_throw_errno(XT_CONTEXT, XT_ERR_NO_DICTIONARY); | 4950 | xt_throw_errno(XT_CONTEXT, XT_ERR_NO_DICTIONARY); |
226 | 4932 | 4951 | ||
227 | 4933 | for (int i = 0, sz = table_dic->dt_fkeys.size(); i < sz; i++) { | 4952 | for (int i = 0, sz = table_dic->dt_fkeys.size(); i < sz; i++) { |
229 | 4934 | FOREIGN_KEY_INFO *info= new // assumed that C++ exceptions are disabled | 4953 | FOREIGN_KEY_INFO *fk_info= new // assumed that C++ exceptions are disabled |
230 | 4935 | (thd_alloc(thd, sizeof(FOREIGN_KEY_INFO))) FOREIGN_KEY_INFO; | 4954 | (thd_alloc(thd, sizeof(FOREIGN_KEY_INFO))) FOREIGN_KEY_INFO; |
231 | 4936 | 4955 | ||
233 | 4937 | if (info == NULL) | 4956 | if (fk_info == NULL) |
234 | 4938 | xt_throw_errno(XT_CONTEXT, XT_ENOMEM); | 4957 | xt_throw_errno(XT_CONTEXT, XT_ENOMEM); |
235 | 4939 | 4958 | ||
236 | 4940 | XTDDForeignKey *fk = table_dic->dt_fkeys.itemAt(i); | 4959 | XTDDForeignKey *fk = table_dic->dt_fkeys.itemAt(i); |
237 | @@ -4953,16 +4972,16 @@ | |||
238 | 4953 | ref_tbl_name++; | 4972 | ref_tbl_name++; |
239 | 4954 | ref_db_name++; | 4973 | ref_db_name++; |
240 | 4955 | 4974 | ||
242 | 4956 | info->forein_id = thd_make_lex_string(thd, 0, | 4975 | fk_info->forein_id = thd_make_lex_string(thd, 0, |
243 | 4957 | fk->co_name, (uint) strlen(fk->co_name), 1); | 4976 | fk->co_name, (uint) strlen(fk->co_name), 1); |
244 | 4958 | 4977 | ||
246 | 4959 | info->referenced_db = thd_make_lex_string(thd, 0, | 4978 | fk_info->referenced_db = thd_make_lex_string(thd, 0, |
247 | 4960 | ref_db_name, (uint) (ref_tbl_name - ref_db_name - 1), 1); | 4979 | ref_db_name, (uint) (ref_tbl_name - ref_db_name - 1), 1); |
248 | 4961 | 4980 | ||
250 | 4962 | info->referenced_table = thd_make_lex_string(thd, 0, | 4981 | fk_info->referenced_table = thd_make_lex_string(thd, 0, |
251 | 4963 | ref_tbl_name, (uint) strlen(ref_tbl_name), 1); | 4982 | ref_tbl_name, (uint) strlen(ref_tbl_name), 1); |
252 | 4964 | 4983 | ||
254 | 4965 | info->referenced_key_name = NULL; | 4984 | fk_info->referenced_key_name = NULL; |
255 | 4966 | 4985 | ||
256 | 4967 | XTIndex *ix = fk->getReferenceIndexPtr(); | 4986 | XTIndex *ix = fk->getReferenceIndexPtr(); |
257 | 4968 | if (ix == NULL) /* can be NULL if another thread changes referenced table at the moment */ | 4987 | if (ix == NULL) /* can be NULL if another thread changes referenced table at the moment */ |
258 | @@ -4983,7 +5002,7 @@ | |||
259 | 4983 | if (ddix->in_index == ix->mi_index_no) { | 5002 | if (ddix->in_index == ix->mi_index_no) { |
260 | 4984 | const char *ix_name = | 5003 | const char *ix_name = |
261 | 4985 | ddix->co_name ? ddix->co_name : ddix->co_ind_name; | 5004 | ddix->co_name ? ddix->co_name : ddix->co_ind_name; |
263 | 4986 | info->referenced_key_name = thd_make_lex_string(thd, 0, | 5005 | fk_info->referenced_key_name = thd_make_lex_string(thd, 0, |
264 | 4987 | ix_name, (uint) strlen(ix_name), 1); | 5006 | ix_name, (uint) strlen(ix_name), 1); |
265 | 4988 | break; | 5007 | break; |
266 | 4989 | } | 5008 | } |
267 | @@ -4991,27 +5010,27 @@ | |||
268 | 4991 | } | 5010 | } |
269 | 4992 | 5011 | ||
270 | 4993 | action = XTDDForeignKey::actionTypeToString(fk->fk_on_delete); | 5012 | action = XTDDForeignKey::actionTypeToString(fk->fk_on_delete); |
272 | 4994 | info->delete_method = thd_make_lex_string(thd, 0, | 5013 | fk_info->delete_method = thd_make_lex_string(thd, 0, |
273 | 4995 | action, (uint) strlen(action), 1); | 5014 | action, (uint) strlen(action), 1); |
274 | 4996 | action = XTDDForeignKey::actionTypeToString(fk->fk_on_update); | 5015 | action = XTDDForeignKey::actionTypeToString(fk->fk_on_update); |
276 | 4997 | info->update_method = thd_make_lex_string(thd, 0, | 5016 | fk_info->update_method = thd_make_lex_string(thd, 0, |
277 | 4998 | action, (uint) strlen(action), 1); | 5017 | action, (uint) strlen(action), 1); |
278 | 4999 | 5018 | ||
279 | 5000 | const XTList<XTDDColumnRef>& cols = fk->co_cols; | 5019 | const XTList<XTDDColumnRef>& cols = fk->co_cols; |
280 | 5001 | for (int j = 0, sz2 = cols.size(); j < sz2; j++) { | 5020 | for (int j = 0, sz2 = cols.size(); j < sz2; j++) { |
281 | 5002 | XTDDColumnRef *col_ref= cols.itemAt(j); | 5021 | XTDDColumnRef *col_ref= cols.itemAt(j); |
283 | 5003 | info->foreign_fields.push_back(thd_make_lex_string(thd, 0, | 5022 | fk_info->foreign_fields.push_back(thd_make_lex_string(thd, 0, |
284 | 5004 | col_ref->cr_col_name, (uint) strlen(col_ref->cr_col_name), 1)); | 5023 | col_ref->cr_col_name, (uint) strlen(col_ref->cr_col_name), 1)); |
285 | 5005 | } | 5024 | } |
286 | 5006 | 5025 | ||
287 | 5007 | const XTList<XTDDColumnRef>& ref_cols = fk->fk_ref_cols; | 5026 | const XTList<XTDDColumnRef>& ref_cols = fk->fk_ref_cols; |
288 | 5008 | for (int j = 0, sz2 = ref_cols.size(); j < sz2; j++) { | 5027 | for (int j = 0, sz2 = ref_cols.size(); j < sz2; j++) { |
289 | 5009 | XTDDColumnRef *col_ref= ref_cols.itemAt(j); | 5028 | XTDDColumnRef *col_ref= ref_cols.itemAt(j); |
291 | 5010 | info->referenced_fields.push_back(thd_make_lex_string(thd, 0, | 5029 | fk_info->referenced_fields.push_back(thd_make_lex_string(thd, 0, |
292 | 5011 | col_ref->cr_col_name, (uint) strlen(col_ref->cr_col_name), 1)); | 5030 | col_ref->cr_col_name, (uint) strlen(col_ref->cr_col_name), 1)); |
293 | 5012 | } | 5031 | } |
294 | 5013 | 5032 | ||
296 | 5014 | f_key_list->push_back(info); | 5033 | f_key_list->push_back(fk_info); |
297 | 5015 | } | 5034 | } |
298 | 5016 | } | 5035 | } |
299 | 5017 | catch_(a) { | 5036 | catch_(a) { |
300 | @@ -5180,7 +5199,11 @@ | |||
301 | 5180 | }; | 5199 | }; |
302 | 5181 | #endif | 5200 | #endif |
303 | 5182 | 5201 | ||
304 | 5202 | #ifdef DRIZZLED | ||
305 | 5203 | drizzle_declare_plugin(pbxt) | ||
306 | 5204 | #else | ||
307 | 5183 | mysql_declare_plugin(pbxt) | 5205 | mysql_declare_plugin(pbxt) |
308 | 5206 | #endif | ||
309 | 5184 | { | 5207 | { |
310 | 5185 | MYSQL_STORAGE_ENGINE_PLUGIN, | 5208 | MYSQL_STORAGE_ENGINE_PLUGIN, |
311 | 5186 | #ifndef DRIZZLED | 5209 | #ifndef DRIZZLED |
312 | @@ -5227,7 +5250,11 @@ | |||
313 | 5227 | NULL, /* system variables */ | 5250 | NULL, /* system variables */ |
314 | 5228 | NULL /* config options */ | 5251 | NULL /* config options */ |
315 | 5229 | } | 5252 | } |
316 | 5253 | #ifdef DRIZZLED | ||
317 | 5254 | drizzle_declare_plugin_end; | ||
318 | 5255 | #else | ||
319 | 5230 | mysql_declare_plugin_end; | 5256 | mysql_declare_plugin_end; |
320 | 5257 | #endif | ||
321 | 5231 | 5258 | ||
322 | 5232 | #if defined(XT_WIN) && defined(XT_COREDUMP) | 5259 | #if defined(XT_WIN) && defined(XT_COREDUMP) |
323 | 5233 | 5260 | ||
324 | 5234 | 5261 | ||
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 | 26 | #define __ha_pbxt_h__ | 26 | #define __ha_pbxt_h__ |
330 | 27 | 27 | ||
331 | 28 | #ifdef DRIZZLED | 28 | #ifdef DRIZZLED |
333 | 29 | #include <drizzled/common_includes.h> | 29 | #include <drizzled/common.h> |
334 | 30 | #include <drizzled/handler.h> | ||
335 | 31 | #include <drizzled/handlerton.h> | ||
336 | 32 | #include <mysys/thr_lock.h> | ||
337 | 30 | #else | 33 | #else |
338 | 31 | #include "mysql_priv.h" | 34 | #include "mysql_priv.h" |
339 | 32 | #endif | 35 | #endif |
340 | @@ -259,6 +262,7 @@ | |||
341 | 259 | /* | 262 | /* |
342 | 260 | * These hooks are suppossed to only be used by InnoDB: | 263 | * These hooks are suppossed to only be used by InnoDB: |
343 | 261 | */ | 264 | */ |
344 | 265 | #ifndef DRIZZLED | ||
345 | 262 | #ifdef INNODB_COMPATIBILITY_HOOKS | 266 | #ifdef INNODB_COMPATIBILITY_HOOKS |
346 | 263 | extern "C" struct charset_info_st *thd_charset(MYSQL_THD thd); | 267 | extern "C" struct charset_info_st *thd_charset(MYSQL_THD thd); |
347 | 264 | extern "C" char **thd_query(MYSQL_THD thd); | 268 | extern "C" char **thd_query(MYSQL_THD thd); |
348 | @@ -274,6 +278,7 @@ | |||
349 | 274 | #define thd_binlog_format(t) (t)->variables.binlog_format | 278 | #define thd_binlog_format(t) (t)->variables.binlog_format |
350 | 275 | #define thd_mark_transaction_to_rollback(t) mark_transaction_to_rollback(t, all) | 279 | #define thd_mark_transaction_to_rollback(t) mark_transaction_to_rollback(t, all) |
351 | 276 | #endif // INNODB_COMPATIBILITY_HOOKS */ | 280 | #endif // INNODB_COMPATIBILITY_HOOKS */ |
352 | 281 | #endif /* !DRIZZLED */ | ||
353 | 277 | 282 | ||
354 | 278 | /* How to lock MySQL mutexes! */ | 283 | /* How to lock MySQL mutexes! */ |
355 | 279 | #ifdef SAFE_MUTEX | 284 | #ifdef SAFE_MUTEX |
356 | 280 | 285 | ||
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 | 35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
362 | 36 | #include <time.h> | 36 | #include <time.h> |
363 | 37 | 37 | ||
364 | 38 | #ifdef DRIZZLED | ||
365 | 39 | #include <drizzled/server_includes.h> | ||
366 | 40 | #endif | ||
367 | 41 | |||
368 | 38 | #include "ha_xtsys.h" | 42 | #include "ha_xtsys.h" |
369 | 39 | #include "ha_pbxt.h" | 43 | #include "ha_pbxt.h" |
370 | 40 | 44 | ||
371 | @@ -42,6 +46,7 @@ | |||
372 | 42 | #include "database_xt.h" | 46 | #include "database_xt.h" |
373 | 43 | #include "discover_xt.h" | 47 | #include "discover_xt.h" |
374 | 44 | #include "systab_xt.h" | 48 | #include "systab_xt.h" |
375 | 49 | #include "xt_defs.h" | ||
376 | 45 | 50 | ||
377 | 46 | /* Note: mysql_priv.h messes with new, which caused a crash. */ | 51 | /* Note: mysql_priv.h messes with new, which caused a crash. */ |
378 | 47 | #ifdef new | 52 | #ifdef new |
379 | 48 | 53 | ||
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 | 29 | #define __HA_XTSYS_H__ | 29 | #define __HA_XTSYS_H__ |
385 | 30 | 30 | ||
386 | 31 | #ifdef DRIZZLED | 31 | #ifdef DRIZZLED |
388 | 32 | #include <drizzled/common_includes.h> | 32 | #include <drizzled/common.h> |
389 | 33 | #include <drizzled/handler.h> | ||
390 | 34 | #include <drizzled/current_session.h> | ||
391 | 33 | #else | 35 | #else |
392 | 34 | #include "mysql_priv.h" | 36 | #include "mysql_priv.h" |
393 | 35 | #endif | 37 | #endif |
394 | 36 | 38 | ||
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 | 75 | #ifdef DEBUG | 75 | #ifdef DEBUG |
400 | 76 | xtPublic void xt_mm_heap_reference(XTThreadPtr self, XTHeapPtr hp, u_int line, c_char *file) | 76 | xtPublic void xt_mm_heap_reference(XTThreadPtr self, XTHeapPtr hp, u_int line, c_char *file) |
401 | 77 | #else | 77 | #else |
403 | 78 | xtPublic void xt_heap_reference(XTThreadPtr self, XTHeapPtr hp) | 78 | xtPublic void xt_heap_reference(XTThreadPtr, XTHeapPtr hp) |
404 | 79 | #endif | 79 | #endif |
405 | 80 | { | 80 | { |
406 | 81 | xt_spinlock_lock(&hp->h_lock); | 81 | xt_spinlock_lock(&hp->h_lock); |
407 | 82 | 82 | ||
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 | 427 | bitem = base + guess * full_item_size; | 427 | bitem = base + guess * full_item_size; |
413 | 428 | 428 | ||
414 | 429 | switch (ind->mi_single_type) { | 429 | switch (ind->mi_single_type) { |
416 | 430 | case HA_KEYTYPE_LONG_INT: | 430 | case HA_KEYTYPE_LONG_INT: { |
417 | 431 | register xtInt4 a, b; | 431 | register xtInt4 a, b; |
418 | 432 | 432 | ||
419 | 433 | a = XT_GET_DISK_4(value->sv_key); | 433 | a = XT_GET_DISK_4(value->sv_key); |
420 | 434 | b = XT_GET_DISK_4(bitem); | 434 | b = XT_GET_DISK_4(bitem); |
421 | 435 | r = (a < b) ? -1 : (a == b ? 0 : 1); | 435 | r = (a < b) ? -1 : (a == b ? 0 : 1); |
422 | 436 | break; | 436 | break; |
423 | 437 | } | ||
424 | 437 | case HA_KEYTYPE_ULONG_INT: { | 438 | case HA_KEYTYPE_ULONG_INT: { |
425 | 438 | register xtWord4 a, b; | 439 | register xtWord4 a, b; |
426 | 439 | 440 | ||
427 | @@ -988,7 +989,7 @@ | |||
428 | 988 | /* | 989 | /* |
429 | 989 | * Remove an item and save to disk. | 990 | * Remove an item and save to disk. |
430 | 990 | */ | 991 | */ |
432 | 991 | static xtBool idx_remove_branch_item_right(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID address, XTIndReferencePtr iref, register XTIdxItemPtr item) | 992 | static xtBool idx_remove_branch_item_right(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID, XTIndReferencePtr iref, register XTIdxItemPtr item) |
433 | 992 | { | 993 | { |
434 | 993 | register XTIdxBranchDPtr branch = iref->ir_branch; | 994 | register XTIdxBranchDPtr branch = iref->ir_branch; |
435 | 994 | u_int size = item->i_item_size + item->i_node_ref_size; | 995 | u_int size = item->i_item_size + item->i_node_ref_size; |
436 | @@ -1016,7 +1017,7 @@ | |||
437 | 1016 | return OK; | 1017 | return OK; |
438 | 1017 | } | 1018 | } |
439 | 1018 | 1019 | ||
441 | 1019 | static xtBool idx_remove_branch_item_left(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID address, XTIndReferencePtr iref, register XTIdxItemPtr item) | 1020 | static xtBool idx_remove_branch_item_left(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID, XTIndReferencePtr iref, register XTIdxItemPtr item) |
442 | 1020 | { | 1021 | { |
443 | 1021 | register XTIdxBranchDPtr branch = iref->ir_branch; | 1022 | register XTIdxBranchDPtr branch = iref->ir_branch; |
444 | 1022 | u_int size = item->i_item_size + item->i_node_ref_size; | 1023 | u_int size = item->i_item_size + item->i_node_ref_size; |
445 | @@ -2667,7 +2668,7 @@ | |||
446 | 2667 | 2668 | ||
447 | 2668 | static void idx_set_index_selectivity(XTThreadPtr self __attribute__((unused)), XTOpenTablePtr ot, XTIndexPtr ind) | 2669 | static void idx_set_index_selectivity(XTThreadPtr self __attribute__((unused)), XTOpenTablePtr ot, XTIndexPtr ind) |
448 | 2669 | { | 2670 | { |
450 | 2670 | static const int MAX_RECORDS = 100; | 2671 | static const xtRecordID MAX_RECORDS = 100; |
451 | 2671 | 2672 | ||
452 | 2672 | XTIdxSearchKeyRec search_key; | 2673 | XTIdxSearchKeyRec search_key; |
453 | 2673 | XTIndexSegPtr key_seg; | 2674 | XTIndexSegPtr key_seg; |
454 | @@ -2680,8 +2681,8 @@ | |||
455 | 2680 | u_int diff; | 2681 | u_int diff; |
456 | 2681 | u_int j, i; | 2682 | u_int j, i; |
457 | 2682 | /* these 2 vars are used to check the overlapping if we have < 200 records */ | 2683 | /* these 2 vars are used to check the overlapping if we have < 200 records */ |
460 | 2683 | int last_rec = 0; /* last record accounted in this iteration */ | 2684 | xtRecordID last_rec = 0; /* last record accounted in this iteration */ |
461 | 2684 | int last_iter_rec = 0; /* last record accounted in the previous iteration */ | 2685 | xtRecordID last_iter_rec = 0; /* last record accounted in the previous iteration */ |
462 | 2685 | 2686 | ||
463 | 2686 | xtBool (* xt_idx_iterator[2])( | 2687 | xtBool (* xt_idx_iterator[2])( |
464 | 2687 | register struct XTOpenTable *ot, register struct XTIndex *ind, register XTIdxSearchKeyPtr search_key) = { | 2688 | register struct XTOpenTable *ot, register struct XTIndex *ind, register XTIdxSearchKeyPtr search_key) = { |
465 | @@ -2932,7 +2933,7 @@ | |||
466 | 2932 | #endif | 2933 | #endif |
467 | 2933 | 2934 | ||
468 | 2934 | ind = tab->tab_dic.dic_keys; | 2935 | ind = tab->tab_dic.dic_keys; |
470 | 2935 | for (u_int i=0; i<tab->tab_dic.dic_key_count; i++, ind++) { | 2936 | for (u_int k=0; k<tab->tab_dic.dic_key_count; k++, ind++) { |
471 | 2936 | ind_count = idx_check_index(ot, *ind, TRUE); | 2937 | ind_count = idx_check_index(ot, *ind, TRUE); |
472 | 2937 | block_count += ind_count; | 2938 | block_count += ind_count; |
473 | 2938 | } | 2939 | } |
474 | @@ -2963,10 +2964,10 @@ | |||
475 | 2963 | 2964 | ||
476 | 2964 | current = tab->tab_ind_free; | 2965 | current = tab->tab_ind_free; |
477 | 2965 | if (XT_NODE_ID(current)) { | 2966 | if (XT_NODE_ID(current)) { |
479 | 2966 | u_int i = 0; | 2967 | u_int k = 0; |
480 | 2967 | printf("Disk List:"); | 2968 | printf("Disk List:"); |
481 | 2968 | while (XT_NODE_ID(current)) { | 2969 | while (XT_NODE_ID(current)) { |
483 | 2969 | if ((i % 40) == 0) | 2970 | if ((k % 40) == 0) |
484 | 2970 | printf("\n"); | 2971 | printf("\n"); |
485 | 2971 | free_count++; | 2972 | free_count++; |
486 | 2972 | #ifdef TRACK_ACTIVITY | 2973 | #ifdef TRACK_ACTIVITY |
487 | @@ -2978,9 +2979,9 @@ | |||
488 | 2978 | break; | 2979 | break; |
489 | 2979 | } | 2980 | } |
490 | 2980 | XT_NODE_ID(current) = (xtIndexNodeID) XT_GET_DISK_8(free_block.if_next_block_8); | 2981 | XT_NODE_ID(current) = (xtIndexNodeID) XT_GET_DISK_8(free_block.if_next_block_8); |
492 | 2981 | i++; | 2982 | k++; |
493 | 2982 | } | 2983 | } |
495 | 2983 | if ((i % 40) != 0) | 2984 | if ((k % 40) != 0) |
496 | 2984 | printf("\n"); | 2985 | printf("\n"); |
497 | 2985 | } | 2986 | } |
498 | 2986 | printf("\n-----------------------------\n"); | 2987 | printf("\n-----------------------------\n"); |
499 | 2987 | 2988 | ||
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 | 100 | return 0; | 100 | return 0; |
505 | 101 | } | 101 | } |
506 | 102 | 102 | ||
508 | 103 | void XTRowLockList::xt_remove_all_locks(struct XTDatabase *db, XTThreadPtr thread) | 103 | void XTRowLockList::xt_remove_all_locks(struct XTDatabase *, XTThreadPtr thread) |
509 | 104 | { | 104 | { |
510 | 105 | #ifdef XT_TRACE_LOCKS | 105 | #ifdef XT_TRACE_LOCKS |
511 | 106 | xt_ttracef(xt_get_self(), "remove all locks\n"); | 106 | xt_ttracef(xt_get_self(), "remove all locks\n"); |
512 | @@ -145,7 +145,7 @@ | |||
513 | 145 | copy = group->lg_list; | 145 | copy = group->lg_list; |
514 | 146 | item = group->lg_list; | 146 | item = group->lg_list; |
515 | 147 | new_count = 0; | 147 | new_count = 0; |
517 | 148 | for (int k=0; k<group->lg_list_in_use; k++) { | 148 | for (size_t k=0; k<group->lg_list_in_use; k++) { |
518 | 149 | if (item->li_thread_id != thd_id) { | 149 | if (item->li_thread_id != thd_id) { |
519 | 150 | if (copy != item) { | 150 | if (copy != item) { |
520 | 151 | copy->li_row_id = item->li_row_id; | 151 | copy->li_row_id = item->li_row_id; |
521 | @@ -215,7 +215,7 @@ | |||
522 | 215 | } | 215 | } |
523 | 216 | #endif | 216 | #endif |
524 | 217 | 217 | ||
526 | 218 | xtBool XTRowLocks::rl_lock_row(XTLockGroupPtr group, XTLockWaitPtr lw, XTRowLockListPtr lock_list, int *result) | 218 | xtBool XTRowLocks::rl_lock_row(XTLockGroupPtr group, XTLockWaitPtr lw, XTRowLockListPtr, int *result) |
527 | 219 | { | 219 | { |
528 | 220 | XTLockItemPtr item; | 220 | XTLockItemPtr item; |
529 | 221 | size_t index; | 221 | size_t index; |
530 | @@ -450,7 +450,7 @@ | |||
531 | 450 | XTLockItemPtr item; | 450 | XTLockItemPtr item; |
532 | 451 | size_t index; | 451 | size_t index; |
533 | 452 | xtBool lock_granted = FALSE; | 452 | xtBool lock_granted = FALSE; |
535 | 453 | xtThreadID locking_thread_id; | 453 | xtThreadID locking_thread_id = 0; |
536 | 454 | 454 | ||
537 | 455 | if (!(row_id = ot->ot_temp_row_lock)) | 455 | if (!(row_id = ot->ot_temp_row_lock)) |
538 | 456 | return; | 456 | return; |
539 | @@ -566,7 +566,7 @@ | |||
540 | 566 | 566 | ||
541 | 567 | /* Add to the lock list: */ | 567 | /* Add to the lock list: */ |
542 | 568 | XTPermRowLockPtr locks = (XTPermRowLockPtr) lock_list->bl_data; | 568 | XTPermRowLockPtr locks = (XTPermRowLockPtr) lock_list->bl_data; |
544 | 569 | for (int i=0; i<lock_list->bl_count; i++) { | 569 | for (unsigned i=0; i<lock_list->bl_count; i++) { |
545 | 570 | #ifdef XT_USE_TABLE_REF | 570 | #ifdef XT_USE_TABLE_REF |
546 | 571 | if (locks->pr_table == ot->ot_table) { | 571 | if (locks->pr_table == ot->ot_table) { |
547 | 572 | #else | 572 | #else |
548 | @@ -1732,7 +1732,7 @@ | |||
549 | 1732 | #endif | 1732 | #endif |
550 | 1733 | } | 1733 | } |
551 | 1734 | 1734 | ||
553 | 1735 | xtPublic void xt_atomicrwlock_free(struct XTThread *self, XTAtomicRWLockPtr arw) | 1735 | xtPublic void xt_atomicrwlock_free(struct XTThread *, XTAtomicRWLockPtr XT_UNUSED(arw)) |
554 | 1736 | { | 1736 | { |
555 | 1737 | #ifdef XT_THREAD_LOCK_INFO | 1737 | #ifdef XT_THREAD_LOCK_INFO |
556 | 1738 | xt_thread_lock_info_free(&arw->arw_lock_info); | 1738 | xt_thread_lock_info_free(&arw->arw_lock_info); |
557 | 1739 | 1739 | ||
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 | 630 | XTSpinLockRec lg_lock; /* A lock for the list. */ | 630 | XTSpinLockRec lg_lock; /* A lock for the list. */ |
563 | 631 | XTLockWaitPtr lg_wait_queue; /* A queue of threads waiting for a lock in this group. */ | 631 | XTLockWaitPtr lg_wait_queue; /* A queue of threads waiting for a lock in this group. */ |
564 | 632 | XTLockWaitPtr lg_wait_queue_end; /* The end of the thread queue. */ | 632 | XTLockWaitPtr lg_wait_queue_end; /* The end of the thread queue. */ |
567 | 633 | int lg_list_size; /* The size of the list. */ | 633 | size_t lg_list_size; /* The size of the list. */ |
568 | 634 | int lg_list_in_use; /* Number of slots on the list in use. */ | 634 | size_t lg_list_in_use; /* Number of slots on the list in use. */ |
569 | 635 | XTLockItemPtr lg_list; /* List of locks. */ | 635 | XTLockItemPtr lg_list; /* List of locks. */ |
570 | 636 | } XTLockGroupRec, *XTLockGroupPtr; | 636 | } XTLockGroupRec, *XTLockGroupPtr; |
571 | 637 | 637 | ||
572 | 638 | 638 | ||
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 | 27 | #include "xt_config.h" | 27 | #include "xt_config.h" |
578 | 28 | 28 | ||
579 | 29 | #ifdef DRIZZLED | 29 | #ifdef DRIZZLED |
580 | 30 | #define DRIZZLE_SERVER 1 | ||
581 | 31 | #include <drizzled/server_includes.h> | 30 | #include <drizzled/server_includes.h> |
582 | 32 | #include <drizzled/plugin.h> | 31 | #include <drizzled/plugin.h> |
583 | 33 | #include <drizzled/show.h> | 32 | #include <drizzled/show.h> |
584 | 33 | #include <drizzled/field/blob.h> | ||
585 | 34 | #include <drizzled/field/enum.h> | ||
586 | 35 | #include <drizzled/field/varstring.h> | ||
587 | 36 | #include <drizzled/current_session.h> | ||
588 | 37 | #include <drizzled/sql_lex.h> | ||
589 | 38 | #include <drizzled/session.h> | ||
590 | 39 | extern "C" struct charset_info_st *session_charset(Session *session); | ||
591 | 40 | extern pthread_key_t THR_Session; | ||
592 | 34 | #else | 41 | #else |
593 | 35 | #include "mysql_priv.h" | 42 | #include "mysql_priv.h" |
594 | 36 | #include <mysql/plugin.h> | 43 | #include <mysql/plugin.h> |
595 | @@ -623,7 +630,6 @@ | |||
596 | 623 | case DRIZZLE_TYPE_NULL: | 630 | case DRIZZLE_TYPE_NULL: |
597 | 624 | case DRIZZLE_TYPE_TIMESTAMP: | 631 | case DRIZZLE_TYPE_TIMESTAMP: |
598 | 625 | case DRIZZLE_TYPE_LONGLONG: | 632 | case DRIZZLE_TYPE_LONGLONG: |
599 | 626 | case DRIZZLE_TYPE_TIME: | ||
600 | 627 | case DRIZZLE_TYPE_DATETIME: | 633 | case DRIZZLE_TYPE_DATETIME: |
601 | 628 | case DRIZZLE_TYPE_DATE: | 634 | case DRIZZLE_TYPE_DATE: |
602 | 629 | case DRIZZLE_TYPE_NEWDECIMAL: | 635 | case DRIZZLE_TYPE_NEWDECIMAL: |
603 | @@ -743,7 +749,6 @@ | |||
604 | 743 | case DRIZZLE_TYPE_NULL: | 749 | case DRIZZLE_TYPE_NULL: |
605 | 744 | case DRIZZLE_TYPE_TIMESTAMP: | 750 | case DRIZZLE_TYPE_TIMESTAMP: |
606 | 745 | case DRIZZLE_TYPE_LONGLONG: | 751 | case DRIZZLE_TYPE_LONGLONG: |
607 | 746 | case DRIZZLE_TYPE_TIME: | ||
608 | 747 | case DRIZZLE_TYPE_DATETIME: | 752 | case DRIZZLE_TYPE_DATETIME: |
609 | 748 | case DRIZZLE_TYPE_DATE: | 753 | case DRIZZLE_TYPE_DATE: |
610 | 749 | case DRIZZLE_TYPE_NEWDECIMAL: | 754 | case DRIZZLE_TYPE_NEWDECIMAL: |
611 | @@ -1872,7 +1877,9 @@ | |||
612 | 1872 | 1877 | ||
613 | 1873 | static void my_close_table(TABLE *table) | 1878 | static void my_close_table(TABLE *table) |
614 | 1874 | { | 1879 | { |
616 | 1875 | closefrm(table, 1); // TODO: Q, why did Stewart remove this? | 1880 | #ifndef DRIZZLED |
617 | 1881 | closefrm(table, 1); // TODO: Q, why did Stewart remove this? | ||
618 | 1882 | #endif | ||
619 | 1876 | xt_free_ns(table); | 1883 | xt_free_ns(table); |
620 | 1877 | } | 1884 | } |
621 | 1878 | 1885 | ||
622 | @@ -2168,6 +2175,18 @@ | |||
623 | 2168 | seg->bit_start = ((Field_bit *) field)->bit_ofs; | 2175 | seg->bit_start = ((Field_bit *) field)->bit_ofs; |
624 | 2169 | seg->bit_pos = (uint) (((Field_bit *) field)->bit_ptr - (uchar*) table_arg->record[0]); | 2176 | seg->bit_pos = (uint) (((Field_bit *) field)->bit_ptr - (uchar*) table_arg->record[0]); |
625 | 2170 | } | 2177 | } |
626 | 2178 | #else | ||
627 | 2179 | /* Drizzle uses HA_KEYTYPE_ULONG_INT keys for enums > 1 byte, which is not consistent with MySQL, so we fix it here */ | ||
628 | 2180 | else if (field->type() == MYSQL_TYPE_ENUM) { | ||
629 | 2181 | switch (seg->length) { | ||
630 | 2182 | case 2: | ||
631 | 2183 | seg->type = HA_KEYTYPE_USHORT_INT; | ||
632 | 2184 | break; | ||
633 | 2185 | case 3: | ||
634 | 2186 | seg->type = HA_KEYTYPE_UINT24; | ||
635 | 2187 | break; | ||
636 | 2188 | } | ||
637 | 2189 | } | ||
638 | 2171 | #endif | 2190 | #endif |
639 | 2172 | 2191 | ||
640 | 2173 | switch (seg->type) { | 2192 | switch (seg->type) { |
641 | @@ -2524,7 +2543,7 @@ | |||
642 | 2524 | if (!dic_rec_fixed) { | 2543 | if (!dic_rec_fixed) { |
643 | 2525 | xtWord8 max_rec_size = offsetof(XTTabRecExt, re_data); | 2544 | xtWord8 max_rec_size = offsetof(XTTabRecExt, re_data); |
644 | 2526 | 2545 | ||
646 | 2527 | for (Field **field=my_tab->field; (curr_field = *field); field++) { | 2546 | for (Field **f=my_tab->field; (curr_field = *f); f++) { |
647 | 2528 | max_data_size = curr_field->key_length(); | 2547 | max_data_size = curr_field->key_length(); |
648 | 2529 | enum_field_types tno = curr_field->type(); | 2548 | enum_field_types tno = curr_field->type(); |
649 | 2530 | if (tno == MYSQL_TYPE_BLOB) | 2549 | if (tno == MYSQL_TYPE_BLOB) |
650 | @@ -3036,7 +3055,7 @@ | |||
651 | 3036 | table->field[column]->store(string, strlen(string), charset); | 3055 | table->field[column]->store(string, strlen(string), charset); |
652 | 3037 | } | 3056 | } |
653 | 3038 | 3057 | ||
655 | 3039 | xtPublic int myxt_statistics_fill_table(XTThreadPtr self, void *th, void *ta, void *co, MX_CONST void *ch) | 3058 | xtPublic int myxt_statistics_fill_table(XTThreadPtr self, void *th, void *ta, void *, MX_CONST void *ch) |
656 | 3040 | { | 3059 | { |
657 | 3041 | THD *thd = (THD *) th; | 3060 | THD *thd = (THD *) th; |
658 | 3042 | TABLE_LIST *tables = (TABLE_LIST *) ta; | 3061 | TABLE_LIST *tables = (TABLE_LIST *) ta; |
659 | 3043 | 3062 | ||
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 | 1772 | /* Read the checkpoint data: */ | 1772 | /* Read the checkpoint data: */ |
665 | 1773 | if (use_buffer) { | 1773 | if (use_buffer) { |
666 | 1774 | u_int no_of_logs; | 1774 | u_int no_of_logs; |
669 | 1775 | xtLogID log_id; | 1775 | xtLogID xt_log_id; |
670 | 1776 | xtTableID tab_id; | 1776 | xtTableID xt_tab_id; |
671 | 1777 | 1777 | ||
672 | 1778 | xres_cp_number = XT_GET_DISK_6(use_buffer->xcp_chkpnt_no_6); | 1778 | xres_cp_number = XT_GET_DISK_6(use_buffer->xcp_chkpnt_no_6); |
673 | 1779 | xres_cp_log_id = XT_GET_DISK_4(use_buffer->xcp_log_id_4); | 1779 | xres_cp_log_id = XT_GET_DISK_4(use_buffer->xcp_log_id_4); |
674 | 1780 | xres_cp_log_offset = XT_GET_DISK_6(use_buffer->xcp_log_offs_6); | 1780 | xres_cp_log_offset = XT_GET_DISK_6(use_buffer->xcp_log_offs_6); |
678 | 1781 | tab_id = XT_GET_DISK_4(use_buffer->xcp_tab_id_4); | 1781 | xt_tab_id = XT_GET_DISK_4(use_buffer->xcp_tab_id_4); |
679 | 1782 | if (tab_id > db->db_curr_tab_id) | 1782 | if (xt_tab_id > db->db_curr_tab_id) |
680 | 1783 | db->db_curr_tab_id = tab_id; | 1783 | db->db_curr_tab_id = xt_tab_id; |
681 | 1784 | db->db_xn_curr_id = XT_GET_DISK_4(use_buffer->xcp_xact_id_4); | 1784 | db->db_xn_curr_id = XT_GET_DISK_4(use_buffer->xcp_xact_id_4); |
682 | 1785 | ind_rec_log_id = XT_GET_DISK_4(use_buffer->xcp_ind_rec_log_id_4); | 1785 | ind_rec_log_id = XT_GET_DISK_4(use_buffer->xcp_ind_rec_log_id_4); |
683 | 1786 | ind_rec_log_offset = XT_GET_DISK_6(use_buffer->xcp_ind_rec_log_offs_6); | 1786 | ind_rec_log_offset = XT_GET_DISK_6(use_buffer->xcp_ind_rec_log_offs_6); |
684 | @@ -1808,16 +1808,16 @@ | |||
685 | 1808 | * will be removed. | 1808 | * will be removed. |
686 | 1809 | */ | 1809 | */ |
687 | 1810 | for (u_int i=0; i<no_of_logs; i++) { | 1810 | for (u_int i=0; i<no_of_logs; i++) { |
689 | 1811 | log_id = (xtLogID) XT_GET_DISK_2(use_buffer->xcp_del_log[i]); | 1811 | xt_log_id = (xtLogID) XT_GET_DISK_2(use_buffer->xcp_del_log[i]); |
690 | 1812 | #ifdef DEBUG_PRINT | 1812 | #ifdef DEBUG_PRINT |
691 | 1813 | if (i != 0) | 1813 | if (i != 0) |
692 | 1814 | printf(", "); | 1814 | printf(", "); |
694 | 1815 | printf("%d", (int) log_id); | 1815 | printf("%d", (int) xt_log_id); |
695 | 1816 | #endif | 1816 | #endif |
696 | 1817 | #ifdef DEBUG_KEEP_LOGS | 1817 | #ifdef DEBUG_KEEP_LOGS |
698 | 1818 | xt_dl_set_to_delete(self, db, log_id); | 1818 | xt_dl_set_to_delete(self, db, xt_log_id); |
699 | 1819 | #else | 1819 | #else |
701 | 1820 | if (!xres_delete_data_log(db, log_id)) | 1820 | if (!xres_delete_data_log(db, xt_log_id)) |
702 | 1821 | xt_throw(self); | 1821 | xt_throw(self); |
703 | 1822 | #endif | 1822 | #endif |
704 | 1823 | } | 1823 | } |
705 | 1824 | 1824 | ||
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 | 30 | 30 | ||
711 | 31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
712 | 32 | #include <time.h> | 32 | #include <time.h> |
713 | 33 | #ifdef DRIZZLED | ||
714 | 34 | #include <drizzled/server_includes.h> | ||
715 | 35 | #include <drizzled/current_session.h> | ||
716 | 36 | #endif | ||
717 | 33 | 37 | ||
718 | 34 | #include "ha_pbxt.h" | 38 | #include "ha_pbxt.h" |
719 | 35 | #include "systab_xt.h" | 39 | #include "systab_xt.h" |
720 | @@ -593,7 +597,8 @@ | |||
721 | 593 | current_thd, "pbxt", | 597 | current_thd, "pbxt", |
722 | 594 | strchr(xt_internal_tables[i].sts_path, '.') + 1, | 598 | strchr(xt_internal_tables[i].sts_path, '.') + 1, |
723 | 595 | xt_internal_tables[i].sts_info, | 599 | xt_internal_tables[i].sts_info, |
725 | 596 | xt_internal_tables[i].sts_keys)) | 600 | xt_internal_tables[i].sts_keys, |
726 | 601 | TRUE /*do not recreate*/)) | ||
727 | 597 | xt_internal_tables[i].sts_exists = TRUE; | 602 | xt_internal_tables[i].sts_exists = TRUE; |
728 | 598 | i++; | 603 | i++; |
729 | 599 | } | 604 | } |
730 | 600 | 605 | ||
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 | 32 | #include <time.h> | 32 | #include <time.h> |
736 | 33 | 33 | ||
737 | 34 | #ifdef DRIZZLED | 34 | #ifdef DRIZZLED |
739 | 35 | #include <drizzled/common_includes.h> | 35 | #include <drizzled/common.h> |
740 | 36 | #include <mysys/thr_lock.h> | ||
741 | 37 | #include <drizzled/dtcollation.h> | ||
742 | 38 | #include <drizzled/handlerton.h> | ||
743 | 36 | #else | 39 | #else |
744 | 37 | #include "mysql_priv.h" | 40 | #include "mysql_priv.h" |
745 | 38 | #endif | 41 | #endif |
746 | 39 | 42 | ||
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 | 462 | tn_thd_id = wait_xact_ptr->xd_thread_id; | 462 | tn_thd_id = wait_xact_ptr->xd_thread_id; |
752 | 463 | } | 463 | } |
753 | 464 | else { | 464 | else { |
754 | 465 | tn_thd_id = 0; | ||
755 | 465 | if (!xn_get_xact_details(db, xw->xw_xn_id, thread, &flags, &start, NULL, &tn_thd_id)) | 466 | if (!xn_get_xact_details(db, xw->xw_xn_id, thread, &flags, &start, NULL, &tn_thd_id)) |
756 | 466 | flags = XT_XN_XAC_ENDED | XT_XN_XAC_SWEEP; | 467 | flags = XT_XN_XAC_ENDED | XT_XN_XAC_SWEEP; |
757 | 467 | } | 468 | } |
758 | 468 | 469 | ||
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 | 33 | 33 | ||
764 | 34 | #ifdef DRIZZLED | 34 | #ifdef DRIZZLED |
765 | 35 | #include "drizzled/global.h" | 35 | #include "drizzled/global.h" |
766 | 36 | const int max_connections = 500; | ||
767 | 36 | #else | 37 | #else |
768 | 37 | #include <mysql_version.h> | 38 | #include <mysql_version.h> |
769 | 38 | #include "my_global.h" | 39 | #include "my_global.h" |
770 | 39 | 40 | ||
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 | 739 | 739 | ||
776 | 740 | #define mysql_real_data_home drizzle_real_data_home | 740 | #define mysql_real_data_home drizzle_real_data_home |
777 | 741 | 741 | ||
778 | 742 | #define mi_int4store(T,A) { uint32_t def_temp= (uint32_t) (A);\ | ||
779 | 743 | ((unsigned char*) (T))[3]= (unsigned char) (def_temp);\ | ||
780 | 744 | ((unsigned char*) (T))[2]= (unsigned char) (def_temp >> 8);\ | ||
781 | 745 | ((unsigned char*) (T))[1]= (unsigned char) (def_temp >> 16);\ | ||
782 | 746 | ((unsigned char*) (T))[0]= (unsigned char) (def_temp >> 24); } | ||
783 | 747 | |||
784 | 748 | #define mi_uint4korr(A) ((uint32_t) (((uint32_t) (((const unsigned char*) (A))[3])) +\ | ||
785 | 749 | (((uint32_t) (((const unsigned char*) (A))[2])) << 8) +\ | ||
786 | 750 | (((uint32_t) (((const unsigned char*) (A))[1])) << 16) +\ | ||
787 | 751 | (((uint32_t) (((const unsigned char*) (A))[0])) << 24))) | ||
788 | 752 | |||
789 | 742 | #else // DRIZZLED | 753 | #else // DRIZZLED |
790 | 743 | /* The MySQL case: */ | 754 | /* The MySQL case: */ |
791 | 744 | #if MYSQL_VERSION_ID >= 60008 | 755 | #if MYSQL_VERSION_ID >= 60008 |
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...