diff options
author | unknown <heikki@hundin.mysql.fi> | 2004-01-06 13:40:14 +0200 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2004-01-06 13:40:14 +0200 |
commit | 7219513743ec021216f8ad81dc8e80607d431769 (patch) | |
tree | d2e3115611693d6885f2fc3d1bca9a6a401f66e0 | |
parent | b703338d76e40859ae39b669816eba768d0f7ed7 (diff) | |
download | mariadb-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
-rw-r--r-- | innobase/ibuf/ibuf0ibuf.c | 8 | ||||
-rw-r--r-- | innobase/include/srv0srv.h | 2 | ||||
-rw-r--r-- | innobase/include/trx0sys.h | 18 | ||||
-rw-r--r-- | innobase/srv/srv0start.c | 25 | ||||
-rw-r--r-- | innobase/trx/trx0sys.c | 88 |
5 files changed, 140 insertions, 1 deletions
diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c index c07756ab308..7c31ca7c320 100644 --- a/innobase/ibuf/ibuf0ibuf.c +++ b/innobase/ibuf/ibuf0ibuf.c @@ -2622,6 +2622,14 @@ loop: goto reset_bit; } + /* Do NOT merge to the 4.1 code base! */ + if (trx_sys_downgrading_from_4_1_1) { + fprintf(stderr, +"InnoDB: Fatal error: you are downgrading from >= 4.1.1 to 4.0, but\n" +"InnoDB: the insert buffer was not empty.\n"); + ut_a(0); + } + if (corruption_noticed) { rec_sprintf(err_buf, 450, ibuf_rec); diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index 87df3904f19..02d3d3bba0a 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -17,6 +17,8 @@ Created 10/10/1995 Heikki Tuuri #include "que0types.h" #include "trx0types.h" +extern char* srv_main_thread_op_info; + /* Buffer which can be used in printing fatal error messages */ extern char srv_fatal_errbuf[]; diff --git a/innobase/include/trx0sys.h b/innobase/include/trx0sys.h index a54a6424a4f..a8ed675a8a5 100644 --- a/innobase/include/trx0sys.h +++ b/innobase/include/trx0sys.h @@ -24,6 +24,18 @@ Created 3/26/1996 Heikki Tuuri #include "fsp0fsp.h" #include "read0types.h" +/* Do NOT merge this to the 4.1 code base! */ +extern ibool trx_sys_downgrading_from_4_1_1; + +/******************************************************************** +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); +/*====================================*/ + /* In a MySQL replication slave, in crash recovery we store the master log file name and position here. We have successfully got the updates to InnoDB up to this position. If .._pos is -1, it means no crash recovery was needed, @@ -354,8 +366,14 @@ this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */ sys header is half-written to disk, we still may be able to recover the information */ +#define TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED (24 + FSEG_HEADER_SIZE) + /* If this is set to + .._N, then we are + DOWNGRADING from >= 4.1.1 to + 4.0 */ /*-------------------------------------------------------------*/ #define TRX_SYS_DOUBLEWRITE_MAGIC_N 536853855 +#define TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N 1783657386 #define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index af4ca71d443..8ff2076d5d1 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -1479,6 +1479,31 @@ NetWare. */ os_fast_mutex_free(&srv_os_test_mutex); + /***********************************************************/ + /* Do NOT merge to the 4.1 code base! */ + if (trx_sys_downgrading_from_4_1_1) { + fprintf(stderr, +"InnoDB: You are downgrading from an InnoDB version which allows multiple\n" +"InnoDB: tablespaces. Wait that purge and insert buffer merge run to\n" +"InnoDB: completion...\n"); + for (;;) { + os_thread_sleep(10000000); + + if (0 == strcmp(srv_main_thread_op_info, + "waiting for server activity")) { + break; + } + } + fprintf(stderr, +"InnoDB: Full purge and insert buffer merge completed.\n"); + + trx_sys_mark_downgraded_from_4_1_1(); + + fprintf(stderr, +"InnoDB: Downgraded from >= 4.1.1 to 4.0\n"); + } + /***********************************************************/ + if (srv_print_verbose_log) { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Started\n"); 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; |