summaryrefslogtreecommitdiff
path: root/innobase/trx/trx0sys.c
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2004-01-06 13:40:14 +0200
committerunknown <heikki@hundin.mysql.fi>2004-01-06 13:40:14 +0200
commit7219513743ec021216f8ad81dc8e80607d431769 (patch)
treed2e3115611693d6885f2fc3d1bca9a6a401f66e0 /innobase/trx/trx0sys.c
parentb703338d76e40859ae39b669816eba768d0f7ed7 (diff)
downloadmariadb-git-7219513743ec021216f8ad81dc8e80607d431769.tar.gz
trx0sys.c, srv0start.c, ibuf0ibuf.c, trx0sys.h, srv0srv.h:
DO NOT MERGE TO 4.1: add code for automatic downgrade 4.1.1 -> 4.0 if the user has not created multiple tablespaces yet innobase/include/srv0srv.h: DO NOT MERGE TO 4.1: add code for automatic downgrade 4.1.1 -> 4.0 if the user has not created multiple tablespaces yet innobase/include/trx0sys.h: DO NOT MERGE TO 4.1: add code for automatic downgrade 4.1.1 -> 4.0 if the user has not created multiple tablespaces yet innobase/ibuf/ibuf0ibuf.c: DO NOT MERGE TO 4.1: add code for automatic downgrade 4.1.1 -> 4.0 if the user has not created multiple tablespaces yet innobase/srv/srv0start.c: DO NOT MERGE TO 4.1: add code for automatic downgrade 4.1.1 -> 4.0 if the user has not created multiple tablespaces yet innobase/trx/trx0sys.c: DO NOT MERGE TO 4.1: add code for automatic downgrade 4.1.1 -> 4.0 if the user has not created multiple tablespaces yet
Diffstat (limited to 'innobase/trx/trx0sys.c')
-rw-r--r--innobase/trx/trx0sys.c88
1 files changed, 87 insertions, 1 deletions
diff --git a/innobase/trx/trx0sys.c b/innobase/trx/trx0sys.c
index f1b03fff3bd..6ed70280b26 100644
--- a/innobase/trx/trx0sys.c
+++ b/innobase/trx/trx0sys.c
@@ -34,6 +34,43 @@ or there was no master log position info inside InnoDB. */
char trx_sys_mysql_master_log_name[TRX_SYS_MYSQL_LOG_NAME_LEN];
ib_longlong trx_sys_mysql_master_log_pos = -1;
+/* Do NOT merge this to the 4.1 code base! */
+ibool trx_sys_downgrading_from_4_1_1 = FALSE;
+
+/********************************************************************
+Do NOT merge this to the 4.1 code base!
+Marks the trx sys header when we have successfully downgraded from the >= 4.1.1
+multiple tablespace format back to the 4.0 format. */
+
+void
+trx_sys_mark_downgraded_from_4_1_1(void)
+/*====================================*/
+{
+ page_t* page;
+ byte* doublewrite;
+ mtr_t mtr;
+
+ /* Let us mark to the trx_sys header that the downgrade has been
+ done. */
+
+ mtr_start(&mtr);
+
+ page = buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, RW_X_LATCH, &mtr);
+ buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
+
+ doublewrite = page + TRX_SYS_DOUBLEWRITE;
+
+ mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED,
+ TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N + 1,
+ MLOG_4BYTES, &mtr);
+ mtr_commit(&mtr);
+
+ /* Flush the modified pages to disk and make a checkpoint */
+ log_make_checkpoint_at(ut_dulint_max, TRUE);
+
+ trx_sys_downgrading_from_4_1_1 = FALSE;
+}
+
/********************************************************************
Determines if a page number is located inside the doublewrite buffer. */
@@ -138,12 +175,36 @@ start_again:
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
== TRX_SYS_DOUBLEWRITE_MAGIC_N) {
+ /* Do NOT merge to the 4.1 code base! */
+ if (mach_read_from_4(doublewrite
+ + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED)
+ == TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N) {
+
+ fprintf(stderr,
+"InnoDB: You are downgrading from the multiple tablespace format of\n"
+"InnoDB: >= MySQL-4.1.1 back to the old format of MySQL-4.0.\n"
+"InnoDB:\n"
+"InnoDB: MAKE SURE that the mysqld server is idle, and purge and the insert\n"
+"InnoDB: buffer merge have run to completion under >= 4.1.1 before trying to\n"
+"InnoDB: downgrade! You can determine this by looking at SHOW INNODB STATUS:\n"
+"InnoDB: if the Main thread is 'waiting for server activity' and SHOW\n"
+"InnoDB: PROCESSLIST shows that you have ended all other connections\n"
+"InnoDB: to mysqld, then purge and the insert buffer merge have been\n"
+"InnoDB: completed.\n"
+"InnoDB: If you have already created .ibd tables in >= 4.1.1, then those\n"
+"InnoDB: tables cannot be used under 4.0.\n"
+"InnoDB: NOTE THAT this downgrade procedure has not been properly tested!\n"
+"InnoDB: The safe way to downgrade is to dump all InnoDB tables and recreate\n"
+"InnoDB: the whole tablespace.\n");
+
+ trx_sys_downgrading_from_4_1_1 = TRUE;
+ }
/* The doublewrite buffer has already been created:
just read in some numbers */
trx_doublewrite_init(doublewrite);
-
+
mtr_commit(&mtr);
} else {
fprintf(stderr,
@@ -295,6 +356,31 @@ trx_sys_doublewrite_restore_corrupt_pages(void)
== TRX_SYS_DOUBLEWRITE_MAGIC_N) {
/* The doublewrite buffer has been created */
+ /* Do NOT merge to the 4.1 code base! */
+ if (mach_read_from_4(doublewrite
+ + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED)
+ == TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N) {
+
+ fprintf(stderr,
+"InnoDB: You are downgrading from the multiple tablespace format of\n"
+"InnoDB: >= MySQL-4.1.1 back to the old format of MySQL-4.0.\n"
+"InnoDB:\n"
+"InnoDB: MAKE SURE that the mysqld server is idle, and purge and the insert\n"
+"InnoDB: buffer merge have run to completion under >= 4.1.1 before trying to\n"
+"InnoDB: downgrade! You can determine this by looking at SHOW INNODB STATUS:\n"
+"InnoDB: if the Main thread is 'waiting for server activity' and SHOW\n"
+"InnoDB: PROCESSLIST shows that you have ended all other connections\n"
+"InnoDB: to mysqld, then purge and the insert buffer merge have been\n"
+"InnoDB: completed.\n"
+"InnoDB: If you have already created .ibd tables in >= 4.1.1, then those\n"
+"InnoDB: tables cannot be used under 4.0.\n"
+"InnoDB: NOTE THAT this downgrade procedure has not been properly tested!\n"
+"InnoDB: The safe way to downgrade is to dump all InnoDB tables and recreate\n"
+"InnoDB: the whole tablespace.\n");
+
+ trx_sys_downgrading_from_4_1_1 = TRUE;
+ }
+
trx_doublewrite_init(doublewrite);
block1 = trx_doublewrite->block1;