Commit 72195137 authored by unknown's avatar unknown

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
parent b703338d
......@@ -2622,6 +2622,14 @@ ibuf_merge_or_delete_for_page(
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);
......
......@@ -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[];
......
......@@ -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
......
......@@ -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");
......
......@@ -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 @@ trx_sys_create_doublewrite_buf(void)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment