Merge lp:~paul-mccullagh/drizzle/re-merge-1.1 into lp:~drizzle-trunk/drizzle/development

Proposed by Paul McCullagh
Status: Merged
Merged at revision: not available
Proposed branch: lp:~paul-mccullagh/drizzle/re-merge-1.1
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 1328 lines (+172/-466)
22 files modified
plugin/pbxt/src/cache_xt.cc (+3/-2)
plugin/pbxt/src/database_xt.cc (+2/-2)
plugin/pbxt/src/datadic_xt.cc (+2/-2)
plugin/pbxt/src/datalog_xt.cc (+8/-3)
plugin/pbxt/src/discover_xt.cc (+4/-333)
plugin/pbxt/src/filesys_xt.cc (+2/-1)
plugin/pbxt/src/ha_pbxt.cc (+1/-10)
plugin/pbxt/src/ha_pbxt.h (+0/-1)
plugin/pbxt/src/ha_xtsys.cc (+6/-4)
plugin/pbxt/src/index_xt.h (+2/-0)
plugin/pbxt/src/myxt_xt.cc (+33/-13)
plugin/pbxt/src/pbms_enabled.cc (+1/-2)
plugin/pbxt/src/restart_xt.cc (+8/-1)
plugin/pbxt/src/systab_xt.cc (+1/-9)
plugin/pbxt/src/tabcache_xt.cc (+1/-1)
plugin/pbxt/src/table_xt.cc (+66/-61)
plugin/pbxt/src/table_xt.h (+1/-1)
plugin/pbxt/src/thread_xt.cc (+1/-1)
plugin/pbxt/src/thread_xt.h (+2/-2)
plugin/pbxt/src/xaction_xt.cc (+20/-13)
plugin/pbxt/src/xactlog_xt.cc (+6/-2)
plugin/pbxt/src/xt_defs.h (+2/-2)
To merge this branch: bzr merge lp:~paul-mccullagh/drizzle/re-merge-1.1
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+24591@code.launchpad.net

Description of the change

This patch fixes bug #572029: Can't load pbxt plugin

It also cleans up some changes to PBXT, and merges bug fixes from the 1.1 trunk.

Param build passes, on average 85% of the tests pass when run with PBXT as the default engine.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugin/pbxt/src/cache_xt.cc'
2--- plugin/pbxt/src/cache_xt.cc 2010-04-20 23:05:58 +0000
3+++ plugin/pbxt/src/cache_xt.cc 2010-05-03 14:18:27 +0000
4@@ -377,7 +377,7 @@
5 DcSegmentPtr seg = NULL;
6 XTIndBlockPtr xblock;
7
8- (void)thread;
9+ (void) thread; /*DRIZZLED*/
10
11 /* The lock order is:
12 * 1. Cache segment (cs_lock) - This is only by ind_free_block()!
13@@ -835,7 +835,8 @@
14 u_int file_id;
15 xtIndexNodeID address;
16 DcSegmentPtr seg;
17- (void)ot;
18+
19+ (void) ot; /*DRIZZLED*/
20
21 #ifdef DEBUG_CHECK_IND_CACHE
22 xt_ind_check_cache(NULL);
23
24=== modified file 'plugin/pbxt/src/database_xt.cc'
25--- plugin/pbxt/src/database_xt.cc 2010-04-08 16:11:29 +0000
26+++ plugin/pbxt/src/database_xt.cc 2010-05-03 14:18:27 +0000
27@@ -1545,7 +1545,7 @@
28 {
29 DBThreadDataPtr td = (DBThreadDataPtr) self->t_data;
30 XTDatabaseHPtr db = td->td_db;
31- volatile int i = 0;
32+ volatile int i = 0;
33
34 /* Note, the MySQL thread will be free when the this
35 * thread quits.
36@@ -1916,7 +1916,7 @@
37 virtual void tk_release();
38 };
39
40-xtBool XTTestTask::tk_task(XTThreadPtr)
41+xtBool XTTestTask::tk_task(XTThreadPtr XT_UNUSED(thread))
42 {
43 sleep(tt_sleep_time);
44 return OK;
45
46=== modified file 'plugin/pbxt/src/datadic_xt.cc'
47--- plugin/pbxt/src/datadic_xt.cc 2010-04-08 16:11:29 +0000
48+++ plugin/pbxt/src/datadic_xt.cc 2010-05-03 14:18:27 +0000
49@@ -396,7 +396,7 @@
50 struct charset_info_st;
51
52 class XTTokenizer {
53- MX_CHARSET_INFO *tkn_charset;
54+ MX_CHARSET_INFO *tkn_charset;
55 char *tkn_cstring;
56 char *tkn_curr_pos;
57 XTToken *tkn_current;
58@@ -1324,7 +1324,7 @@
59 class XTCreateTable : public XTParseTable {
60 public:
61 bool ct_convert;
62- MX_CHARSET_INFO *ct_charset;
63+ MX_CHARSET_INFO *ct_charset;
64 XTPathStrPtr ct_tab_path;
65 u_int ct_contraint_no;
66 XTDDTable *ct_curr_table;
67
68=== modified file 'plugin/pbxt/src/datalog_xt.cc'
69--- plugin/pbxt/src/datalog_xt.cc 2010-04-14 16:29:40 +0000
70+++ plugin/pbxt/src/datalog_xt.cc 2010-05-03 14:18:27 +0000
71@@ -1149,6 +1149,11 @@
72 xtBool XTDataLogBuffer::dlb_close_log(XTThreadPtr thread)
73 {
74 if (dlb_data_log) {
75+ if (dlb_data_log->dlf_log_file) {
76+ if (!dl_write_log_header(dlb_data_log, dlb_data_log->dlf_log_file, 0, thread))
77+ return FAILED;
78+ }
79+
80 /* Flush and commit the data in the old log: */
81 if (!dlb_flush_log(TRUE, thread))
82 return FAILED;
83@@ -1204,7 +1209,7 @@
84 if (!xt_pwrite_file(dlb_data_log->dlf_log_file, dlb_buffer_offset, dlb_buffer_len, dlb_log_buffer, &thread->st_statistics.st_data, thread))
85 return FAILED;
86 #ifdef DEBUG
87- if (dlb_buffer_offset + dlb_buffer_len > dlb_max_write_offset)
88+ if (dlb_buffer_offset + (xtLogOffset) dlb_buffer_len > dlb_max_write_offset)
89 dlb_max_write_offset = dlb_buffer_offset + (xtLogOffset) dlb_buffer_len;
90 #endif
91 dlb_buffer_len = 0;
92@@ -1745,8 +1750,8 @@
93 xtLogOffset src_log_offset;
94 xtLogID curr_log_id;
95 xtLogOffset curr_log_offset;
96- xtLogID dest_log_id;
97- xtLogOffset dest_log_offset;
98+ xtLogID dest_log_id = 0;
99+ xtLogOffset dest_log_offset = 0;
100 off_t garbage_count = 0;
101
102 memset(&cs, 0, sizeof(XTCompactorStateRec));
103
104=== modified file 'plugin/pbxt/src/discover_xt.cc'
105--- plugin/pbxt/src/discover_xt.cc 2010-04-11 17:04:06 +0000
106+++ plugin/pbxt/src/discover_xt.cc 2010-05-03 14:18:27 +0000
107@@ -23,313 +23,26 @@
108
109 #include "xt_config.h"
110
111-#ifdef PBXT_SYS_TAB
112-
113 #ifndef DRIZZLED
114+
115 #include "mysql_priv.h"
116 #include "item_create.h"
117 #include <m_ctype.h>
118-#else
119-#include <drizzled/session.h>
120-#include <drizzled/sql_base.h>
121-#include <drizzled/statement/alter_table.h>
122-#include <drizzled/sql_table.h>
123-#include <algorithm>
124-#include <sstream>
125-namespace drizzled {
126-extern pid_t current_pid;
127-namespace internal {
128-size_t unpack_filename(char * to, const char *from);
129-}
130-}
131-using namespace drizzled;
132-using namespace drizzled::internal;
133-#endif
134
135 #include "strutil_xt.h"
136 #include "ha_pbxt.h"
137 #include "discover_xt.h"
138 #include "ha_xtsys.h"
139
140-#ifndef DRIZZLED
141 #if MYSQL_VERSION_ID >= 50404
142 #define DOT_STR(x) x.str
143 #else
144 #define DOT_STR(x) x
145 #endif
146-#endif
147
148-//#ifndef DRIZZLED
149 #define LOCK_OPEN_HACK_REQUIRED
150-//#endif // DRIZZLED
151
152 #ifdef LOCK_OPEN_HACK_REQUIRED
153-#ifdef DRIZZLED
154-
155-using namespace drizzled;
156-using namespace std;
157-
158-#define mysql_create_table_no_lock hacked_mysql_create_table_no_lock
159-
160-namespace drizzled {
161-
162-int rea_create_table(Session *session,
163- TableIdentifier &identifier,
164- message::Table &table_proto,
165- HA_CREATE_INFO *create_info,
166- List<CreateField> &create_field,
167- uint32_t key_count,KEY *key_info);
168-
169-int mysql_prepare_create_table(Session *session,
170- HA_CREATE_INFO *create_info,
171- message::Table &create_proto,
172- AlterInfo *alter_info,
173- bool tmp_table,
174- uint32_t *db_options,
175- KEY **key_info_buffer,
176- uint32_t *key_count,
177- int select_field_count);
178-
179-}
180-
181-static uint32_t build_tmptable_filename(Session* session,
182- char *buff, size_t bufflen)
183-{
184- uint32_t length;
185- ostringstream path_str, post_tmpdir_str;
186- string tmp;
187-
188- path_str << drizzle_tmpdir;
189- post_tmpdir_str << "/" << TMP_FILE_PREFIX << current_pid;
190- post_tmpdir_str << session->thread_id << session->tmp_table++;
191- tmp= post_tmpdir_str.str();
192-
193- transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
194-
195- path_str << tmp;
196-
197- if (bufflen < path_str.str().length())
198- length= 0;
199- else
200- length= unpack_filename(buff, path_str.str().c_str());
201-
202- return length;
203-}
204-
205-static bool mysql_create_table_no_lock(Session *session,
206- const char *db, const char *table_name,
207- HA_CREATE_INFO *create_info,
208- message::Table *table_proto,
209- AlterInfo *alter_info,
210- bool internal_tmp_table,
211- uint32_t select_field_count,
212- bool skip_existing)
213-{
214- char path[FN_REFLEN];
215- uint32_t path_length;
216- uint db_options, key_count;
217- KEY *key_info_buffer;
218- Cursor *file;
219- bool error= true;
220- /* Check for duplicate fields and check type of table to create */
221- if (!alter_info->create_list.elements)
222- {
223- my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
224- MYF(0));
225- return true;
226- }
227- assert(strcmp(table_name,table_proto->name().c_str())==0);
228- //if (check_engine(session, table_name, table_proto, create_info))
229- // return true;
230- db_options= create_info->table_options;
231- if (create_info->row_type == ROW_TYPE_DYNAMIC)
232- db_options|=HA_OPTION_PACK_RECORD;
233-
234- /*if (!(file= create_info->db_type->getCursor((TableShare*) 0, session->mem_root)))
235- {
236- my_error(ER_OUTOFMEMORY, MYF(0), sizeof(Cursor));
237- return true;
238- }*/
239-
240- TableIdentifier ident(db, table_name, table_proto->type());
241-
242- /* PMC - Done to avoid getting the partition handler by mistake! */
243- if (!(file= new (session->mem_root) ha_xtsys(pbxt_hton, *TableShare::getShare(ident))))
244- {
245- my_error(ER_OUTOFMEMORY, MYF(0), sizeof(Cursor));
246- return true;
247- }
248-
249- set_table_default_charset(create_info, (char*) db);
250-
251- if (mysql_prepare_create_table(session,
252- create_info,
253- *table_proto,
254- alter_info,
255- internal_tmp_table,
256- &db_options,
257- &key_info_buffer, &key_count,
258- select_field_count))
259- goto err;
260-
261- /* Check if table exists */
262- if (table_proto->type() == message::Table::TEMPORARY)
263- {
264- path_length= build_tmptable_filename(session, path, sizeof(path));
265- }
266- else
267- {
268- #ifdef FN_DEVCHAR
269- /* check if the table name contains FN_DEVCHAR when defined */
270- if (strchr(table_name, FN_DEVCHAR))
271- {
272- my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name);
273- return true;
274- }
275-#endif
276- std::string path_str;
277- path_length= build_table_filename(path_str, db, table_name, internal_tmp_table);
278- }
279-
280- /* Check if table already exists */
281- if ((table_proto->type() == message::Table::TEMPORARY) &&
282- session->find_temporary_table(db, table_name))
283- {
284- if (skip_existing)
285- {
286- create_info->table_existed= 1; // Mark that table existed
287- push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
288- ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
289- table_name);
290- error= 0;
291- goto err;
292- }
293- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
294- goto err;
295- }
296-
297- //pthread_mutex_lock(&LOCK_open); /* CREATE TABLE (some confussion on naming, double check) */
298- if (!internal_tmp_table && table_proto->type() != message::Table::TEMPORARY)
299- {
300- if (plugin::StorageEngine::getTableDefinition(*session,
301- ident,
302- *table_proto,
303- false) == EEXIST)
304- {
305- if (skip_existing)
306- {
307- error= false;
308- push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
309- ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
310- table_name);
311- create_info->table_existed= 1; // Mark that table existed
312- }
313- else
314- my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
315-
316- goto unlock_and_end;
317- }
318- /*
319- * We don't assert here, but check the result, because the table could be
320- * in the table definition cache and in the same time the .frm could be
321- * missing from the disk, in case of manual intervention which deletes
322- * the .frm file. The user has to use FLUSH TABLES; to clear the cache.
323- * Then she could create the table. This case is pretty obscure and
324- * therefore we don't introduce a new error message only for it.
325- * */
326- if (TableShare::getShare(ident))
327- {
328- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
329- goto unlock_and_end;
330- }
331- }
332- /*
333- * Check that table with given name does not already
334- * exist in any storage engine. In such a case it should
335- * be discovered and the error ER_TABLE_EXISTS_ERROR be returned
336- * unless user specified CREATE TABLE IF EXISTS
337- * The LOCK_open mutex has been locked to make sure no
338- * one else is attempting to discover the table. Since
339- * it's not on disk as a frm file, no one could be using it!
340- * */
341- if (table_proto->type() != message::Table::TEMPORARY)
342- {
343- bool create_if_not_exists = skip_existing;
344-
345- std::string path_str;
346- uint32_t table_path_length;
347-
348- table_path_length= build_table_filename(path_str, db, table_name, false);
349-
350- int retcode= plugin::StorageEngine::getTableDefinition(*session,
351- ident,
352- *table_proto,
353- false);
354- switch (retcode)
355- {
356- case ENOENT:
357- /* Normal case, no table exists. we can go and create it */
358- break;
359- case EEXIST:
360- if (create_if_not_exists)
361- {
362- error= false;
363- push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_NOTE,
364- ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
365- table_name);
366- create_info->table_existed= 1; // Mark that table existed
367- goto unlock_and_end;
368- }
369- my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
370- goto unlock_and_end;
371- default:
372- my_error(retcode, MYF(0),table_name);
373- goto unlock_and_end;
374- }
375- }
376-
377- session->set_proc_info("creating table");
378- create_info->table_existed= 0; // Mark that table is created
379-
380- create_info->table_options=db_options;
381-
382- if (rea_create_table(session, ident,
383- *table_proto,
384- create_info, alter_info->create_list,
385- key_count, key_info_buffer))
386- goto unlock_and_end;
387-
388- if (table_proto->type() == message::Table::TEMPORARY)
389- {
390- /* Open table and put in temporary table list */
391- if (!(session->open_temporary_table(ident)))
392- {
393- (void) session->rm_temporary_table(ident);
394- goto unlock_and_end;
395- }
396- }
397-
398- /*
399- * Don't write statement if:
400- * - It is an internal temporary table,
401- * - Row-based logging is used and it we are creating a temporary table, or
402- * - The binary log is not open.
403- * Otherwise, the statement shall be binlogged.
404- * */
405- if (!internal_tmp_table &&
406- ((table_proto->type() != message::Table::TEMPORARY)))
407- write_bin_log(session, session->getQueryString().c_str());
408- error= false;
409-unlock_and_end:
410- //pthread_mutex_unlock(&LOCK_open);
411-
412-err:
413- session->set_proc_info("After create");
414- delete file;
415- return(error);
416-}
417-
418-#else // MySQL case
419 ///////////////////////////////
420 /*
421 * Unfortunately I cannot use the standard mysql_create_table_no_lock() because it will lock "LOCK_open"
422@@ -1568,51 +1281,27 @@
423 ////// END OF CUT AND PASTES FROM sql_table.cc ////////
424 ////////////////////////////////////////////////////////
425
426-#endif // DRIZZLED
427 #endif // LOCK_OPEN_HACK_REQUIRED
428
429 //------------------------------
430 int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *XT_UNUSED(keys), xtBool skip_existing)
431 {
432-#ifdef DRIZZLED
433-#define MYLEX_CREATE_INFO create_info
434-#else
435-#define MYLEX_CREATE_INFO mylex.create_info
436-#endif
437-
438-#ifdef DRIZZLED
439- drizzled::statement::AlterTable *stmt = new drizzled::statement::AlterTable(thd);
440- HA_CREATE_INFO create_info;
441- //AlterInfo alter_info;
442- drizzled::message::Table table_proto;
443-
444- static const char *ext = ".dfe";
445- static const int ext_len = 4;
446-
447- table_proto.mutable_engine()->mutable_name()->assign("PBXT");
448-#else
449 static const char *ext = ".frm";
450 static const int ext_len = 4;
451-#endif
452 int err = 1;
453 char field_length_buffer[12], *field_length_ptr;
454 LEX *save_lex= thd->lex, mylex;
455
456- memset(&MYLEX_CREATE_INFO, 0, sizeof(HA_CREATE_INFO));
457+ memset(&mylex.create_info, 0, sizeof(HA_CREATE_INFO));
458
459 thd->lex = &mylex;
460 lex_start(thd);
461-#ifdef DRIZZLED
462- mylex.statement = stmt;
463-#endif
464
465 /* setup the create info */
466- MYLEX_CREATE_INFO.db_type = hton;
467+ mylex.create_info.db_type = hton;
468
469-#ifndef DRIZZLED
470 mylex.create_info.frm_only = 1;
471-#endif
472- MYLEX_CREATE_INFO.default_table_charset = system_charset_info;
473+ mylex.create_info.default_table_charset = system_charset_info;
474
475 /* setup the column info. */
476 while (info->field_name) {
477@@ -1629,13 +1318,6 @@
478 } else
479 field_length_ptr = NULL;
480
481-#ifdef DRIZZLED
482- if (add_field_to_list(thd, &field_name, info->field_type, field_length_ptr, info->field_decimal_length,
483- info->field_flags,
484- COLUMN_FORMAT_TYPE_FIXED,
485- NULL /*default_value*/, NULL /*on_update_value*/, &comment, NULL /*change*/,
486- NULL /*interval_list*/, info->field_charset))
487-#else
488 if (add_field_to_list(thd, &field_name, info->field_type, field_length_ptr, info->field_decimal_length,
489 info->field_flags,
490 #if MYSQL_VERSION_ID >= 50404
491@@ -1644,7 +1326,6 @@
492 #endif
493 NULL /*default_value*/, NULL /*on_update_value*/, &comment, NULL /*change*/,
494 NULL /*interval_list*/, info->field_charset, 0 /*uint_geom_type*/))
495-#endif
496 goto error;
497
498
499@@ -1668,18 +1349,8 @@
500 }
501
502 /* Create an internal temp table */
503-#ifdef DRIZZLED
504- table_proto.set_name(name);
505- table_proto.set_type(drizzled::message::Table::STANDARD);
506- table_proto.set_schema(db);
507- table_proto.set_creation_timestamp(time(NULL));
508- table_proto.set_update_timestamp(time(NULL));
509- if (mysql_create_table_no_lock(thd, db, name, &create_info, &table_proto, &stmt->alter_info, 1, 0, skip_existing))
510- goto error;
511-#else
512 if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0))
513 goto error;
514-#endif
515
516 noerror:
517 err = 0;
518
519=== modified file 'plugin/pbxt/src/filesys_xt.cc'
520--- plugin/pbxt/src/filesys_xt.cc 2010-04-26 11:13:26 +0000
521+++ plugin/pbxt/src/filesys_xt.cc 2010-05-03 14:18:27 +0000
522@@ -1281,7 +1281,7 @@
523 return OK;
524 }
525
526-static xtBool fs_rewrite_file(XTOpenFilePtr of, off_t offset, size_t size, void *data, XTIOStatsPtr stat, XTThreadPtr)
527+static xtBool fs_rewrite_file(XTOpenFilePtr of, off_t offset, size_t size, void *data, XTIOStatsPtr stat, XTThreadPtr XT_UNUSED(thread))
528 {
529 #ifdef XT_TIME_DISK_WRITES
530 xtWord8 s;
531@@ -1977,6 +1977,7 @@
532 }
533 case XT_FT_HEAP: {
534 XTFileHeapPtr fh = of->x.of_heap;
535+
536 thd_id = thread->t_id;
537
538 #ifdef XT_TIME_DISK_READS
539
540=== modified file 'plugin/pbxt/src/ha_pbxt.cc'
541--- plugin/pbxt/src/ha_pbxt.cc 2010-04-20 19:05:03 +0000
542+++ plugin/pbxt/src/ha_pbxt.cc 2010-05-03 14:18:27 +0000
543@@ -494,6 +494,7 @@
544 self->st_abort_trans = FALSE;
545 self->st_stat_ended = FALSE;
546 self->st_stat_trans = FALSE;
547+ self->st_non_temp_updated = FALSE;
548 XT_PRINT0(self, "xt_xn_begin\n");
549 xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT);
550 }
551@@ -4628,12 +4629,6 @@
552 self->st_statistics.st_stat_read++;
553 self->st_stat_modify = FALSE;
554 self->st_import_stat = XT_IMP_NO_IMPORT;
555-
556- /* Only reset this if there is no transactions running, and
557- * no tables are open!
558- */
559- if (!self->st_xact_data)
560- self->st_non_temp_opened = FALSE;
561 }
562
563 if (pb_table_locked) {
564@@ -4846,10 +4841,6 @@
565 #endif
566 }
567
568- /* Any open table can cause this to be FALSE: */
569- if (!XT_IS_TEMP_TABLE(pb_open_tab->ot_table->tab_dic.dic_tab_flags))
570- self->st_non_temp_opened = TRUE;
571-
572 /* Start a statment transaction: */
573 /* {START-STAT-HACK} The problem that ha_commit_trans() is not
574 * called by MySQL seems to be fixed (tests confirm this).
575
576=== modified file 'plugin/pbxt/src/ha_pbxt.h'
577--- plugin/pbxt/src/ha_pbxt.h 2010-04-21 02:28:11 +0000
578+++ plugin/pbxt/src/ha_pbxt.h 2010-05-03 14:18:27 +0000
579@@ -353,7 +353,6 @@
580 #define thd_query(t) &(t)->query
581 #define thd_slave_thread(t) (t)->slave_thread
582 #define thd_binlog_format(t) (t)->variables.binlog_format
583-#define thd_mark_transaction_to_rollback(t) mark_transaction_to_rollback(t, all)
584 #endif // INNODB_COMPATIBILITY_HOOKS */
585 #endif /* !DRIZZLED */
586
587
588=== modified file 'plugin/pbxt/src/ha_xtsys.cc'
589--- plugin/pbxt/src/ha_xtsys.cc 2010-04-08 16:11:29 +0000
590+++ plugin/pbxt/src/ha_xtsys.cc 2010-05-03 14:18:27 +0000
591@@ -58,18 +58,20 @@
592 * HANDLER INTERFACE
593 */
594
595+#ifdef DRIZZLED
596 ha_xtsys::ha_xtsys(handlerton *hton, TableShare& table_arg):
597-#ifdef DRIZZLED
598 handler(*hton, table_arg),
599+ha_open_tab(NULL)
600+{
601+}
602 #else
603+ha_xtsys::ha_xtsys(handlerton *hton, TABLE_SHARE *table_arg):
604 handler(hton, table_arg),
605-#endif
606 ha_open_tab(NULL)
607 {
608-#ifndef DRIZZLED
609 init();
610+}
611 #endif
612-}
613
614 static const char *ha_pbms_exts[] = {
615 "",
616
617=== modified file 'plugin/pbxt/src/index_xt.h'
618--- plugin/pbxt/src/index_xt.h 2010-04-26 11:13:26 +0000
619+++ plugin/pbxt/src/index_xt.h 2010-05-03 14:18:27 +0000
620@@ -106,6 +106,8 @@
621 struct XTIndex;
622 struct XTIndBlock;
623 struct XTTable;
624+struct XTThread;
625+class Field;
626
627 /*
628 * INDEX ROLLBACK
629
630=== modified file 'plugin/pbxt/src/myxt_xt.cc'
631--- plugin/pbxt/src/myxt_xt.cc 2010-04-16 05:36:53 +0000
632+++ plugin/pbxt/src/myxt_xt.cc 2010-05-03 14:18:27 +0000
633@@ -312,6 +312,11 @@
634 memset((byte*) key, 0,(size_t) (ind->mi_key_size) );
635 #endif
636
637+#ifdef HAVE_valgrind
638+ if (ind->mi_fix_key)
639+ memset((byte*) key, 0,(size_t) (ind->mi_key_size) );
640+#endif
641+
642 start = key;
643 for (u_int i=0; i<ind->mi_seg_count; i++, keyseg++)
644 {
645@@ -2005,12 +2010,8 @@
646 {
647 THD *thd = current_thd;
648 char path_buffer[PATH_MAX];
649- char *table_file_name;
650-#ifdef DRIZZLED
651- char tab_name[XT_IDENTIFIER_NAME_SIZE];
652-#endif
653+ char *table_name;
654 char database_name[XT_IDENTIFIER_NAME_SIZE];
655- char *ptr;
656 size_t size;
657 char *buffer, *path, *db_name, *name;
658 TABLE_SHARE *share;
659@@ -2032,16 +2033,19 @@
660 * have .frm files!!
661 */
662 xt_strcpy(PATH_MAX, path_buffer, tab_path->ps_path);
663- table_file_name = xt_last_name_of_path(path_buffer);
664+ table_name = xt_last_name_of_path(path_buffer);
665+#ifndef DRIZZLED
666+ char *ptr;
667
668- if ((ptr = strstr(tab_name, "#P#")))
669+ if ((ptr = strstr(table_name, "#P#")))
670 *ptr = 0;
671+#endif
672
673 xt_2nd_last_name_of_path(XT_IDENTIFIER_NAME_SIZE, database_name, path_buffer);
674
675 size = sizeof(TABLE) + sizeof(TABLE_SHARE) +
676 strlen(path_buffer) + 1 +
677- strlen(database_name) + 1 + strlen(table_file_name) + 1;
678+ strlen(database_name) + 1 + strlen(table_name) + 1;
679 if (!(buffer = (char *) xt_malloc(self, size)))
680 return NULL;
681 table = (TABLE *) buffer;
682@@ -2056,7 +2060,7 @@
683 strcpy(db_name, database_name);
684 buffer += strlen(database_name) + 1;
685 name = buffer;
686- strcpy(name, table_file_name);
687+ strcpy(name, table_name);
688
689 /* Required to call 'open_table_from_share'! */
690 LEX *old_lex, new_lex;
691@@ -2067,13 +2071,15 @@
692 lex_start(thd);
693
694 #ifdef DRIZZLED
695+ char tab_name[XT_IDENTIFIER_NAME_SIZE];
696+
697 uint32_t tab_name_len = filename_to_tablename(name, tab_name, XT_IDENTIFIER_NAME_SIZE);
698
699 TableIdentifier *ident = NULL;
700 if (table_type == XT_TABLE_TYPE_TEMPORARY) {
701 std::string tmp_path(drizzle_tmpdir);
702 tmp_path.append("/");
703- tmp_path.append(table_file_name);
704+ tmp_path.append(table_name);
705 ident = new TableIdentifier(db_name, tab_name, tmp_path);
706 } else if (table_type == XT_TABLE_TYPE_STANDARD) {
707 ident = new TableIdentifier(
708@@ -2086,7 +2092,7 @@
709 n.append("/");
710 n.append(db_name);
711 n.append("/");
712- n.append(table_file_name);
713+ n.append(table_name);
714 //ident = new TableIdentifier(
715 // std::string(db_name),
716 // std::string(tab_name, tab_name_len),
717@@ -2720,6 +2726,20 @@
718 }
719 }
720
721+ /* Ensure that handle data record size is big enough to
722+ * include the extended record reference, in the case of
723+ * variable length rows
724+ */
725+ if (!dic_rec_fixed) {
726+ if (dic_rec_size < offsetof(XTTabRecExtDRec, re_data))
727+ dic_rec_size = offsetof(XTTabRecExtDRec, re_data);
728+ }
729+#ifdef DEBUG
730+ else {
731+ ASSERT_NS(dic_rec_size > offsetof(XTTabRecFix, rf_data));
732+ }
733+#endif
734+
735 if (!dic->dic_rec_size) {
736 dic->dic_rec_size = dic_rec_size;
737 dic->dic_rec_fixed = dic_rec_fixed;
738@@ -3309,7 +3329,7 @@
739 *
740 */
741
742-#ifdef DRI_IS
743+#ifndef DRIZZLED
744 static int mx_put_record(THD *thd, TABLE *table)
745 {
746 return schema_table_store_record(thd, table);
747@@ -3369,7 +3389,7 @@
748
749 return err;
750 }
751-#endif // DRI_IS
752+#endif // !DRIZZLED
753
754 xtPublic void myxt_get_status(XTThreadPtr self, XTStringBufferPtr strbuf)
755 {
756
757=== modified file 'plugin/pbxt/src/pbms_enabled.cc'
758--- plugin/pbxt/src/pbms_enabled.cc 2010-04-19 21:42:39 +0000
759+++ plugin/pbxt/src/pbms_enabled.cc 2010-05-03 14:18:27 +0000
760@@ -124,9 +124,8 @@
761 }
762
763 if (length > org_length) {
764- Session *tmp_session= current_session;
765 // This can only happen if the BLOB URL is actually larger than the BLOB itself.
766- blob = (char *) session->session_alloc(length);
767+ blob = (char *) session_alloc(current_session, length);
768 memcpy(blob_rec+packlength, &blob, sizeof(char*));
769 }
770 memcpy(blob, blob_url_buffer, length);
771
772=== modified file 'plugin/pbxt/src/restart_xt.cc'
773--- plugin/pbxt/src/restart_xt.cc 2010-04-08 16:11:29 +0000
774+++ plugin/pbxt/src/restart_xt.cc 2010-05-03 14:18:27 +0000
775@@ -2578,7 +2578,7 @@
776
777 xtBool XTXactRestart::xres_is_checkpoint_pending(xtLogID curr_log_id, xtLogOffset curr_log_offset)
778 {
779- return xt_bytes_since_last_checkpoint(xres_db, curr_log_id, curr_log_offset) >= xt_db_checkpoint_frequency / 2;
780+ return xt_bytes_since_last_checkpoint(xres_db, curr_log_id, curr_log_offset) >= xt_db_checkpoint_frequency;
781 }
782
783 /*
784@@ -2888,6 +2888,7 @@
785 u_int curr_writer_total;
786 time_t now, last_index_flush;
787 xtBool async = TRUE;
788+ xtXactID sweep_count;
789
790 xt_set_low_priority(self);
791
792@@ -2916,8 +2917,14 @@
793 * And if the sweeper is not idle, then there is also activity!
794 * And if the writer is active, then we should wait for it as well!
795 */
796+#ifdef XT_SWEEPER_SORT_XACTS
797+ sweep_count = db->db_xn_curr_id + 1 - db->db_sw_to_add + db->db_sw_list_size;
798+#else
799+ sweep_count = db->db_xn_curr_id + 1 - db->db_xn_to_clean_id;
800+#endif
801 if (!db->db_xn_long_running_count &&
802 curr_writer_total == db->db_xn_total_writer_count &&
803+ !sweep_count &&
804 db->db_sw_idle == XT_THREAD_IDLE &&
805 db->db_wr_idle == XT_THREAD_IDLE) {
806 /* No activity in 2 seconds: */
807
808=== modified file 'plugin/pbxt/src/systab_xt.cc'
809--- plugin/pbxt/src/systab_xt.cc 2010-04-11 17:04:06 +0000
810+++ plugin/pbxt/src/systab_xt.cc 2010-05-03 14:18:27 +0000
811@@ -590,15 +590,10 @@
812
813 void XTSystemTableShare::createSystemTables(XTThreadPtr XT_UNUSED(self), XTDatabaseHPtr XT_UNUSED(db))
814 {
815-#ifdef PBXT_SYS_TAB
816+#ifndef DRIZZLED
817 int i = 0;
818
819 while (xt_internal_tables[i].sts_path) {
820-#ifdef DRIZZLED
821- // must ignore errors here
822- drizzled::Session *session = current_thd;
823- //session->main_da.disable_status();
824-#endif
825 if (!xt_create_table_frm(pbxt_hton,
826 current_thd, "pbxt",
827 strchr(xt_internal_tables[i].sts_path, '.') + 1,
828@@ -607,9 +602,6 @@
829 TRUE /*do not recreate*/))
830 xt_internal_tables[i].sts_exists = TRUE;
831 i++;
832-#ifdef DRIZZLED
833- session->main_da.reset_diagnostics_area();
834-#endif
835 }
836 #endif
837 }
838
839=== modified file 'plugin/pbxt/src/tabcache_xt.cc'
840--- plugin/pbxt/src/tabcache_xt.cc 2010-04-08 16:11:29 +0000
841+++ plugin/pbxt/src/tabcache_xt.cc 2010-05-03 14:18:27 +0000
842@@ -923,7 +923,7 @@
843 /*
844 * Used by the writer to wake the freeer.
845 */
846-xtPublic void xt_wr_wake_freeer(XTThreadPtr, XTDatabaseHPtr db)
847+xtPublic void xt_wr_wake_freeer(XTThreadPtr XT_UNUSED(self), XTDatabaseHPtr db)
848 {
849 /* BUG FIX: Was using tcm_freeer_cond.
850 * This is incorrect. When the freeer waits for the
851
852=== modified file 'plugin/pbxt/src/table_xt.cc'
853--- plugin/pbxt/src/table_xt.cc 2010-04-26 10:27:49 +0000
854+++ plugin/pbxt/src/table_xt.cc 2010-05-03 14:18:27 +0000
855@@ -537,8 +537,8 @@
856 else if (strcmp(name, "type") == 0) {
857 u_long lvalue = 0;
858
859- sscanf(value, "%lu", &lvalue);
860- td->td_tab_type = (xtWord1) lvalue;
861+ sscanf(value, "%lu", &lvalue);
862+ td->td_tab_type = (xtWord1) lvalue;
863 }
864 else if (strcmp(name, "[table]") == 0)
865 break;
866@@ -1292,7 +1292,7 @@
867 XTOpenFilePtr of_rec, of_ind;
868 XTTableEntryPtr te_ptr;
869 size_t tab_format_offset;
870- size_t tab_head_size= 0;
871+ size_t tab_head_size = 0;
872
873 enter_();
874
875@@ -1579,7 +1579,7 @@
876 }
877 }
878
879-static void tab_init_row_file(XTThreadPtr self, XTOpenFilePtr of_row, XTTableHPtr tab, XTDictionaryPtr)
880+static void tab_init_row_file(XTThreadPtr self, XTOpenFilePtr of_row, XTTableHPtr tab, XTDictionaryPtr XT_UNUSED(dic))
881 {
882 XTTabRowHeadDRec row_head;
883
884@@ -4442,6 +4442,24 @@
885 u_int next_off_page = 0;
886 #endif
887
888+static xtBool tab_write_ext_record(XTOpenTablePtr XT_UNUSED(ot), XTTableHPtr tab, XTTabRecInfoPtr rec_info, xtRecordID rec_id, xtLogID log_id, xtLogOffset log_offset, XTThreadPtr thread)
889+{
890+ xtWord1 tmp_buffer[offsetof(XTactExtRecEntryDRec, er_data)];
891+ xtBool ok;
892+
893+ memcpy(tmp_buffer, rec_info->ri_log_buf, sizeof(tmp_buffer));
894+ rec_info->ri_log_buf->er_status_1 = XT_LOG_ENT_EXT_REC_OK;
895+ XT_SET_DISK_4(rec_info->ri_log_buf->er_data_size_4, rec_info->ri_log_data_size);
896+ XT_SET_DISK_4(rec_info->ri_log_buf->er_tab_id_4, tab->tab_id);
897+ XT_SET_DISK_4(rec_info->ri_log_buf->er_rec_id_4, rec_id);
898+ if (tab->tab_dic.dic_tab_flags & XT_TF_MEMORY_TABLE)
899+ ok = xt_tab_save_ext_record(tab, log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info->ri_log_data_size, (xtWord1 *) rec_info->ri_log_buf);
900+ else
901+ ok = thread->st_dlog_buf.dlb_append_log(log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info->ri_log_data_size, (xtWord1 *) rec_info->ri_log_buf, thread);
902+ memcpy(rec_info->ri_log_buf, tmp_buffer, sizeof(tmp_buffer));
903+ return ok;
904+}
905+
906 static xtBool tab_add_record(XTOpenTablePtr ot, XTTabRecInfoPtr rec_info, u_int status)
907 {
908 register XTTableHPtr tab = ot->ot_table;
909@@ -4548,32 +4566,20 @@
910 */
911 read = ((rec_id - 1) % tab->tab_recs.tci_rows_per_page) != 0;
912
913- if (!tab->tab_recs.xt_tc_write(ot->ot_rec_file, rec_id, 0, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf, &op_seq, read, ot->ot_thread)) {
914+ if (!tab->tab_recs.xt_tc_write(ot->ot_rec_file, rec_id, 0, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf, &op_seq, read, thread)) {
915 xt_unlock_mutex_ns(&tab->tab_rec_lock);
916 return FAILED;
917 }
918 }
919 xt_unlock_mutex_ns(&tab->tab_rec_lock);
920
921- if (!xt_xlog_modify_table(tab->tab_id, status, op_seq, 0, next_rec_id, rec_id, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf, ot->ot_thread))
922+ if (!xt_xlog_modify_table(tab->tab_id, status, op_seq, 0, next_rec_id, rec_id, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf, thread))
923 return FAILED;
924
925 if (rec_info->ri_ext_rec) {
926 /* Write the log buffer overflow: */
927- rec_info->ri_log_buf->er_status_1 = XT_LOG_ENT_EXT_REC_OK;
928- XT_SET_DISK_4(rec_info->ri_log_buf->er_data_size_4, rec_info->ri_log_data_size);
929- XT_SET_DISK_4(rec_info->ri_log_buf->er_tab_id_4, tab->tab_id);
930- XT_SET_DISK_4(rec_info->ri_log_buf->er_rec_id_4, rec_id);
931- if (tab->tab_dic.dic_tab_flags & XT_TF_MEMORY_TABLE) {
932- if (!xt_tab_save_ext_record(tab, log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info->ri_log_data_size, (xtWord1 *) rec_info->ri_log_buf))
933- return FAILED;
934- }
935- else {
936- if (!thread->st_dlog_buf.dlb_append_log(log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info->ri_log_data_size, (xtWord1 *) rec_info->ri_log_buf, ot->ot_thread)) {
937- /* Failed to write the overflow, free the record allocated above: */
938- return FAILED;
939- }
940- }
941+ if (!tab_write_ext_record(ot, tab, rec_info, rec_id, log_id, log_offset, thread))
942+ return FAILED;
943 }
944
945 XT_DISABLED_TRACE(("new rec tx=%d val=%d\n", (int) thread->st_xact_data->xd_start_xn_id, (int) rec_id));
946@@ -4581,7 +4587,7 @@
947 return OK;
948 }
949
950-static void tab_delete_record_on_fail(XTOpenTablePtr ot, xtRowID row_id, xtRecordID rec_id, XTTabRecHeadDPtr row_ptr, xtWord1 *rec_data, u_int key_count)
951+static void tab_delete_record_on_fail(XTOpenTablePtr ot, xtRowID row_id, xtRecordID rec_id, XTTabRecHeadDPtr XT_UNUSED(row_ptr), xtWord1 *rec_data, u_int key_count)
952 {
953 XTExceptionRec e;
954 xtBool log_err = TRUE;
955@@ -4609,8 +4615,11 @@
956 }
957 }
958
959+ /* This is not required because the extended record will be free
960+ * later when the record is freed!
961 if (row_ptr->tr_rec_type_1 == XT_TAB_STATUS_EXT_DLOG || row_ptr->tr_rec_type_1 == XT_TAB_STATUS_EXT_CLEAN)
962 tab_free_ext_record_on_fail(ot, rec_id, (XTTabRecExtDPtr) row_ptr, log_err);
963+ */
964
965 rec_info.ri_fix_rec_buf = (XTTabRecFixDPtr) ot->ot_row_wbuffer;
966 rec_info.ri_rec_buf_size = offsetof(XTTabRecFixDRec, rf_data);
967@@ -4909,6 +4918,10 @@
968 u_int idx_cnt = 0;
969 XTIndexPtr *ind;
970
971+ /* A non-temporary table has been updated: */
972+ if (!XT_IS_TEMP_TABLE(tab->tab_dic.dic_tab_flags))
973+ self->st_non_temp_updated = TRUE;
974+
975 if (!myxt_store_row(ot, &rec_info, (char *) rec_buf))
976 goto failed_0;
977
978@@ -5005,7 +5018,7 @@
979 * order to do this we'd need to read the before-image of the
980 * record before modifying it.
981 */
982- if (!ot->ot_thread->t_exception.e_xt_err)
983+ if (!thread->t_exception.e_xt_err)
984 xt_register_xterr(XT_REG_CONTEXT, XT_ERR_NO_BEFORE_IMAGE);
985 return FAILED;
986 }
987@@ -5023,7 +5036,7 @@
988 return FAILED;
989 }
990 else {
991- if (!thread->st_dlog_buf.dlb_get_log_offset(&log_id, &log_offset, rec_info->ri_log_data_size + offsetof(XTactExtRecEntryDRec, er_data), ot->ot_thread))
992+ if (!thread->st_dlog_buf.dlb_get_log_offset(&log_id, &log_offset, rec_info->ri_log_data_size + offsetof(XTactExtRecEntryDRec, er_data), thread))
993 return FAILED;
994 }
995 XT_SET_LOG_REF(rec_info->ri_ext_rec, log_id, log_offset);
996@@ -5034,19 +5047,8 @@
997
998 if (rec_info->ri_ext_rec) {
999 /* Write the log buffer overflow: */
1000- rec_info->ri_log_buf->er_status_1 = XT_LOG_ENT_EXT_REC_OK;
1001- XT_SET_DISK_4(rec_info->ri_log_buf->er_data_size_4, rec_info->ri_log_data_size);
1002- XT_SET_DISK_4(rec_info->ri_log_buf->er_tab_id_4, tab->tab_id);
1003- XT_SET_DISK_4(rec_info->ri_log_buf->er_rec_id_4, rec_id);
1004-
1005- if (tab->tab_dic.dic_tab_flags & XT_TF_MEMORY_TABLE) {
1006- if (!xt_tab_save_ext_record(tab, log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info->ri_log_data_size, (xtWord1 *) rec_info->ri_log_buf))
1007- return FAILED;
1008- }
1009- else {
1010- if (!thread->st_dlog_buf.dlb_append_log(log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info->ri_log_data_size, (xtWord1 *) rec_info->ri_log_buf, ot->ot_thread))
1011- return FAILED;
1012- }
1013+ if (!tab_write_ext_record(ot, tab, rec_info, rec_id, log_id, log_offset, thread))
1014+ return FAILED;
1015 }
1016
1017 /* Put the index entries back: */
1018@@ -5078,6 +5080,10 @@
1019 xtLogOffset log_offset;
1020 xtBool prev_ext_rec;
1021
1022+ /* A non-temporary table has been updated: */
1023+ if (!XT_IS_TEMP_TABLE(tab->tab_dic.dic_tab_flags))
1024+ self->st_non_temp_updated = TRUE;
1025+
1026 if (!myxt_store_row(ot, &rec_info, (char *) after_buf))
1027 goto failed_0;
1028
1029@@ -5094,7 +5100,7 @@
1030 goto failed_0;
1031 }
1032 else {
1033- if (!self->st_dlog_buf.dlb_get_log_offset(&log_id, &log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info.ri_log_data_size, ot->ot_thread))
1034+ if (!self->st_dlog_buf.dlb_get_log_offset(&log_id, &log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info.ri_log_data_size, self))
1035 goto failed_0;
1036 }
1037 XT_SET_LOG_REF(rec_info.ri_ext_rec, log_id, log_offset);
1038@@ -5121,18 +5127,8 @@
1039
1040 if (rec_info.ri_ext_rec) {
1041 /* Write the log buffer overflow: */
1042- rec_info.ri_log_buf->er_status_1 = XT_LOG_ENT_EXT_REC_OK;
1043- XT_SET_DISK_4(rec_info.ri_log_buf->er_data_size_4, rec_info.ri_log_data_size);
1044- XT_SET_DISK_4(rec_info.ri_log_buf->er_tab_id_4, tab->tab_id);
1045- XT_SET_DISK_4(rec_info.ri_log_buf->er_rec_id_4, rec_id);
1046- if (tab->tab_dic.dic_tab_flags & XT_TF_MEMORY_TABLE) {
1047- if (!xt_tab_save_ext_record(tab, log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info.ri_log_data_size, (xtWord1 *) rec_info.ri_log_buf))
1048- goto failed_1;
1049- }
1050- else {
1051- if (!self->st_dlog_buf.dlb_append_log(log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info.ri_log_data_size, (xtWord1 *) rec_info.ri_log_buf, ot->ot_thread))
1052- goto failed_1;
1053- }
1054+ if (!tab_write_ext_record(ot, tab, &rec_info, rec_id, log_id, log_offset, self))
1055+ goto failed_1;
1056 }
1057
1058 /* Add the index references that have changed: */
1059@@ -5247,6 +5243,10 @@
1060 row_id = ot->ot_curr_row_id;
1061 self = ot->ot_thread;
1062
1063+ /* A non-temporary table has been updated: */
1064+ if (!XT_IS_TEMP_TABLE(tab->tab_dic.dic_tab_flags))
1065+ self->st_non_temp_updated = TRUE;
1066+
1067 if (!myxt_store_row(ot, &rec_info, (char *) after_buf))
1068 goto failed_0;
1069
1070@@ -5260,7 +5260,7 @@
1071 goto failed_0;
1072
1073 /* Link the new variation into the list: */
1074- XT_TAB_ROW_WRITE_LOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], ot->ot_thread);
1075+ XT_TAB_ROW_WRITE_LOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], self);
1076
1077 if (!xt_tab_get_row(ot, row_id, &curr_var_rec_id))
1078 goto failed_1;
1079@@ -5286,7 +5286,7 @@
1080 goto failed_1;
1081 XT_DISABLED_TRACE(("set upd tx=%d row=%d rec=%d\n", (int) self->st_xact_data->xd_start_xn_id, (int) row_id, (int) rec_info.ri_rec_id));
1082
1083- XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], ot->ot_thread);
1084+ XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], self);
1085
1086 /* Add the index references: */
1087 for (idx_cnt=0, ind=tab->tab_dic.dic_keys; idx_cnt<tab->tab_dic.dic_key_count; idx_cnt++, ind++) {
1088@@ -5301,7 +5301,7 @@
1089 goto failed_2;
1090 }
1091
1092- ot->ot_thread->st_statistics.st_row_update++;
1093+ self->st_statistics.st_row_update++;
1094 return OK;
1095
1096 failed_2:
1097@@ -5309,7 +5309,7 @@
1098 goto failed_0;
1099
1100 failed_1:
1101- XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], ot->ot_thread);
1102+ XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], self);
1103
1104 failed_0:
1105 return FAILED;
1106@@ -5318,10 +5318,15 @@
1107 xtPublic xtBool xt_tab_delete_record(XTOpenTablePtr ot, xtWord1 *rec_buf)
1108 {
1109 register XTTableHPtr tab = ot->ot_table;
1110+ register XTThreadPtr thread = ot->ot_thread;
1111 xtRowID row_id = ot->ot_curr_row_id;
1112 xtRecordID curr_var_rec_id;
1113 XTTabRecInfoRec rec_info;
1114
1115+ /* A non-temporary table has been updated: */
1116+ if (!XT_IS_TEMP_TABLE(tab->tab_dic.dic_tab_flags))
1117+ thread->st_non_temp_updated = TRUE;
1118+
1119 /* Setup a delete record: */
1120 rec_info.ri_fix_rec_buf = (XTTabRecFixDPtr) ot->ot_row_wbuffer;
1121 rec_info.ri_rec_buf_size = offsetof(XTTabRecFixDRec, rf_data);
1122@@ -5330,12 +5335,12 @@
1123 rec_info.ri_fix_rec_buf->tr_stat_id_1 = 0;
1124 XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_row_id_4, row_id);
1125 XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_prev_rec_id_4, ot->ot_curr_rec_id);
1126- XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_xact_id_4, ot->ot_thread->st_xact_data->xd_start_xn_id);
1127+ XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_xact_id_4, thread->st_xact_data->xd_start_xn_id);
1128
1129 if (!tab_add_record(ot, &rec_info, XT_LOG_ENT_DELETE))
1130 return FAILED;
1131
1132- XT_TAB_ROW_WRITE_LOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], ot->ot_thread);
1133+ XT_TAB_ROW_WRITE_LOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], thread);
1134
1135 if (!xt_tab_get_row(ot, row_id, &curr_var_rec_id))
1136 goto failed_1;
1137@@ -5346,20 +5351,20 @@
1138 }
1139
1140 #ifdef TRACE_VARIATIONS
1141- xt_ttracef(ot->ot_thread, "update: row=%d rec=%d T%d\n", (int) row_id, (int) rec_info.ri_rec_id, (int) ot->ot_thread->st_xact_data->xd_start_xn_id);
1142+ xt_ttracef(thread, "update: row=%d rec=%d T%d\n", (int) row_id, (int) rec_info.ri_rec_id, (int) thread->st_xact_data->xd_start_xn_id);
1143 #endif
1144 if (!xt_tab_set_row(ot, XT_LOG_ENT_ROW_ADD_REC, row_id, rec_info.ri_rec_id))
1145 goto failed_1;
1146- XT_DISABLED_TRACE(("del row tx=%d row=%d rec=%d\n", (int) ot->ot_thread->st_xact_data->xd_start_xn_id, (int) row_id, (int) rec_info.ri_rec_id));
1147+ XT_DISABLED_TRACE(("del row tx=%d row=%d rec=%d\n", (int) thread->st_xact_data->xd_start_xn_id, (int) row_id, (int) rec_info.ri_rec_id));
1148
1149- XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], ot->ot_thread);
1150+ XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], thread);
1151
1152 if (ot->ot_table->tab_dic.dic_table->dt_trefs) {
1153 if (!ot->ot_table->tab_dic.dic_table->deleteRow(ot, rec_buf))
1154 goto failed_2;
1155 }
1156
1157- ot->ot_thread->st_statistics.st_row_delete++;
1158+ thread->st_statistics.st_row_delete++;
1159 return OK;
1160
1161 failed_2:
1162@@ -5367,7 +5372,7 @@
1163 return FAILED;
1164
1165 failed_1:
1166- XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], ot->ot_thread);
1167+ XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], thread);
1168 return FAILED;
1169 }
1170
1171@@ -5880,7 +5885,7 @@
1172 * EXTENDED DATA FOR RAM TABLES
1173 */
1174
1175-xtPublic xtBool xt_tab_get_ext_slot(XTTableHPtr tab, xtLogID *log_id, xtLogOffset *log_offset, size_t /*req_size*/)
1176+xtPublic xtBool xt_tab_get_ext_slot(XTTableHPtr tab, xtLogID *log_id, xtLogOffset *log_offset, size_t XT_UNUSED(req_size))
1177 {
1178 size_t new_slot;
1179
1180
1181=== modified file 'plugin/pbxt/src/table_xt.h'
1182--- plugin/pbxt/src/table_xt.h 2010-04-28 18:23:22 +0000
1183+++ plugin/pbxt/src/table_xt.h 2010-05-03 14:18:27 +0000
1184@@ -191,7 +191,7 @@
1185 XTDiskValue2 tf_tab_unused_2; /* Unused, set to zero */
1186 XTDiskValue4 tf_rec_size_4; /* The maximum size of records in the table. */
1187 XTDiskValue1 tf_rec_fixed_1; /* Set to 1 if this table contains fixed length records. */
1188- XTDiskValue1 tf_reserved_1;
1189+ XTDiskValue1 tf_reserved_1; /* - */
1190 XTDiskValue8 tf_min_auto_inc_8; /* This is the minimum auto-increment value. */
1191 xtWord1 tf_reserved[64]; /* Reserved, set to 0. */
1192 char tf_definition[XT_VAR_LENGTH]; /* A cstring, currently it only contains the foreign key information. */
1193
1194=== modified file 'plugin/pbxt/src/thread_xt.cc'
1195--- plugin/pbxt/src/thread_xt.cc 2010-04-08 16:11:29 +0000
1196+++ plugin/pbxt/src/thread_xt.cc 2010-05-03 14:18:27 +0000
1197@@ -50,7 +50,7 @@
1198 #include "database_xt.h"
1199
1200 #ifdef DEBUG
1201-#define DEBUG_NO_ACTIVITY
1202+//#define DEBUG_NO_ACTIVITY
1203 #endif
1204
1205 void xt_db_exit_thread(XTThreadPtr self);
1206
1207=== modified file 'plugin/pbxt/src/thread_xt.h'
1208--- plugin/pbxt/src/thread_xt.h 2010-04-26 11:13:26 +0000
1209+++ plugin/pbxt/src/thread_xt.h 2010-05-03 14:18:27 +0000
1210@@ -264,7 +264,7 @@
1211 tk_notify_threads.pl_exit();
1212 }
1213
1214- virtual void tk_init(struct XTThread *) { }
1215+ virtual void tk_init(struct XTThread *XT_UNUSED(self)) { }
1216 virtual void tk_exit() { delete this; }
1217 virtual void tk_lock() { }
1218 virtual void tk_unlock() { }
1219@@ -395,7 +395,7 @@
1220 xtBool1 st_stat_ended; /* TRUE if the statement was ended. */
1221 xtBool1 st_stat_trans; /* TRUE if a statement transaction is running (started on UPDATE). */
1222 xtBool1 st_stat_modify; /* TRUE if the statement is an INSERT/UPDATE/DELETE */
1223- xtBool1 st_non_temp_opened; /* TRUE if a non-temp tables was opened! */
1224+ xtBool1 st_non_temp_updated; /* TRUE if a non-temp tables was updated! */
1225 xtWord1 st_import_stat; /* Non-zero if this is an import statement (ALTER, LOAD, REPAIR, etc). */
1226 #ifdef XT_IMPLEMENT_NO_ACTION
1227 XTBasicListRec st_restrict_list; /* These records have been deleted and should have no reference. */
1228
1229=== modified file 'plugin/pbxt/src/xaction_xt.cc'
1230--- plugin/pbxt/src/xaction_xt.cc 2010-04-08 16:11:29 +0000
1231+++ plugin/pbxt/src/xaction_xt.cc 2010-05-03 14:18:27 +0000
1232@@ -1221,7 +1221,7 @@
1233 /* Write and flush the transaction log:
1234 * We only flush if this was not a temp table.
1235 */
1236- if (!xt_xlog_log_data(thread, sizeof(XTXactEndEntryDRec), (XTXactLogBufferDPtr) &entry, thread->st_non_temp_opened ? XT_XLOG_NO_WRITE_NO_FLUSH : xt_db_flush_log_at_trx_commit)) {
1237+ if (!xt_xlog_log_data(thread, sizeof(XTXactEndEntryDRec), (XTXactLogBufferDPtr) &entry, thread->st_non_temp_updated ? xt_db_flush_log_at_trx_commit : XT_XLOG_NO_WRITE_NO_FLUSH)) {
1238 ok = FALSE;
1239 status = XT_LOG_ENT_ABORT;
1240 /* Make sure this is done, if we failed to log
1241@@ -1337,20 +1337,27 @@
1242 /* Don't get too far ahead of the sweeper! */
1243 if (writer) {
1244 #ifdef XT_WAIT_FOR_CLEANUP
1245- xtXactID wait_xn_id;
1246-
1247- /* This is the transaction that was committed 3 transactions ago: */
1248- wait_xn_id = thread->st_prev_xact[thread->st_last_xact];
1249- thread->st_prev_xact[thread->st_last_xact] = xn_id;
1250- /* This works because XT_MAX_XACT_BEHIND == 2! */
1251- ASSERT_NS((thread->st_last_xact + 1) % XT_MAX_XACT_BEHIND == (thread->st_last_xact ^ 1));
1252- thread->st_last_xact ^= 1;
1253- while (xt_xn_is_before(db->db_xn_to_clean_id, wait_xn_id) && (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND)) {
1254+ if (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND) {
1255+ /* Set a maximum wait time (1/100s) */
1256+ xtWord8 then = xt_trace_clock() + (xtWord8) 100000;
1257+ xtXactID wait_xn_id;
1258+
1259+ /* This is the transaction that was committed 3 transactions ago: */
1260+ wait_xn_id = thread->st_prev_xact[thread->st_last_xact];
1261+ thread->st_prev_xact[thread->st_last_xact] = xn_id;
1262+ /* This works because XT_MAX_XACT_BEHIND == 2! */
1263+ ASSERT_NS((thread->st_last_xact + 1) % XT_MAX_XACT_BEHIND == (thread->st_last_xact ^ 1));
1264+ thread->st_last_xact ^= 1;
1265+
1266+ while (xt_xn_is_before(db->db_xn_to_clean_id, wait_xn_id) && (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND)) {
1267+ if (xt_trace_clock() >= then)
1268+ break;
1269 #ifdef XT_SWEEPER_SORT_XACTS
1270- if (!xn_get_xact_start(db, wait_xn_id, thread, NULL, NULL))
1271- break;
1272+ if (!xn_get_xact_start(db, wait_xn_id, thread, NULL, NULL))
1273+ break;
1274 #endif
1275- xt_critical_wait();
1276+ xt_critical_wait();
1277+ }
1278 }
1279 #else
1280 if ((db->db_sw_faster & XT_SW_TOO_FAR_BEHIND) != 0) {
1281
1282=== modified file 'plugin/pbxt/src/xactlog_xt.cc'
1283--- plugin/pbxt/src/xactlog_xt.cc 2010-04-08 16:11:29 +0000
1284+++ plugin/pbxt/src/xactlog_xt.cc 2010-05-03 14:18:27 +0000
1285@@ -118,7 +118,7 @@
1286 cont_(a);
1287 }
1288
1289-xtPublic void xt_xlog_exit(XTThreadPtr)
1290+xtPublic void xt_xlog_exit(XTThreadPtr XT_UNUSED(self))
1291 {
1292 for (u_int i=0; i<XLC_SEGMENT_COUNT; i++) {
1293 if (xt_xlog_cache.xlc_segment[i].lcs_hash_table) {
1294@@ -2185,7 +2185,11 @@
1295 record = (XTXactLogBufferDPtr) (seq->xseq_buffer + rec_offset);
1296 switch (record->xh.xh_status_1) {
1297 case XT_LOG_ENT_HEADER:
1298- len = sizeof(XTXactLogHeaderDRec);
1299+ len = offsetof(XTXactLogHeaderDRec, xh_version_2) + 2;
1300+ if (len > max_rec_len)
1301+ /* The size is not in the buffer: */
1302+ goto read_more;
1303+ len = (size_t) XT_GET_DISK_4(record->xh.xh_size_4);
1304 break;
1305 case XT_LOG_ENT_NEW_LOG:
1306 case XT_LOG_ENT_DEL_LOG:
1307
1308=== modified file 'plugin/pbxt/src/xt_defs.h'
1309--- plugin/pbxt/src/xt_defs.h 2010-04-19 20:57:43 +0000
1310+++ plugin/pbxt/src/xt_defs.h 2010-05-03 14:18:27 +0000
1311@@ -887,7 +887,7 @@
1312 #define thd_charset session_charset
1313 #define thd_slave_thread session_slave_thread
1314 #define thd_binlog_format session_binlog_format
1315-#define thd_mark_transaction_to_rollback ::drizzled::session_mark_transaction_to_rollback
1316+#define thd_mark_transaction_to_rollback ::drizzled::mark_transaction_to_rollback
1317 #define thd_ha_data session_ha_data
1318 #define current_thd current_session
1319 #define thd_sql_command session_sql_command
1320@@ -942,7 +942,7 @@
1321 #define MX_ULONG_T ulong
1322 #define MX_ULONGLONG_T ulonglong
1323 #define MX_LONGLONG_T longlong
1324-#define MX_CHARSET_INFO CHARSET_INFO
1325+#define MX_CHARSET_INFO struct charset_info_st
1326 #define MX_CONST_CHARSET_INFO struct charset_info_st
1327 #define MX_CONST
1328 #define MX_BITMAP MY_BITMAP