Merge lp:~vkolesnikov/pbxt/pbxt-recovery-freeze-and-partitioned-tables into lp:pbxt

Proposed by Vladimir Kolesnikov
Status: Merged
Merged at revision: not available
Proposed branch: lp:~vkolesnikov/pbxt/pbxt-recovery-freeze-and-partitioned-tables
Merge into: lp:pbxt
Diff against target: None lines
To merge this branch: bzr merge lp:~vkolesnikov/pbxt/pbxt-recovery-freeze-and-partitioned-tables
Reviewer Review Type Date Requested Status
PBXT Core Pending
Review via email: mp+7022@code.launchpad.net
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
=== modified file 'ChangeLog'
--- ChangeLog 2009-05-28 15:35:31 +0000
+++ ChangeLog 2009-06-03 14:53:00 +0000
@@ -3,6 +3,10 @@
33
4------- 1.0.08 RC - Not yet released4------- 1.0.08 RC - Not yet released
55
6RN243: Fixed a bug that caused a recovery failure if partitioned pbxt tables where present. This happended because the recovery used a MySQL function to open tables and the PBXT handler was not yet registered
7
8RN242: Fixed a bug that caused a deadlock if pbxt initialization failed. This happened because pbxt ceanup was done from pbxt_init() with PLUGIN_lock being held by MySQL which lead to a deadlock in the freeer thread
9
6RN241: Fixed a heap corruption bug (writing to a freed memory location). It happened only when memory mapped files were used leading to heap inconsistency and program crash or termination by heap checker. Likely to happen right after or during DROP TABLE but possible in other cases too.10RN241: Fixed a heap corruption bug (writing to a freed memory location). It happened only when memory mapped files were used leading to heap inconsistency and program crash or termination by heap checker. Likely to happen right after or during DROP TABLE but possible in other cases too.
711
8RN240: Load the record cache on read when no using memory mapped files.12RN240: Load the record cache on read when no using memory mapped files.
913
=== modified file 'src/ha_pbxt.cc'
--- src/ha_pbxt.cc 2009-05-21 10:27:57 +0000
+++ src/ha_pbxt.cc 2009-06-03 14:07:54 +0000
@@ -105,6 +105,8 @@
105static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share);105static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share);
106static void ha_close_open_tables(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);106static void ha_close_open_tables(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);
107107
108extern void xt_xres_start_database_recovery(XTThreadPtr self);
109
108#ifdef TRACE_STATEMENTS110#ifdef TRACE_STATEMENTS
109111
110#ifdef PRINT_STATEMENTS112#ifdef PRINT_STATEMENTS
@@ -167,7 +169,7 @@
167/* Variables for pbxt share methods */169/* Variables for pbxt share methods */
168static xt_mutex_type pbxt_database_mutex; // Prevent a database from being opened while it is being dropped170static xt_mutex_type pbxt_database_mutex; // Prevent a database from being opened while it is being dropped
169static XTHashTabPtr pbxt_share_tables; // Hash used to track open tables171static XTHashTabPtr pbxt_share_tables; // Hash used to track open tables
170static XTDatabaseHPtr pbxt_database = NULL; // The global open database172XTDatabaseHPtr pbxt_database = NULL; // The global open database
171static char *pbxt_index_cache_size;173static char *pbxt_index_cache_size;
172static char *pbxt_record_cache_size;174static char *pbxt_record_cache_size;
173static char *pbxt_log_cache_size;175static char *pbxt_log_cache_size;
@@ -1100,7 +1102,7 @@
1100#endif1102#endif
1101 self = xt_init_threading(pbxt_max_threads); /* Create the main self: */1103 self = xt_init_threading(pbxt_max_threads); /* Create the main self: */
1102 if (!self)1104 if (!self)
1103 goto error_4;1105 goto error_3;
11041106
1105 pbxt_inited = true;1107 pbxt_inited = true;
11061108
@@ -1164,9 +1166,7 @@
1164 xt_throw(self);1166 xt_throw(self);
1165 }1167 }
11661168
1167 xt_open_database(self, mysql_real_data_home, TRUE);1169 xt_xres_start_database_recovery(self);
1168 pbxt_database = self->st_database;
1169 xt_heap_reference(self, pbxt_database);
1170 }1170 }
1171 catch_(b) {1171 catch_(b) {
1172 if (!curr_thd && thd)1172 if (!curr_thd && thd)
@@ -1221,28 +1221,29 @@
1221 * I have to stop the freeer here because it was1221 * I have to stop the freeer here because it was
1222 * started before opening the database.1222 * started before opening the database.
1223 */1223 */
1224 pbxt_call_exit(self);1224
1225 pbxt_inited = FALSE;1225 /* {FREEER-HANG-ON-INIT-ERROR}
1226 xt_exit_threading(self);1226 * pbxt_init is called with LOCK_plugin and if it fails and tries to exit
1227 goto error_4;1227 * the freeer here it hangs because the freeer calls THD::~THD which tries
1228 * to aquire the same lock and hangs. OTOH MySQL calls pbxt_end() after
1229 * an unsuccessful call to pbxt_init, so we defer cleaup, except
1230 * releasing 'self'
1231 */
1232 xt_free_thread(self);
1233 goto error_3;
1228 }1234 }
1229 xt_free_thread(self);1235 xt_free_thread(self);
1230 }1236 }
1231 XT_RETURN(init_err);1237 XT_RETURN(init_err);
12321238
1233 error_4:
1234 xt_exit_memory();
1235
1236 error_3:1239 error_3:
1237#ifdef XT_STREAMING1240#ifdef XT_STREAMING
1238 xt_exit_streaming();1241 xt_exit_streaming();
12391242
1240 error_2:1243 error_2:
1241#endif1244#endif
1242 xt_exit_logging();
12431245
1244 error_1:1246 error_1:
1245 xt_p_mutex_destroy(&pbxt_database_mutex);
1246 XT_RETURN(1);1247 XT_RETURN(1);
1247}1248}
12481249
@@ -1261,7 +1262,7 @@
1261 XTExceptionRec e;1262 XTExceptionRec e;
12621263
1263 /* This flag also means "shutting down". */1264 /* This flag also means "shutting down". */
1264 pbxt_inited = FALSE;1265 pbxt_inited = FALSE;
1265 self = xt_create_thread("TempForEnd", FALSE, TRUE, &e);1266 self = xt_create_thread("TempForEnd", FALSE, TRUE, &e);
1266 if (self) {1267 if (self) {
1267 self->t_main = TRUE;1268 self->t_main = TRUE;
12681269
=== modified file 'src/restart_xt.cc'
--- src/restart_xt.cc 2009-05-19 14:13:25 +0000
+++ src/restart_xt.cc 2009-06-03 14:07:54 +0000
@@ -3188,3 +3188,36 @@
3188 done:3188 done:
3189 db->db_xlog.xlog_seq_exit(&seq);3189 db->db_xlog.xlog_seq_exit(&seq);
3190}3190}
3191
3192/* ----------------------------------------------------------------------
3193 * D A T A B A S E R E C O V E R Y T H R E A D
3194 */
3195
3196extern XTDatabaseHPtr pbxt_database;
3197
3198static void *xn_xres_run_recovery_thread(XTThreadPtr self)
3199{
3200 THD *mysql_thread;
3201
3202 mysql_thread = (THD *)myxt_create_thread();
3203
3204 while(!ha_resolve_by_legacy_type(mysql_thread, DB_TYPE_PBXT))
3205 xt_sleep_milli_second(1);
3206
3207 xt_open_database(self, mysql_real_data_home, TRUE);
3208 pbxt_database = self->st_database;
3209 xt_heap_reference(self, pbxt_database);
3210 myxt_destroy_thread(mysql_thread, TRUE);
3211
3212 return NULL;
3213}
3214
3215xtPublic void xt_xres_start_database_recovery(XTThreadPtr self)
3216{
3217 char name[PATH_MAX];
3218
3219 sprintf(name, "DB-RECOVERY-%s", xt_last_directory_of_path(mysql_real_data_home));
3220 xt_remove_dir_char(name);
3221 XTThreadPtr thread = xt_create_daemon(self, name);
3222 xt_run_thread(self, thread, xn_xres_run_recovery_thread);
3223}
31913224
=== modified file 'src/restart_xt.h'
--- src/restart_xt.h 2009-02-23 19:34:56 +0000
+++ src/restart_xt.h 2009-06-03 13:13:32 +0000
@@ -131,4 +131,6 @@
131void xt_print_log_record(xtLogID log, off_t offset, XTXactLogBufferDPtr record);131void xt_print_log_record(xtLogID log, off_t offset, XTXactLogBufferDPtr record);
132void xt_dump_xlogs(struct XTDatabase *db, xtLogID start_log);132void xt_dump_xlogs(struct XTDatabase *db, xtLogID start_log);
133133
134xtPublic void xt_xres_start_database_recovery(XTThreadPtr self, const char *path);
135
134#endif136#endif

Subscribers

People subscribed via source and target branches