List:Commits« Previous MessageNext Message »
From:kevin.lewis Date:March 7 2013 5:30pm
Subject:bzr push into mysql-trunk branch (kevin.lewis:5247)
View as plain text  
 5247 kevin.lewis@stripped	2013-03-07 [merge]
      merge 16410616

    modified:
      mysql-test/extra/binlog_tests/binlog_mysqlbinlog_row.inc
      mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row.result
      mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
      mysql-test/suite/binlog/t/binlog_gtid_mysqlbinlog_row.test
      mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
=== modified file 'storage/innobase/api/api0misc.cc'
--- a/storage/innobase/api/api0misc.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/api/api0misc.cc	revid:kevin.lewis@stripped
@@ -185,7 +185,7 @@ handle_new_error:
 
 	case DB_MUST_GET_MORE_FILE_SPACE:
 
-                exit(1);
+		ut_error;
 
 	case DB_CORRUPTION:
 	case DB_FOREIGN_EXCEED_MAX_CASCADE:

=== modified file 'storage/innobase/btr/btr0btr.cc'
--- a/storage/innobase/btr/btr0btr.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/btr/btr0btr.cc	revid:kevin.lewis@stripped
@@ -1445,15 +1445,12 @@ btr_page_get_father_node_ptr_func(
 					  ULINT_UNDEFINED, &heap);
 		page_rec_print(node_ptr, offsets);
 
-		fputs("InnoDB: You should dump + drop + reimport the table"
-		      " to fix the\n"
-		      "InnoDB: corruption. If the crash happens at "
-		      "the database startup, see\n"
-		      "InnoDB: " REFMAN "forcing-innodb-recovery.html about\n"
-		      "InnoDB: forcing recovery. "
-		      "Then dump + drop + reimport.\n", stderr);
-
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"You should dump + drop + reimport the table to"
+			" fix the corruption. If the crash happens at"
+			" database startup, see " REFMAN
+			"forcing-innodb-recovery.html about forcing"
+			" recovery. Then dump + drop + reimport.");
 	}
 
 	return(offsets);

=== modified file 'storage/innobase/btr/btr0cur.cc'
--- a/storage/innobase/btr/btr0cur.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/btr/btr0cur.cc	revid:kevin.lewis@stripped
@@ -4881,12 +4881,11 @@ btr_check_blob_fil_page_type(
 #endif /* !UNIV_DEBUG */
 
 		ut_print_timestamp(stderr);
-		fprintf(stderr,
-			"  InnoDB: FIL_PAGE_TYPE=%lu"
-			" on BLOB %s space %lu page %lu flags %lx\n",
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"FIL_PAGE_TYPE=%lu on BLOB %s space %lu"
+			" page %lu flags %lx",
 			(ulong) type, read ? "read" : "purge",
 			(ulong) space_id, (ulong) page_no, (ulong) flags);
-		ut_error;
 	}
 }
 

=== modified file 'storage/innobase/buf/buf0buf.cc'
--- a/storage/innobase/buf/buf0buf.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/buf/buf0buf.cc	revid:kevin.lewis@stripped
@@ -2547,23 +2547,17 @@ loop:
 				retries = BUF_PAGE_READ_MAX_RETRIES;
 			);
 		} else {
-			fprintf(stderr, "InnoDB: Error: Unable"
-				" to read tablespace %lu page no"
-				" %lu into the buffer pool after"
-				" %lu attempts\n"
-				"InnoDB: The most probable cause"
-				" of this error may be that the"
-				" table has been corrupted.\n"
-				"InnoDB: You can try to fix this"
-				" problem by using"
-				" innodb_force_recovery.\n"
-				"InnoDB: Please see reference manual"
-				" for more details.\n"
-				"InnoDB: Aborting...\n",
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Unable to read tablespace %lu page no %lu"
+				" into the buffer pool after %lu attempts."
+				" The most probable cause of this error may"
+				" be that the table has been corrupted."
+				" You can try to fix this problem by using"
+				" innodb_force_recovery."
+				" Please see reference manual for more"
+				" details.   Aborting...",
 				space, offset,
 				BUF_PAGE_READ_MAX_RETRIES);
-
-			ut_error;
 		}
 
 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
@@ -4061,11 +4055,9 @@ corrupt:
 				    && buf_mark_space_corrupt(bpage)) {
 					return(false);
 				} else {
-					fputs("InnoDB: Ending processing"
-					      " because of"
-					      " a corrupt database page.\n",
-					      stderr);
-					ut_error;
+					ib_logf(IB_LOG_LEVEL_FATAL,
+						"Aborting because of a"
+						" corrupt database page.");
 				}
 			}
 		}
@@ -4181,11 +4173,10 @@ buf_all_freed_instance(
 		const buf_block_t* block = buf_chunk_not_freed(chunk);
 
 		if (UNIV_LIKELY_NULL(block)) {
-			fprintf(stderr,
-				"Page %lu %lu still fixed or dirty\n",
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Page %lu %lu still fixed or dirty",
 				(ulong) block->page.space,
 				(ulong) block->page.offset);
-			ut_error;
 		}
 	}
 
@@ -4483,18 +4474,19 @@ assert_s_latched:
 	mutex_exit(&buf_pool->zip_mutex);
 
 	if (n_lru + n_free > buf_pool->curr_size + n_zip) {
-		fprintf(stderr, "n LRU %lu, n free %lu, pool %lu zip %lu\n",
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"n_LRU %lu, n_free %lu, pool %lu zip %lu"
+			" Aborting...",
 			(ulong) n_lru, (ulong) n_free,
 			(ulong) buf_pool->curr_size, (ulong) n_zip);
-		ut_error;
 	}
 
 	ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
 	if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
-		fprintf(stderr, "Free list len %lu, free blocks %lu\n",
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"Free list len %lu, free blocks %lu  Aborting...",
 			(ulong) UT_LIST_GET_LEN(buf_pool->free),
 			(ulong) n_free);
-		ut_error;
 	}
 
 	ut_a(buf_pool->n_flush[BUF_FLUSH_LIST] == n_list_flush);

=== modified file 'storage/innobase/buf/buf0dblwr.cc'
--- a/storage/innobase/buf/buf0dblwr.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/buf/buf0dblwr.cc	revid:kevin.lewis@stripped
@@ -156,9 +156,10 @@ buf_dblwr_init(
 
 /****************************************************************//**
 Creates the doublewrite buffer to a new InnoDB installation. The header of the
-doublewrite buffer is placed on the trx system header page. */
-UNIV_INTERN
-void
+doublewrite buffer is placed on the trx system header page.
+@return true if successful, false if not. */
+UNIV_INTERN __attribute__((warn_unused_result))
+bool
 buf_dblwr_create(void)
 /*==================*/
 {
@@ -174,7 +175,7 @@ buf_dblwr_create(void)
 	if (buf_dblwr) {
 		/* Already inited */
 
-		return;
+		return(true);
 	}
 
 start_again:
@@ -192,23 +193,23 @@ start_again:
 
 		mtr_commit(&mtr);
 		buf_dblwr_being_created = FALSE;
-		return;
+		return(true);
 	}
 
 	ib_logf(IB_LOG_LEVEL_INFO,
 		"Doublewrite buffer not found: creating new");
-
-	if (buf_pool_get_curr_size()
-	    < ((2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
-		+ FSP_EXTENT_SIZE / 2 + 100)
-	       * UNIV_PAGE_SIZE)) {
-
+	ulint min_doublewrite_size = 
+		( ( 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+		  + FSP_EXTENT_SIZE / 2
+		  + 100)
+		* UNIV_PAGE_SIZE);
+	if (buf_pool_get_curr_size() <  min_doublewrite_size) {
 		ib_logf(IB_LOG_LEVEL_ERROR,
 			"Cannot create doublewrite buffer: you must "
 			"increase your buffer pool size. Cannot continue "
 			"operation.");
 
-		exit(EXIT_FAILURE);
+		return(false);
 	}
 
 	block2 = fseg_create(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
@@ -229,7 +230,7 @@ start_again:
 		/* We exit without committing the mtr to prevent
 		its modifications to the database getting to disk */
 
-		exit(EXIT_FAILURE);
+		return(false);
 	}
 
 	fseg_header = doublewrite + TRX_SYS_DOUBLEWRITE_FSEG;
@@ -245,7 +246,7 @@ start_again:
 				"increase your tablespace size. "
 				"Cannot continue operation.");
 
-			exit(EXIT_FAILURE);
+			return(false);
 		}
 
 		/* We read the allocated pages to the buffer pool;
@@ -506,19 +507,13 @@ buf_dblwr_init_or_restore_pages(
 						page, zip_size,
 						BUF_PAGE_PRINT_NO_CRASH);
 
-					fprintf(stderr,
-						"InnoDB: Also the page in the"
-						" doublewrite buffer"
-						" is corrupt.\n"
-						"InnoDB: Cannot continue"
-						" operation.\n"
-						"InnoDB: You can try to"
-						" recover the database"
-						" with the my.cnf\n"
-						"InnoDB: option:\n"
-						"InnoDB:"
-						" innodb_force_recovery=6\n");
-					ut_error;
+					ib_logf(IB_LOG_LEVEL_FATAL,
+						"The page in the doublewrite"
+						" buffer is corrupt. Cannot"
+						" continue operation. You"
+						" can try to recover the"
+						" database with"
+						" innodb_force_recovery=6");
 				}
 
 				/* Write the good page from the
@@ -646,18 +641,13 @@ buf_dblwr_assert_on_corrupt_block(
 	buf_page_print(block->frame, 0, BUF_PAGE_PRINT_NO_CRASH);
 
 	ut_print_timestamp(stderr);
-	fprintf(stderr,
-		"  InnoDB: Apparent corruption of an"
-		" index page n:o %lu in space %lu\n"
-		"InnoDB: to be written to data file."
-		" We intentionally crash server\n"
-		"InnoDB: to prevent corrupt data"
-		" from ending up in data\n"
-		"InnoDB: files.\n",
+	ib_logf(IB_LOG_LEVEL_FATAL,
+		"Apparent corruption of an index page n:o %lu in space"
+		" %lu to be written to data file. We intentionally crash"
+		" the server to prevent corrupt data from ending up in"
+		" data files.",
 		(ulong) buf_block_get_page_no(block),
 		(ulong) buf_block_get_space(block));
-
-	ut_error;
 }
 
 /********************************************************************//**

=== modified file 'storage/innobase/buf/buf0lru.cc'
--- a/storage/innobase/buf/buf0lru.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/buf/buf0lru.cc	revid:kevin.lewis@stripped
@@ -1138,24 +1138,17 @@ buf_LRU_check_size_of_non_data_objects(
 	if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
 	    + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->curr_size / 20) {
 		ut_print_timestamp(stderr);
-
-		fprintf(stderr,
-			"  InnoDB: ERROR: over 95 percent of the buffer pool"
-			" is occupied by\n"
-			"InnoDB: lock heaps or the adaptive hash index!"
-			" Check that your\n"
-			"InnoDB: transactions do not set too many row locks.\n"
-			"InnoDB: Your buffer pool size is %lu MB."
-			" Maybe you should make\n"
-			"InnoDB: the buffer pool bigger?\n"
-			"InnoDB: We intentionally generate a seg fault"
-			" to print a stack trace\n"
-			"InnoDB: on Linux!\n",
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"Over 95 percent of the buffer pool is occupied by"
+			" lock heaps or the adaptive hash index!"
+			" Check that your transactions do not set too many"
+			" row locks. Your buffer pool size is %lu MB."
+			" Maybe you should make the buffer pool bigger?"
+			" We intentionally generate a seg fault to print"
+			" a stack trace on Linux!",
 			(ulong) (buf_pool->curr_size
 				 / (1024 * 1024 / UNIV_PAGE_SIZE)));
 
-		ut_error;
-
 	} else if (!recv_recovery_on
 		   && (UT_LIST_GET_LEN(buf_pool->free)
 		       + UT_LIST_GET_LEN(buf_pool->LRU))

=== modified file 'storage/innobase/data/data0data.cc'
--- a/storage/innobase/data/data0data.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/data/data0data.cc	revid:kevin.lewis@stripped
@@ -123,8 +123,8 @@ dfield_check_typed_no_assert(
 	if (dfield_get_type(field)->mtype > DATA_MTYPE_CURRENT_MAX
 	    || dfield_get_type(field)->mtype < DATA_MTYPE_CURRENT_MIN) {
 
-		fprintf(stderr,
-			"InnoDB: Error: data field type %lu, len %lu\n",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"data field type %lu, len %lu",
 			(ulong) dfield_get_type(field)->mtype,
 			(ulong) dfield_get_len(field));
 		return(FALSE);
@@ -183,12 +183,10 @@ dfield_check_typed(
 	if (dfield_get_type(field)->mtype > DATA_MTYPE_CURRENT_MAX
 	    || dfield_get_type(field)->mtype < DATA_MTYPE_CURRENT_MIN) {
 
-		fprintf(stderr,
-			"InnoDB: Error: data field type %lu, len %lu\n",
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"data field type %lu, len %lu",
 			(ulong) dfield_get_type(field)->mtype,
 			(ulong) dfield_get_len(field));
-
-		ut_error;
 	}
 
 	return(TRUE);

=== modified file 'storage/innobase/dict/dict0dict.cc'
--- a/storage/innobase/dict/dict0dict.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/dict/dict0dict.cc	revid:kevin.lewis@stripped
@@ -1414,10 +1414,9 @@ dict_table_rename_in_cache(
 		memcpy(old_name, table->name, strlen(table->name) + 1);
 	} else {
 		ut_print_timestamp(stderr);
-		fprintf(stderr, "InnoDB: too long table name: '%s', "
-			"max length is %d\n", table->name,
-			MAX_FULL_NAME_LEN);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"Too long table name: '%s', max length is %d",
+			table->name, MAX_FULL_NAME_LEN);
 	}
 
 	fold = ut_fold_string(new_name);

=== modified file 'storage/innobase/dict/dict0load.cc'
--- a/storage/innobase/dict/dict0load.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/dict/dict0load.cc	revid:kevin.lewis@stripped
@@ -1349,8 +1349,7 @@ dict_load_columns(
 					       &name, rec);
 
 		if (err_msg) {
-			fprintf(stderr, "InnoDB: %s\n", err_msg);
-			ut_error;
+			ib_logf(IB_LOG_LEVEL_FATAL, "%s", err_msg);
 		}
 
 		/* Note: Currently we have one DOC_ID column that is
@@ -2669,20 +2668,18 @@ dict_load_foreign_cols(
 				rec, DICT_FLD__SYS_FOREIGN_COLS__REF_COL_NAME,
 				&ref_col_name_len);
 
-			ib_logf(IB_LOG_LEVEL_ERROR,
-				"Unable to load columns names for foreign "
-				"key '%s' because it was not found in "
-				"InnoDB internal table SYS_FOREIGN_COLS. The "
-				"closest entry we found is: "
-				"(ID='%.*s', POS=%lu, FOR_COL_NAME='%.*s', "
-				"REF_COL_NAME='%.*s')",
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Unable to load column names for foreign"
+				" key '%s' because it was not found in"
+				" InnoDB internal table SYS_FOREIGN_COLS. The"
+				" closest entry we found is:"
+				" (ID='%.*s', POS=%lu, FOR_COL_NAME='%.*s',"
+				" REF_COL_NAME='%.*s')",
 				foreign->id,
 				(int) len, field,
 				mach_read_from_4(pos),
 				(int) for_col_name_len, for_col_name,
 				(int) ref_col_name_len, ref_col_name);
-
-			ut_error;
 		}
 
 		field = rec_get_nth_field_old(

=== modified file 'storage/innobase/dict/dict0stats.cc'
--- a/storage/innobase/dict/dict0stats.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/dict/dict0stats.cc	revid:kevin.lewis@stripped
@@ -2344,7 +2344,7 @@ dict_stats_save(
 			ut_snprintf(stat_name, sizeof(stat_name),
 				    "n_diff_pfx%02lu", i + 1);
 
-			/* craft a string that contains the columns names */
+			/* craft a string that contains the column names */
 			ut_snprintf(stat_description,
 				    sizeof(stat_description),
 				    "%s", index->fields[0].name);

=== modified file 'storage/innobase/fil/fil0fil.cc'
--- a/storage/innobase/fil/fil0fil.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/fil/fil0fil.cc	revid:kevin.lewis@stripped
@@ -786,46 +786,36 @@ fil_node_open_file(
 		os_file_close(node->handle);
 
 		if (UNIV_UNLIKELY(space_id != space->id)) {
-			fprintf(stderr,
-				"InnoDB: Error: tablespace id is %lu"
-				" in the data dictionary\n"
-				"InnoDB: but in file %s it is %lu!\n",
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Tablespace id is %lu in the data"
+				" dictionary but in file %s it is %lu!",
 				space->id, node->name, space_id);
-
-			ut_error;
 		}
 
 		if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
 				  || space_id == 0)) {
-			fprintf(stderr,
-				"InnoDB: Error: tablespace id %lu"
-				" in file %s is not sensible\n",
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Tablespace id %lu in file %s"
+				" is not sensible",
 				(ulong) space_id, node->name);
-
-			ut_error;
 		}
 
 		if (UNIV_UNLIKELY(fsp_flags_get_page_size(space->flags)
 				  != page_size)) {
-			fprintf(stderr,
-				"InnoDB: Error: tablespace file %s"
-				" has page size 0x%lx\n"
-				"InnoDB: but the data dictionary"
-				" expects page size 0x%lx!\n",
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Error: Tablespace file %s has page size"
+				" 0x%lx but the data dictionary expects"
+				" page size 0x%lx!",
 				node->name, flags,
 				fsp_flags_get_page_size(space->flags));
-
-			ut_error;
 		}
 
 		if (UNIV_UNLIKELY(space->flags != flags)) {
-			fprintf(stderr,
-				"InnoDB: Error: table flags are 0x%lx"
-				" in the data dictionary\n"
-				"InnoDB: but the flags in file %s are 0x%lx!\n",
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Error: table flags are 0x%lx in the"
+				" data dictionary but the flags in file"
+				" %s are 0x%lx!",
 				space->flags, node->name, flags);
-
-			ut_error;
 		}
 
 		if (size_bytes >= 1024 * 1024) {
@@ -1802,10 +1792,9 @@ fil_set_max_space_id_if_bigger(
 	ulint	max_id)	/*!< in: maximum known id */
 {
 	if (max_id >= SRV_LOG_SPACE_FIRST_ID) {
-		fprintf(stderr,
-			"InnoDB: Fatal error: max tablespace id"
-			" is too high, %lu\n", (ulong) max_id);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"Fatal error: max tablespace id"
+			" is too high, %lu", (ulong) max_id);
 	}
 
 	mutex_enter(&fil_system->mutex);
@@ -4028,10 +4017,7 @@ will_not_choose:
 			return;
 		}
 
-		/* If debug code, cause a core dump and call stack. For
-		release builds just exit and rely on the messages above. */
-		ut_ad(0);
-		exit(1);
+		ut_error;
 	}
 
 	if (def.success && remote.success) {

=== modified file 'storage/innobase/fsp/fsp0fsp.cc'
--- a/storage/innobase/fsp/fsp0fsp.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/fsp/fsp0fsp.cc	revid:kevin.lewis@stripped
@@ -3120,20 +3120,16 @@ fseg_free_page_low(
 		      stderr);
 		ut_print_buf(stderr, descr, 40);
 
-		fprintf(stderr, "\n"
-			"InnoDB: Serious error! InnoDB is trying to"
-			" free page %lu\n"
-			"InnoDB: though it is already marked as free"
-			" in the tablespace!\n"
-			"InnoDB: The tablespace free space info is corrupt.\n"
-			"InnoDB: You may need to dump your"
-			" InnoDB tables and recreate the whole\n"
-			"InnoDB: database!\n", (ulong) page);
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Fatal Error! InnoDB is trying to free page %lu"
+			" though it is already marked as free in the"
+			" tablespace! The tablespace free space info is"
+			" corrupt. You may need to dump your tables and"
+			" recreate the whole database!", (ulong) page);
 crash:
-		fputs("InnoDB: Please refer to\n"
-		      "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
-		      "InnoDB: about forcing recovery.\n", stderr);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"Please refer to " REFMAN "forcing-innodb-recovery.html"
+			" about forcing recovery.");
 	}
 
 	state = xdes_get_state(descr, mtr);

=== modified file 'storage/innobase/fts/fts0blex.cc'
--- a/storage/innobase/fts/fts0blex.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/fts/fts0blex.cc	revid:kevin.lewis@stripped
@@ -479,7 +479,7 @@ this program; if not, write to the Free 
 
 /* Required for reentrant parser */
 #define YY_DECL int fts_blexer(YYSTYPE* val, yyscan_t yyscanner)
-
+#define exit(A)   ut_error
 #define YY_NO_INPUT 1
 #line 484 "fts0blex.cc"
 

=== modified file 'storage/innobase/fts/fts0blex.l'
--- a/storage/innobase/fts/fts0blex.l	revid:nuno.carvalho@stripped
+++ b/storage/innobase/fts/fts0blex.l	revid:kevin.lewis@stripped
@@ -30,6 +30,7 @@ this program; if not, write to the Free 
 
 /* Required for reentrant parser */
 #define YY_DECL int fts_blexer(YYSTYPE* val, yyscan_t yyscanner)
+#define exit(A)   ut_error
 
 %}
 

=== modified file 'storage/innobase/fts/fts0fts.cc'
--- a/storage/innobase/fts/fts0fts.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/fts/fts0fts.cc	revid:kevin.lewis@stripped
@@ -5920,8 +5920,7 @@ fts_drop_orphaned_tables(void)
 	error = fil_get_space_names(space_name_list);
 
 	if (error == DB_OUT_OF_MEMORY) {
-		ib_logf(IB_LOG_LEVEL_ERROR, "Out of memory");
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Out of memory");
 	}
 
 	heap = mem_heap_create(1024);

=== modified file 'storage/innobase/fts/fts0tlex.cc'
--- a/storage/innobase/fts/fts0tlex.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/fts/fts0tlex.cc	revid:kevin.lewis@stripped
@@ -475,7 +475,7 @@ this program; if not, write to the Free 
 
 /* Required for reentrant parser */
 #define YY_DECL int fts_tlexer(YYSTYPE* val, yyscan_t yyscanner)
-
+#define exit(A)   ut_error
 #define YY_NO_INPUT 1
 #line 480 "fts0tlex.cc"
 

=== modified file 'storage/innobase/fts/fts0tlex.l'
--- a/storage/innobase/fts/fts0tlex.l	revid:nuno.carvalho@stripped
+++ b/storage/innobase/fts/fts0tlex.l	revid:kevin.lewis@stripped
@@ -30,6 +30,7 @@ this program; if not, write to the Free 
 
 /* Required for reentrant parser */
 #define YY_DECL int fts_tlexer(YYSTYPE* val, yyscan_t yyscanner)
+#define exit(A)   ut_error
 
 %}
 

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/handler/ha_innodb.cc	revid:kevin.lewis@stripped
@@ -6371,16 +6371,14 @@ ha_innobase::write_row(
 		ib_senderrf(ha_thd(), IB_LOG_LEVEL_WARN, ER_READ_ONLY_MODE);
 		DBUG_RETURN(HA_ERR_TABLE_READONLY);
 	} else if (prebuilt->trx != trx) {
-		sql_print_error("The transaction object for the table handle "
-				"is at %p, but for the current thread it is at "
-				"%p",
-				(const void*) prebuilt->trx, (const void*) trx);
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"The transaction object for the table handle is"
+			"at %p, but for the current thread it is at %p",
+			(const void*) prebuilt->trx, (const void*) trx);
 
 		fputs("InnoDB: Dump of 200 bytes around prebuilt: ", stderr);
 		ut_print_buf(stderr, ((const byte*) prebuilt) - 100, 200);
-		fputs("\n"
-			"InnoDB: Dump of 200 bytes around ha_data: ",
-			stderr);
+		fputs("\nInnoDB: Dump of 200 bytes around ha_data: ", stderr);
 		ut_print_buf(stderr, ((const byte*) trx) - 100, 200);
 		putc('\n', stderr);
 		ut_error;
@@ -16703,7 +16701,7 @@ ib_logf(
 		sql_print_error("InnoDB: %s", str);
 		break;
 	case IB_LOG_LEVEL_FATAL:
-		sql_print_error("InnoDB: %s", str);
+		sql_print_error("[FATAL] InnoDB: %s", str);
 		break;
 	}
 

=== modified file 'storage/innobase/ibuf/ibuf0ibuf.cc'
--- a/storage/innobase/ibuf/ibuf0ibuf.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc	revid:kevin.lewis@stripped
@@ -231,14 +231,13 @@ ibuf_count_check(
 		return;
 	}
 
-	fprintf(stderr,
-		"InnoDB: UNIV_IBUF_COUNT_DEBUG limits space_id and page_no\n"
-		"InnoDB: and breaks crash recovery.\n"
-		"InnoDB: space_id=%lu, should be 0<=space_id<%lu\n"
-		"InnoDB: page_no=%lu, should be 0<=page_no<%lu\n",
+	ib_logf(IB_LOG_LEVEL_FATAL,
+		"UNIV_IBUF_COUNT_DEBUG limits space_id and page_no"
+		" and breaks crash recovery."
+		"\nInnoDB: space_id=%lu, should be 0<=space_id<%lu"
+		"\nInnoDB: page_no=%lu, should be 0<=page_no<%lu",
 		(ulint) space_id, (ulint) IBUF_COUNT_N_SPACES,
 		(ulint) page_no, (ulint) IBUF_COUNT_N_PAGES);
-	ut_error;
 }
 #endif
 
@@ -4371,14 +4370,13 @@ ibuf_restore_pos(
 
 		ibuf_btr_pcur_commit_specify_mtr(pcur, mtr);
 
-		fputs("InnoDB: Validating insert buffer tree:\n", stderr);
+		ib_logf(IB_LOG_LEVEL_INFO, "Validating insert buffer tree:");
 		if (!btr_validate_index(ibuf->index, 0)) {
 			ut_error;
 		}
+		ib_logf(IB_LOG_LEVEL_INFO, "ibuf tree is OK.");
 
-		fprintf(stderr, "InnoDB: ibuf tree ok\n");
-		fflush(stderr);
-		ut_ad(0);
+		ib_logf(IB_LOG_LEVEL_FATAL, "Failed to restore ibuf position.");
 	}
 
 	return(FALSE);

=== modified file 'storage/innobase/include/buf0dblwr.h'
--- a/storage/innobase/include/buf0dblwr.h	revid:nuno.carvalho@stripped
+++ b/storage/innobase/include/buf0dblwr.h	revid:kevin.lewis@stripped
@@ -39,9 +39,10 @@ extern ibool		buf_dblwr_being_created;
 
 /****************************************************************//**
 Creates the doublewrite buffer to a new InnoDB installation. The header of the
-doublewrite buffer is placed on the trx system header page. */
-UNIV_INTERN
-void
+doublewrite buffer is placed on the trx system header page.
+@return true if successful, false if not. */
+UNIV_INTERN __attribute__((warn_unused_result))
+bool
 buf_dblwr_create(void);
 /*==================*/
 /****************************************************************//**

=== modified file 'storage/innobase/include/dict0dict.h'
--- a/storage/innobase/include/dict0dict.h	revid:nuno.carvalho@stripped
+++ b/storage/innobase/include/dict0dict.h	revid:kevin.lewis@stripped
@@ -1599,7 +1599,7 @@ struct dict_col_meta_t {
 };
 
 /* This struct is used for checking whether a given table exists and
-whether it has a predefined schema (number of columns and columns names
+whether it has a predefined schema (number of columns and column names
 and types) */
 struct dict_table_schema_t {
 	const char*		table_name;	/* the name of the table whose

=== modified file 'storage/innobase/include/log0log.h'
--- a/storage/innobase/include/log0log.h	revid:nuno.carvalho@stripped
+++ b/storage/innobase/include/log0log.h	revid:kevin.lewis@stripped
@@ -169,9 +169,10 @@ void
 log_init(void);
 /*==========*/
 /******************************************************************//**
-Inits a log group to the log system. */
-UNIV_INTERN
-void
+Inits a log group to the log system.
+@return true if success, false if not */
+UNIV_INTERN __attribute__((warn_unused_result))
+bool
 log_group_init(
 /*===========*/
 	ulint	id,			/*!< in: group id */

=== modified file 'storage/innobase/include/srv0space.h'
--- a/storage/innobase/include/srv0space.h	revid:nuno.carvalho@stripped
+++ b/storage/innobase/include/srv0space.h	revid:kevin.lewis@stripped
@@ -262,7 +262,7 @@ public:
 		size in bytes
 	@return DB_SUCCESS if all OK else error code */
 	dberr_t check_file_spec(
-		ibool*	create_new_db,
+		bool*	create_new_db,
 		ulint	min_expected_tablespace_size);
 
 	/**
@@ -398,7 +398,7 @@ private:
 	@param file - data file spec
 	@param create_new_db - [out] true if a new instances to be created
 	@return DB_SUCESS or error code */
-	dberr_t file_not_found(file_t& file, ibool* create_new_db);
+	dberr_t file_not_found(file_t& file, bool* create_new_db);
 
 	/**
 	Note that the data file was found.

=== modified file 'storage/innobase/include/ut0dbg.h'
--- a/storage/innobase/include/ut0dbg.h	revid:nuno.carvalho@stripped
+++ b/storage/innobase/include/ut0dbg.h	revid:kevin.lewis@stripped
@@ -62,7 +62,10 @@ ut_dbg_assertion_failed(
 	UNIV_COLD __attribute__((nonnull(2)));
 
 /** Abort the execution. */
-# define UT_DBG_PANIC abort()
+# define UT_DBG_PANIC do {					\
+	fflush(stderr);						\
+	abort();						\
+} while (0)
 
 /** Abort execution if EXPR does not evaluate to nonzero.
 @param EXPR	assertion expression that should hold */

=== modified file 'storage/innobase/lock/lock0lock.cc'
--- a/storage/innobase/lock/lock0lock.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/lock/lock0lock.cc	revid:kevin.lewis@stripped
@@ -3026,11 +3026,10 @@ lock_move_reorganize_page(
 
 			/* Check that all locks were moved. */
 			if (UNIV_UNLIKELY(i != ULINT_UNDEFINED)) {
-				fprintf(stderr,
+				ib_logf(IB_LOG_LEVEL_FATAL,
 					"lock_move_reorganize_page():"
-					" %lu not moved in %p\n",
+					" %lu not moved in %p",
 					(ulong) i, (void*) lock);
-				ut_error;
 			}
 		}
 #endif /* UNIV_DEBUG */
@@ -3225,11 +3224,10 @@ lock_move_rec_list_start(
 				if (UNIV_UNLIKELY
 				    (lock_rec_get_nth_bit(lock, i))) {
 
-					fprintf(stderr,
+					ib_logf(IB_LOG_LEVEL_FATAL,
 						"lock_move_rec_list_start():"
-						" %lu not moved in %p\n",
+						" %lu not moved in %p",
 						(ulong) i, (void*) lock);
-					ut_error;
 				}
 			}
 		}

=== modified file 'storage/innobase/lock/lock0wait.cc'
--- a/storage/innobase/lock/lock0wait.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/lock/lock0wait.cc	revid:kevin.lewis@stripped
@@ -170,13 +170,12 @@ lock_wait_table_reserve_slot(
 
 	ut_print_timestamp(stderr);
 
-	fprintf(stderr,
-		"  InnoDB: There appear to be %lu user"
-		" threads currently waiting\n"
-		"InnoDB: inside InnoDB, which is the"
-		" upper limit. Cannot continue operation.\n"
-		"InnoDB: As a last thing, we print"
-		" a list of waiting threads.\n", (ulong) OS_THREAD_MAX_N);
+	ib_logf(IB_LOG_LEVEL_ERROR,
+		"There appear to be %lu user threads currently waiting"
+		" inside InnoDB, which is the upper limit."
+		" Cannot continue operation."
+		" Before aborting, we print a list of waiting threads.",
+		(ulong) OS_THREAD_MAX_N);
 
 	lock_wait_table_print();
 

=== modified file 'storage/innobase/log/log0log.cc'
--- a/storage/innobase/log/log0log.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/log/log0log.cc	revid:kevin.lewis@stripped
@@ -343,16 +343,13 @@ log_close(void)
 			log_last_warning_time = time(NULL);
 
 			ut_print_timestamp(stderr);
-			fprintf(stderr,
-				" InnoDB: ERROR: the age of the last"
-				" checkpoint is " LSN_PF ",\n"
-				"InnoDB: which exceeds the log group"
-				" capacity " LSN_PF ".\n"
-				"InnoDB: If you are using big"
-				" BLOB or TEXT rows, you must set the\n"
-				"InnoDB: combined size of log files"
-				" at least 10 times bigger than the\n"
-				"InnoDB: largest such row.\n",
+			ib_logf(IB_LOG_LEVEL_ERROR,
+				"The age of the last checkpoint is "
+				LSN_PF ", which exceeds the log group"
+				" capacity " LSN_PF ".  If you are using"
+				" big BLOB or TEXT rows, you must set the"
+				" combined size of log files at least 10"
+				" times bigger than the largest such row.",
 				checkpoint_age,
 				log->log_group_capacity);
 		}
@@ -542,17 +539,18 @@ log_group_set_fields(
 /*****************************************************************//**
 Calculates the recommended highest values for lsn - last_checkpoint_lsn,
 lsn - buf_get_oldest_modification(), and lsn - max_archive_lsn_age.
-@return error value FALSE if the smallest log group is too small to
+@retval true on success
+@retval false if the smallest log group is too small to
 accommodate the number of OS threads in the database server */
-static
-ibool
+static __attribute__((warn_unused_result))
+bool
 log_calc_max_ages(void)
 /*===================*/
 {
 	log_group_t*	group;
 	lsn_t		margin;
 	ulint		free;
-	ibool		success		= TRUE;
+	bool		success	= true;
 	lsn_t		smallest_capacity;
 	lsn_t		archive_margin;
 	lsn_t		smallest_archive_margin;
@@ -595,7 +593,7 @@ log_calc_max_ages(void)
 	free = LOG_CHECKPOINT_FREE_PER_THREAD * (10 + srv_thread_concurrency)
 		+ LOG_CHECKPOINT_EXTRA_FREE;
 	if (free >= smallest_capacity / 2) {
-		success = FALSE;
+		success = false;
 
 		goto failure;
 	} else {
@@ -619,24 +617,17 @@ failure:
 	mutex_exit(&(log_sys->mutex));
 
 	if (!success) {
-		fprintf(stderr,
-			"InnoDB: Error: ib_logfiles are too small"
-			" for innodb_thread_concurrency %lu.\n"
-			"InnoDB: The combined size of ib_logfiles"
-			" should be bigger than\n"
-			"InnoDB: 200 kB * innodb_thread_concurrency.\n"
-			"InnoDB: To get mysqld to start up, set"
-			" innodb_thread_concurrency in my.cnf\n"
-			"InnoDB: to a lower value, for example, to 8."
-			" After an ERROR-FREE shutdown\n"
-			"InnoDB: of mysqld you can adjust the size of"
-			" ib_logfiles, as explained in\n"
-			"InnoDB: " REFMAN "adding-and-removing.html\n"
-			"InnoDB: Cannot continue operation."
-			" Calling exit(1).\n",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Cannot continue operation.  ib_logfiles are too"
+			" small for innodb_thread_concurrency %lu. The"
+			" combined size of ib_logfiles should be bigger than"
+			" 200 kB * innodb_thread_concurrency. To get mysqld"
+			" to start up, set innodb_thread_concurrency in"
+			" my.cnf to a lower value, for example, to 8. After"
+			" an ERROR-FREE shutdown of mysqld you can adjust"
+			" the size of ib_logfiles, as explained in " REFMAN
+			"adding-and-removing.html.",
 			(ulong) srv_thread_concurrency);
-
-		exit(1);
 	}
 
 	return(success);
@@ -747,9 +738,10 @@ log_init(void)
 }
 
 /******************************************************************//**
-Inits a log group to the log system. */
-UNIV_INTERN
-void
+Inits a log group to the log system.
+@return true if success, false if not */
+UNIV_INTERN __attribute__((warn_unused_result))
+bool
 log_group_init(
 /*===========*/
 	ulint	id,			/*!< in: group id */
@@ -766,7 +758,6 @@ log_group_init(
 					used */
 {
 	ulint	i;
-
 	log_group_t*	group;
 
 	group = static_cast<log_group_t*>(mem_alloc(sizeof(log_group_t)));
@@ -803,7 +794,7 @@ log_group_init(
 
 	UT_LIST_ADD_LAST(log_groups, log_sys->log_groups, group);
 
-	ut_a(log_calc_max_ages());
+	return(log_calc_max_ages());
 }
 
 /******************************************************************//**

=== modified file 'storage/innobase/log/log0recv.cc'
--- a/storage/innobase/log/log0recv.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/log/log0recv.cc	revid:kevin.lewis@stripped
@@ -426,14 +426,11 @@ recv_sys_empty_hash(void)
 	ut_ad(mutex_own(&(recv_sys->mutex)));
 
 	if (recv_sys->n_addrs != 0) {
-		fprintf(stderr,
-			"InnoDB: Error: %lu pages with log records"
-			" were left unprocessed!\n"
-			"InnoDB: Maximum page number with"
-			" log records on it %lu\n",
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"%lu pages with log records were left unprocessed! "
+			"Maximum page number with log records on it is %lu",
 			(ulong) recv_sys->n_addrs,
 			(ulong) recv_max_parsed_page_no);
-		ut_error;
 	}
 
 	hash_table_free(recv_sys->addr_hash);
@@ -1873,12 +1870,10 @@ recv_apply_log_recs_for_backup(void)
 				&actual_size,
 				recv_addr->space, recv_addr->page_no + 1);
 			if (!success) {
-				fprintf(stderr,
-					"InnoDB: Fatal error: cannot extend"
-					" tablespace %u to hold %u pages\n",
+				ib_logf(IB_LOG_LEVEL_FATAL,
+					"Cannot extend tablespace %u"
+					" to hold %u pages",
 					recv_addr->space, recv_addr->page_no);
-
-				exit(1);
 			}
 
 			/* Read the page from the tablespace file using the
@@ -1891,7 +1886,7 @@ recv_apply_log_recs_for_backup(void)
 					       block->page.zip.data, NULL);
 				if (error == DB_SUCCESS
 				    && !buf_zip_decompress(block, TRUE)) {
-					exit(1);
+					ut_error;
 				}
 			} else {
 				error = fil_io(OS_FILE_READ, TRUE,
@@ -1902,14 +1897,11 @@ recv_apply_log_recs_for_backup(void)
 			}
 
 			if (error != DB_SUCCESS) {
-				fprintf(stderr,
-					"InnoDB: Fatal error: cannot read"
-					" from tablespace"
-					" %lu page number %lu\n",
+				ib_logf(IB_LOG_LEVEL_FATAL,
+					"Cannot read from tablespace"
+					" %lu page number %lu",
 					(ulong) recv_addr->space,
 					(ulong) recv_addr->page_no);
-
-				exit(1);
 			}
 
 			/* Apply the log records to this page */
@@ -2118,19 +2110,18 @@ recv_report_corrupt_log(
 
 #ifndef UNIV_HOTBACKUP
 	if (!srv_force_recovery) {
-		fputs("InnoDB: Set innodb_force_recovery"
-		      " to ignore this error.\n", stderr);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"Set innodb_force_recovery to ignore this error.");
 	}
 #endif /* !UNIV_HOTBACKUP */
 
-	fputs("InnoDB: WARNING: the log file may have been corrupt and it\n"
-	      "InnoDB: is possible that the log scan did not proceed\n"
-	      "InnoDB: far enough in recovery! Please run CHECK TABLE\n"
-	      "InnoDB: on your InnoDB tables to check that they are ok!\n"
-	      "InnoDB: If mysqld crashes after this recovery, look at\n"
-	      "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
-	      "InnoDB: about forcing recovery.\n", stderr);
+	ib_logf(IB_LOG_LEVEL_WARN,
+		"The log file may have been corrupt and it is possible"
+		" that the log scan did not proceed far enough in recovery!"
+		" Please run CHECK TABLE on your InnoDB tables to check"
+		" that they are ok! If mysqld crashes after this recovery,"
+		" look at " REFMAN "forcing-innodb-recovery.html"
+		" about forcing recovery.");
 
 	fflush(stderr);
 }
@@ -2249,16 +2240,13 @@ loop:
 				if (NULL == fil_op_log_parse_or_replay(
 					    body, end_ptr, type,
 					    space, page_no)) {
-					fprintf(stderr,
-						"InnoDB: Error: file op"
-						" log record of type %lu"
-						" space %lu not complete in\n"
-						"InnoDB: the replay phase."
-						" Path %s\n",
+					ib_logf(IB_LOG_LEVEL_FATAL,
+						"File op log record of type"
+						" %lu space %lu not complete"
+						" in the replay phase."
+						" Path %s",
 						(ulint) type, space,
 						(char*)(body + 2));
-
-					ut_error;
 				}
 			}
 #endif
@@ -2641,20 +2629,17 @@ recv_scan_log_recs(
 
 			if (recv_sys->len + 4 * OS_FILE_LOG_BLOCK_SIZE
 			    >= RECV_PARSING_BUF_SIZE) {
-				fprintf(stderr,
-					"InnoDB: Error: log parsing"
-					" buffer overflow."
-					" Recovery may have failed!\n");
+				ib_logf(IB_LOG_LEVEL_ERROR,
+					"Log parsing buffer overflow."
+					" Recovery may have failed!");
 
 				recv_sys->found_corrupt_log = TRUE;
 
 #ifndef UNIV_HOTBACKUP
 				if (!srv_force_recovery) {
-					fputs("InnoDB: Set"
-					      " innodb_force_recovery"
-					      " to ignore this error.\n",
-					      stderr);
-					ut_error;
+					ib_logf(IB_LOG_LEVEL_FATAL,
+						"Set innodb_force_recovery"
+						" to ignore this error.");
 				}
 #endif /* !UNIV_HOTBACKUP */
 
@@ -3289,24 +3274,21 @@ recv_reset_log_files_for_backup(
 						 OS_FILE_READ_WRITE,
 						 &success);
 		if (!success) {
-			fprintf(stderr,
-				"InnoDB: Cannot create %s. Check that"
-				" the file does not exist yet.\n", name);
-
-			exit(1);
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Cannot create %s. Check that"
+				" the file does not exist yet.", name);
 		}
 
-		fprintf(stderr,
-			"Setting log file size to %llu\n",
+		ib_logf(IB_LOG_LEVEL_INFO,
+			"Setting log file size to %llu",
 			log_file_size);
 
 		success = os_file_set_size(name, log_file, log_file_size);
 
 		if (!success) {
-			fprintf(stderr,
-				"InnoDB: Cannot set %s size to %llu\n",
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Cannot set %s size to %llu",
 				name, log_file_size);
-			exit(1);
 		}
 
 		os_file_flush(log_file);
@@ -3326,9 +3308,7 @@ recv_reset_log_files_for_backup(
 					 name, OS_FILE_OPEN,
 					 OS_FILE_READ_WRITE, &success);
 	if (!success) {
-		fprintf(stderr, "InnoDB: Cannot open %s.\n", name);
-
-		exit(1);
+		ib_logf(IB_LOG_LEVEL_FATAL, "Cannot open %s.", name);
 	}
 
 	os_file_write(name, log_file, buf, 0,

=== modified file 'storage/innobase/mem/mem0dbg.cc'
--- a/storage/innobase/mem/mem0dbg.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/mem/mem0dbg.cc	revid:kevin.lewis@stripped
@@ -397,11 +397,10 @@ mem_hash_remove(
 	}
 
 	if (node == NULL) {
-		fprintf(stderr,
+		ib_logf(IB_LOG_LEVEL_FATAL,
 			"Memory heap or buffer freed in %s line %lu"
-			" did not exist.\n",
+			" did not exist.",
 			innobase_basename(file_name), (ulong) line);
-		ut_error;
 	}
 
 	/* Remove from lists */
@@ -413,12 +412,11 @@ mem_hash_remove(
 	mem_heap_validate_or_print(node->heap, NULL, FALSE, &error, &size,
 				   NULL, NULL);
 	if (error) {
-		fprintf(stderr,
-			"Inconsistency in memory heap or"
-			" buffer n:o %lu created\n"
-			"in %s line %lu and tried to free in %s line %lu.\n"
-			"Hex dump of 400 bytes around memory heap"
-			" first block start:\n",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Inconsistency in memory heap or buffer n:o %lu"
+			" created in %s line %lu and tried to free in %s"
+			" line %lu.\nHex dump of 400 bytes around memory"
+			" heap first block start:\n",
 			node->nth_heap,
 			innobase_basename(node->file_name), (ulong) node->line,
 			innobase_basename(file_name), (ulong) line);

=== modified file 'storage/innobase/mem/mem0mem.cc'
--- a/storage/innobase/mem/mem0mem.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/mem/mem0mem.cc	revid:kevin.lewis@stripped
@@ -356,8 +356,7 @@ mem_heap_create_block(
 
 	if(!block) {
 		ib_logf(IB_LOG_LEVEL_FATAL,
-			" InnoDB: Unable to allocate memory of size %lu.\n",
-			len);
+			"Unable to allocate memory of size %lu.", len);
 	}
 	block->buf_block = buf_block;
 	block->free_block = NULL;

=== modified file 'storage/innobase/mem/mem0pool.cc'
--- a/storage/innobase/mem/mem0pool.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/mem/mem0pool.cc	revid:kevin.lewis@stripped
@@ -334,8 +334,7 @@ mem_pool_fill_free_list(
 
 	if (UNIV_UNLIKELY(UT_LIST_GET_LEN(pool->free_list[i + 1]) == 0)) {
 		mem_analyze_corruption(area);
-
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 
 	UT_LIST_REMOVE(free_list, pool->free_list[i + 1], area);
@@ -408,10 +407,9 @@ mem_area_alloc(
 	}
 
 	if (!mem_area_get_free(area)) {
-		fprintf(stderr,
-			"InnoDB: Error: Removing element from mem pool"
-			" free list %lu though the\n"
-			"InnoDB: element is not marked free!\n",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Removing element from mem pool free list %lu"
+			" though the element is not marked free!",
 			(ulong) n);
 
 		mem_analyze_corruption(area);
@@ -421,23 +419,21 @@ mem_area_alloc(
 		hex dump above */
 
 		if (mem_area_get_free(area)) {
-			fprintf(stderr,
-				"InnoDB: Probably a race condition"
-				" because now the area is marked free!\n");
+			ib_logf(IB_LOG_LEVEL_ERROR,
+				"Probably a race condition"
+				" because now the area is marked free!");
 		}
 
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_ERROR, "Aborting...");
 	}
 
 	if (UT_LIST_GET_LEN(pool->free_list[n]) == 0) {
-		fprintf(stderr,
-			"InnoDB: Error: Removing element from mem pool"
-			" free list %lu\n"
-			"InnoDB: though the list length is 0!\n",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Removing element from mem pool free list %lu"
+			" though the list length is 0!",
 			(ulong) n);
 		mem_analyze_corruption(area);
-
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 
 	ut_ad(mem_area_get_size(area) == ut_2_exp(n));
@@ -533,10 +529,9 @@ mem_area_free(
 	area = (mem_area_t*) (((byte*) ptr) - MEM_AREA_EXTRA_SIZE);
 
 	if (mem_area_get_free(area)) {
-		fprintf(stderr,
-			"InnoDB: Error: Freeing element to mem pool"
-			" free list though the\n"
-			"InnoDB: element is marked free!\n");
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Freeing element to mem pool free list though"
+			" the element is marked free!");
 
 		mem_analyze_corruption(area);
 		ut_error;
@@ -546,13 +541,12 @@ mem_area_free(
 	UNIV_MEM_FREE(ptr, size - MEM_AREA_EXTRA_SIZE);
 
 	if (size == 0) {
-		fprintf(stderr,
-			"InnoDB: Error: Mem area size is 0. Possibly a"
-			" memory overrun of the\n"
-			"InnoDB: previous allocated area!\n");
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Mem area size is 0. Possibly a memory overrun"
+			" of the previous allocated area!");
 
 		mem_analyze_corruption(area);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 
 #ifdef UNIV_LIGHT_MEM_DEBUG
@@ -563,15 +557,13 @@ mem_area_free(
 		next_size = mem_area_get_size(
 			(mem_area_t*)(((byte*) area) + size));
 		if (UNIV_UNLIKELY(!next_size || !ut_is_2pow(next_size))) {
-			fprintf(stderr,
-				"InnoDB: Error: Memory area size %lu,"
-				" next area size %lu not a power of 2!\n"
-				"InnoDB: Possibly a memory overrun of"
-				" the buffer being freed here.\n",
+			ib_logf(IB_LOG_LEVEL_ERROR,
+				"Memory area size %lu, next area size %lu"
+				" not a power of 2!  Possibly a memory"
+				" overrun of the buffer being freed here.",
 				(ulong) size, (ulong) next_size);
 			mem_analyze_corruption(area);
-
-			ut_error;
+			ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 		}
 	}
 #endif

=== modified file 'storage/innobase/os/os0file.cc'
--- a/storage/innobase/os/os0file.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/os/os0file.cc	revid:kevin.lewis@stripped
@@ -657,14 +657,10 @@ os_file_handle_error_cond_exit(
 		}
 
 		if (should_exit) {
-			ut_print_timestamp(stderr);
-			fprintf(stderr, "  InnoDB: Cannot continue "
-				"operation.\n");
-
+			ib_logf(IB_LOG_LEVEL_ERROR,
+				"Cannot continue operation.");
 			fflush(stderr);
-
-			ut_ad(0);  /* Report call stack, etc only in debug code. */
-			exit(1);
+			exit(3);
 		}
 	}
 
@@ -2742,18 +2738,13 @@ error_handling:
 #endif
 		goto try_again;
 	}
-	fprintf(stderr,
-		"InnoDB: Fatal error: cannot read from file."
-		" OS error number %lu.\n",
+	ib_logf(IB_LOG_LEVEL_FATAL,
+		"Cannot read from file. OS error number %lu.",
 #ifdef __WIN__
-		(ulong) GetLastError()
+		(ulong) GetLastError());
 #else
-		(ulong) errno
+		(ulong) errno);
 #endif
-		);
-	fflush(stderr);
-
-	ut_error;
 
 	return(FALSE);
 }
@@ -5071,10 +5062,8 @@ retry:
 
 	/* All other errors should cause a trap for now. */
 	ut_print_timestamp(stderr);
-	fprintf(stderr,
-		" InnoDB: unexpected ret_code[%d] from io_getevents()!\n",
-		ret);
-	ut_error;
+	ib_logf(IB_LOG_LEVEL_FATAL,
+		"Unexpected ret_code[%d] from io_getevents()!",	ret);
 }
 
 /**********************************************************************//**
@@ -5204,10 +5193,9 @@ found:
 		if (submit_ret < 0 ) {
 			/* Aborting in case of submit failure */
 			ib_logf(IB_LOG_LEVEL_FATAL,
-				"InnoDB: Error: Native Linux AIO"
-				" interface. io_submit() call failed"
-				" when resubmitting a partial I/O"
-				" request on the file %s.\n",
+				"Native Linux AIO interface. io_submit()"
+				" call failed when resubmitting a partial"
+				" I/O request on the file %s.",
 				slot->name);
 		} else {
 			ret = FALSE;

=== modified file 'storage/innobase/os/os0sync.cc'
--- a/storage/innobase/os/os0sync.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/os/os0sync.cc	revid:kevin.lewis@stripped
@@ -186,10 +186,11 @@ os_cond_wait_timed(
 		break;
 
 	default:
-		fprintf(stderr, "  InnoDB: pthread_cond_timedwait() returned: "
-				"%d: abstime={%lu,%lu}\n",
-				ret, (ulong) abstime->tv_sec, (ulong) abstime->tv_nsec);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"pthread_cond_timedwait() returned: %d"
+			" abstime={%lu,%lu}", ret,
+			(ulong) abstime->tv_sec,
+			(ulong) abstime->tv_nsec);
 	}
 
 	return(ret == ETIMEDOUT);

=== modified file 'storage/innobase/os/os0thread.cc'
--- a/storage/innobase/os/os0thread.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/os/os0thread.cc	revid:kevin.lewis@stripped
@@ -139,11 +139,8 @@ os_thread_create_func(
 	if (!handle) {
 		os_mutex_exit(os_sync_mutex);
 		/* If we cannot start a new thread, life has no meaning. */
-		fprintf(stderr,
-			"InnoDB: Error: CreateThread returned %d\n",
-			GetLastError());
-		ut_ad(0);
-		exit(1);
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"CreateThread returned %d", GetLastError());
 	}
 
 	std::pair<map<DWORD, HANDLE>::iterator,bool> ret;
@@ -175,11 +172,8 @@ os_thread_create_func(
 					(size_t)(PTHREAD_STACK_MIN
 						 + 32 * 1024));
 	if (ret) {
-		fprintf(stderr,
-			"InnoDB: Error: pthread_attr_setstacksize"
-			" returned %d\n", ret);
-		ut_ad(0);
-		exit(1);
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"pthread_attr_setstacksize returned %d", ret);
 	}
 #endif
 	os_mutex_enter(os_sync_mutex);
@@ -192,10 +186,8 @@ os_thread_create_func(
 	ret = pthread_create(&new_thread_id, &attr, func, arg);
 #endif
 	if (ret) {
-		fprintf(stderr,
-			"InnoDB: Error: pthread_create returned %d\n", ret);
-		ut_ad(0);
-		exit(1);
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"pthread_create returned %d", ret);
 	}
 
 #ifndef UNIV_HPUX10

=== modified file 'storage/innobase/page/page0cur.cc'
--- a/storage/innobase/page/page0cur.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/page/page0cur.cc	revid:kevin.lewis@stripped
@@ -889,11 +889,10 @@ page_cur_parse_insert_rec(
 	/* Build the inserted record to buf */
 
         if (UNIV_UNLIKELY(mismatch_index >= UNIV_PAGE_SIZE)) {
-		fprintf(stderr,
+		ib_logf(IB_LOG_LEVEL_ERROR,
 			"Is short %lu, info_and_status_bits %lu, offset %lu, "
-			"o_offset %lu\n"
-			"mismatch index %lu, end_seg_len %lu\n"
-			"parsed len %lu\n",
+			"o_offset %lu, mismatch index %lu, end_seg_len %lu"
+			"parsed len %lu",
 			(ulong) is_short, (ulong) info_and_status_bits,
 			(ulong) page_offset(cursor_rec),
 			(ulong) origin_offset,

=== modified file 'storage/innobase/page/page0page.cc'
--- a/storage/innobase/page/page0page.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/page/page0page.cc	revid:kevin.lewis@stripped
@@ -122,10 +122,9 @@ page_dir_find_owner_slot(
 	while (UNIV_LIKELY(*(uint16*) slot != rec_offs_bytes)) {
 
 		if (UNIV_UNLIKELY(slot == first_slot)) {
-			fprintf(stderr,
-				"InnoDB: Probable data corruption on"
-				" page %lu\n"
-				"InnoDB: Original record ",
+			ib_logf(IB_LOG_LEVEL_ERROR,
+				"Probable data corruption on page %lu "
+				"Original record on that page;",
 				(ulong) page_get_page_no(page));
 
 			if (page_is_comp(page)) {
@@ -134,18 +133,15 @@ page_dir_find_owner_slot(
 				rec_print_old(stderr, rec);
 			}
 
-			fputs("\n"
-			      "InnoDB: on that page.\n"
-			      "InnoDB: Cannot find the dir slot for record ",
-			      stderr);
+			ib_logf(IB_LOG_LEVEL_ERROR,
+				"Cannot find the dir slot for this record "
+				"on that page;");
 			if (page_is_comp(page)) {
 				fputs("(compact record)", stderr);
 			} else {
 				rec_print_old(stderr, page
 					      + mach_decode_2(rec_offs_bytes));
 			}
-			fputs("\n"
-			      "InnoDB: on that page!\n", stderr);
 
 			buf_page_print(page, 0, 0);
 
@@ -617,13 +613,12 @@ page_copy_rec_list_end_no_locks(
 				       BUF_PAGE_PRINT_NO_CRASH);
 			ut_print_timestamp(stderr);
 
-			fprintf(stderr,
-				"InnoDB: rec offset %lu, cur1 offset %lu,"
-				" cur2 offset %lu\n",
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"rec offset %lu, cur1 offset %lu,"
+				" cur2 offset %lu",
 				(ulong) page_offset(rec),
 				(ulong) page_offset(page_cur_get_rec(&cur1)),
 				(ulong) page_offset(cur2));
-			ut_error;
 		}
 
 		page_cur_move_to_next(&cur1);

=== modified file 'storage/innobase/pars/pars0pars.cc'
--- a/storage/innobase/pars/pars0pars.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/pars/pars0pars.cc	revid:kevin.lewis@stripped
@@ -2199,9 +2199,8 @@ yyerror(
 {
 	ut_ad(s);
 
-	fputs("PARSER ERROR: Syntax error in SQL string\n", stderr);
-
-	ut_error;
+	ib_logf(IB_LOG_LEVEL_FATAL,
+		"PARSER: Syntax error in SQL string");
 }
 
 /*************************************************************//**

=== modified file 'storage/innobase/que/que0que.cc'
--- a/storage/innobase/que/que0que.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/que/que0que.cc	revid:kevin.lewis@stripped
@@ -464,12 +464,12 @@ que_graph_free_recursive(
 		thr = static_cast<que_thr_t*>(node);
 
 		if (thr->magic_n != QUE_THR_MAGIC_N) {
-			fprintf(stderr,
+			ib_logf(IB_LOG_LEVEL_ERROR,
 				"que_thr struct appears corrupt;"
-				" magic n %lu\n",
+				" magic n %lu",
 				(unsigned long) thr->magic_n);
 			mem_analyze_corruption(thr);
-			ut_error;
+			ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 		}
 
 		thr->magic_n = QUE_THR_MAGIC_FREED;
@@ -585,11 +585,11 @@ que_graph_free_recursive(
 
 		break;
 	default:
-		fprintf(stderr,
-			"que_node struct appears corrupt; type %lu\n",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"que_node struct appears corrupt; type %lu",
 			(unsigned long) que_node_get_type(node));
 		mem_analyze_corruption(node);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 }
 
@@ -861,13 +861,11 @@ que_thr_move_to_run_state_for_mysql(
 	trx_t*		trx)	/*!< in: transaction */
 {
 	if (thr->magic_n != QUE_THR_MAGIC_N) {
-		fprintf(stderr,
-			"que_thr struct appears corrupt; magic n %lu\n",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"que_thr struct appears corrupt; magic n %lu",
 			(unsigned long) thr->magic_n);
-
 		mem_analyze_corruption(thr);
-
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 
 	if (!thr->is_active) {
@@ -898,13 +896,11 @@ que_thr_stop_for_mysql_no_error(
 	ut_ad(thr->graph->n_active_thrs == 1);
 
 	if (thr->magic_n != QUE_THR_MAGIC_N) {
-		fprintf(stderr,
-			"que_thr struct appears corrupt; magic n %lu\n",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"que_thr struct appears corrupt; magic n %lu",
 			(unsigned long) thr->magic_n);
-
 		mem_analyze_corruption(thr);
-
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 
 	thr->state = QUE_THR_COMPLETED;

=== modified file 'storage/innobase/rem/rem0cmp.cc'
--- a/storage/innobase/rem/rem0cmp.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/rem/rem0cmp.cc	revid:kevin.lewis@stripped
@@ -297,10 +297,9 @@ cmp_whole_field(
 	case DATA_GEOMETRY:
 		return(0);
 	default:
-		fprintf(stderr,
-			"InnoDB: unknown type number %lu\n",
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"unknown data type number %lu",
 			(ulong) mtype);
-		ut_error;
 	}
 
 	return(0);

=== modified file 'storage/innobase/row/row0mysql.cc'
--- a/storage/innobase/row/row0mysql.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/row/row0mysql.cc	revid:kevin.lewis@stripped
@@ -761,41 +761,32 @@ handle_new_error:
 		break;
 
 	case DB_MUST_GET_MORE_FILE_SPACE:
-		fputs("InnoDB: The database cannot continue"
-		      " operation because of\n"
-		      "InnoDB: lack of space. You must add"
-		      " a new data file to\n"
-		      "InnoDB: my.cnf and restart the database.\n", stderr);
-
-		ut_ad(0);
-		exit(1);
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"The database cannot continue operation because"
+			" of lack of space. You must add a new data file"
+			" to my.cnf and restart the database.");
 
 	case DB_CORRUPTION:
-		fputs("InnoDB: We detected index corruption"
-		      " in an InnoDB type table.\n"
-		      "InnoDB: You have to dump + drop + reimport"
-		      " the table or, in\n"
-		      "InnoDB: a case of widespread corruption,"
-		      " dump all InnoDB\n"
-		      "InnoDB: tables and recreate the"
-		      " whole InnoDB tablespace.\n"
-		      "InnoDB: If the mysqld server crashes"
-		      " after the startup or when\n"
-		      "InnoDB: you dump the tables, look at\n"
-		      "InnoDB: " REFMAN "forcing-innodb-recovery.html"
-		      " for help.\n", stderr);
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"We detected index corruption in an InnoDB type"
+			" table. You have to dump + drop + reimport the"
+			" table or, in a case of widespread corruption,"
+			" dump all InnoDB tables and recreate the whole"
+			" tablespace. If the mysqld server crashes after"
+			" the startup or when you dump the tables, look at"
+			REFMAN "forcing-innodb-recovery.html for help.");
 		break;
 	case DB_FOREIGN_EXCEED_MAX_CASCADE:
-		fprintf(stderr, "InnoDB: Cannot delete/update rows with"
-			" cascading foreign key constraints that exceed max"
-			" depth of %lu\n"
-			"Please drop excessive foreign constraints"
-			" and try again\n", (ulong) DICT_FK_MAX_RECURSIVE_LOAD);
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Cannot delete/update rows with cascading foreign"
+			" key constraints that exceed max depth of %lu."
+			" Please drop excessive foreign constraints and"
+			" try again", (ulong) DICT_FK_MAX_RECURSIVE_LOAD);
 		break;
 	default:
-		fprintf(stderr, "InnoDB: unknown error code %lu: %s\n",
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"Unknown error code %lu: %s",
 			(ulong) err, ut_strerr(err));
-		ut_error;
 	}
 
 	if (trx->error_state != DB_SUCCESS) {
@@ -923,18 +914,15 @@ row_prebuilt_free(
 	if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED
 	    || prebuilt->magic_n2 != ROW_PREBUILT_ALLOCATED) {
 
-		fprintf(stderr,
-			"InnoDB: Error: trying to free a corrupt\n"
-			"InnoDB: table handle. Magic n %lu,"
-			" magic n2 %lu, table name ",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Trying to free a corrupt table handle."
+			" magic_n %lu, magic_n2 %lu, table name ",
 			(ulong) prebuilt->magic_n,
 			(ulong) prebuilt->magic_n2);
 		ut_print_name(stderr, NULL, TRUE, prebuilt->table->name);
 		putc('\n', stderr);
-
 		mem_analyze_corruption(prebuilt);
-
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 
 	prebuilt->magic_n = ROW_PREBUILT_FREED;
@@ -989,11 +977,12 @@ row_prebuilt_free(
 			    || row != prebuilt->fetch_cache[i]
 			    || ROW_PREBUILT_FETCH_MAGIC_N != magic2) {
 
-				fputs("InnoDB: Error: trying to free"
-					" a corrupt fetch buffer.\n", stderr);
-
+				ib_logf(IB_LOG_LEVEL_ERROR,
+					"Trying to free a corrupt"
+					" fetch buffer.");
 				mem_analyze_corruption(base);
-				ut_error;
+				ib_logf(IB_LOG_LEVEL_FATAL,
+					"Memory Corruption");
 			}
 		}
 
@@ -1017,27 +1006,23 @@ row_update_prebuilt_trx(
 	trx_t*		trx)		/*!< in: transaction handle */
 {
 	if (trx->magic_n != TRX_MAGIC_N) {
-		fprintf(stderr,
-			"InnoDB: Error: trying to use a corrupt\n"
-			"InnoDB: trx handle. Magic n %lu\n",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Trying to use a corrupt trx handle. Magic n %lu",
 			(ulong) trx->magic_n);
-
 		mem_analyze_corruption(trx);
-
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 
 	if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
-		fprintf(stderr,
-			"InnoDB: Error: trying to use a corrupt\n"
-			"InnoDB: table handle. Magic n %lu, table name ",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Trying to use a corrupt table handle. "
+			"Magic n %lu, table name;",
 			(ulong) prebuilt->magic_n);
 		ut_print_name(stderr, trx, TRUE, prebuilt->table->name);
 		putc('\n', stderr);
 
 		mem_analyze_corruption(prebuilt);
-
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 
 	prebuilt->trx = trx;
@@ -1369,24 +1354,23 @@ row_insert_for_mysql(
 		return(DB_TABLESPACE_NOT_FOUND);
 
 	} else if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
-		fprintf(stderr,
-			"InnoDB: Error: trying to free a corrupt\n"
-			"InnoDB: table handle. Magic n %lu, table name ",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Trying to free a corrupt table handle."
+			" Magic n %lu, table name;",
 			(ulong) prebuilt->magic_n);
 		ut_print_name(stderr, trx, TRUE, prebuilt->table->name);
 		putc('\n', stderr);
 
 		mem_analyze_corruption(prebuilt);
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 
-		ut_error;
 	} else if (srv_sys_space.created_new_raw() || srv_force_recovery) {
-		fputs("InnoDB: A new raw disk partition was initialized or\n"
-		      "InnoDB: innodb_force_recovery is on: we do not allow\n"
-		      "InnoDB: database modifications by the user. Shut down\n"
-		      "InnoDB: mysqld and edit my.cnf so that"
-		      " newraw is replaced\n"
-		      "InnoDB: with raw, and innodb_force_... is removed.\n",
-		      stderr);
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"A new raw disk partition was initialized or"
+			" innodb_force_recovery is on: We do not allow"
+			" database modifications by the user. Shut down"
+			" mysqld and edit my.cnf so that newraw is replaced"
+			" with raw, and innodb_force_... is removed.");
 
 		return(DB_ERROR);
 	}
@@ -1736,42 +1720,37 @@ row_update_for_mysql(
 
 	if (prebuilt->table->ibd_file_missing) {
 		ut_print_timestamp(stderr);
-		fprintf(stderr, "  InnoDB: Error:\n"
-			"InnoDB: MySQL is trying to use a table handle"
-			" but the .ibd file for\n"
-			"InnoDB: table %s does not exist.\n"
-			"InnoDB: Have you deleted the .ibd file"
-			" from the database directory under\n"
-			"InnoDB: the MySQL datadir, or have you"
-			" used DISCARD TABLESPACE?\n"
-			"InnoDB: Look from\n"
-			"InnoDB: " REFMAN "innodb-troubleshooting.html\n"
-			"InnoDB: how you can resolve the problem.\n",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"MySQL is trying to use a table handle but the .ibd"
+			" file for table %s does not exist. Have you deleted"
+			" the .ibd file from the database directory under"
+			" the MySQL datadir, or have you used DISCARD"
+			" TABLESPACE?  Please refer to " REFMAN
+			"innodb-troubleshooting.html to see how you can"
+			" resolve the problem.",
 			prebuilt->table->name);
 		return(DB_ERROR);
 	}
 
 	if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
-		fprintf(stderr,
-			"InnoDB: Error: trying to free a corrupt\n"
-			"InnoDB: table handle. Magic n %lu, table name ",
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"Trying to free a corrupt table handle."
+			" Magic n %lu, table name;",
 			(ulong) prebuilt->magic_n);
 		ut_print_name(stderr, trx, TRUE, prebuilt->table->name);
 		putc('\n', stderr);
 
 		mem_analyze_corruption(prebuilt);
-
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 
 	if (srv_sys_space.created_new_raw() || srv_force_recovery) {
-		fputs("InnoDB: A new raw disk partition was initialized or\n"
-		      "InnoDB: innodb_force_recovery is on: we do not allow\n"
-		      "InnoDB: database modifications by the user. Shut down\n"
-		      "InnoDB: mysqld and edit my.cnf so that newraw"
-		      " is replaced\n"
-		      "InnoDB: with raw, and innodb_force_... is removed.\n",
-		      stderr);
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"A new raw disk partition was initialized or"
+			" innodb_force_recovery is on: we do not allow"
+			" database modifications by the user. Shut down"
+			" mysqld and edit my.cnf so that newraw is replaced"
+			" with raw, and innodb_force_... is removed.");
 
 		return(DB_ERROR);
 	}

=== modified file 'storage/innobase/row/row0sel.cc'
--- a/storage/innobase/row/row0sel.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/row/row0sel.cc	revid:kevin.lewis@stripped
@@ -3713,8 +3713,7 @@ row_search_for_mysql(
 		putc('\n', stderr);
 
 		mem_analyze_corruption(prebuilt);
-
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL, "Memory Corruption");
 	}
 
 #if 0

=== modified file 'storage/innobase/row/row0undo.cc'
--- a/storage/innobase/row/row0undo.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/row/row0undo.cc	revid:kevin.lewis@stripped
@@ -354,21 +354,14 @@ row_undo_step(
 	if (err != DB_SUCCESS) {
 		/* SQL error detected */
 
-		fprintf(stderr, "InnoDB: Fatal error (%s) in rollback.\n",
-			ut_strerr(err));
-
 		if (err == DB_OUT_OF_FILE_SPACE) {
-			fprintf(stderr,
-				"InnoDB: Out of tablespace.\n"
-				"InnoDB: Consider increasing"
-				" your tablespace.\n");
-
-			exit(1);
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Out of tablespace during rollback."
+				" Consider increasing your tablespace.");
 		}
 
-		ut_error;
-
-		return(NULL);
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"Error (%s) in rollback.", ut_strerr(err));
 	}
 
 	return(thr);

=== modified file 'storage/innobase/srv/srv0space.cc'
--- a/storage/innobase/srv/srv0space.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/srv/srv0space.cc	revid:kevin.lewis@stripped
@@ -781,7 +781,7 @@ dberr_t
 Tablespace::file_not_found(
 /*=======================*/
 	file_t&	file,
-	ibool*	create_new_db)
+	bool*	create_new_db)
 {
 	file.m_exists = false;
 
@@ -888,7 +888,7 @@ UNIV_INTERN
 dberr_t
 Tablespace::check_file_spec(
 /*========================*/
-	ibool*	create_new_db,
+	bool*	create_new_db,
 	ulint	min_expected_tablespace_size)
 {
 	srv_normalize_path_for_win(m_tablespace_path);

=== modified file 'storage/innobase/srv/srv0srv.cc'
--- a/storage/innobase/srv/srv0srv.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/srv/srv0srv.cc	revid:kevin.lewis@stripped
@@ -1696,15 +1696,11 @@ loop:
 	    && sema == old_sema && os_thread_eq(waiter, old_waiter)) {
 		fatal_cnt++;
 		if (fatal_cnt > 10) {
-
-			fprintf(stderr,
-				"InnoDB: Error: semaphore wait has lasted"
-				" > %lu seconds\n"
-				"InnoDB: We intentionally crash the server,"
-				" because it appears to be hung.\n",
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"Semaphore wait has lasted > %lu seconds."
+				" We intentionally crash the server because"
+				" it appears to be hung.",
 				(ulong) srv_fatal_semaphore_wait_threshold);
-
-			ut_error;
 		}
 	} else {
 		fatal_cnt = 0;

=== modified file 'storage/innobase/srv/srv0start.cc'
--- a/storage/innobase/srv/srv0start.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/srv/srv0start.cc	revid:kevin.lewis@stripped
@@ -155,6 +155,9 @@ static os_fast_mutex_t	srv_os_test_mutex
 static char*	srv_monitor_file_name;
 #endif /* !UNIV_HOTBACKUP */
 
+/** Minimum expected tablespace size. (10M) */
+static const ulint MIN_EXPECTED_TABLESPACE_SIZE = 5 * 1024 * 1024;
+
 /** Default undo tablespace size in UNIV_PAGEs count (10MB). */
 static const ulint SRV_UNDO_TABLESPACE_SIZE_IN_PAGES =
 	((1024 * 1024) * 10) / UNIV_PAGE_SIZE_DEF;
@@ -378,6 +381,8 @@ create_log_files(
 	lsn_t	lsn,		/*!< in: FIL_PAGE_FILE_FLUSH_LSN value */
 	char*&	logfile0)	/*!< out: name of the first log file */
 {
+	dberr_t err;
+
 	if (srv_read_only_mode) {
 		ib_logf(IB_LOG_LEVEL_ERROR,
 			"Cannot create log files in read-only mode");
@@ -411,7 +416,7 @@ create_log_files(
 		sprintf(logfilename + dirnamelen,
 			"ib_logfile%u", i ? i : INIT_LOG_FILE0);
 
-		dberr_t err = create_log_file(&files[i], logfilename);
+		err = create_log_file(&files[i], logfilename);
 
 		if (err != DB_SUCCESS) {
 			return(err);
@@ -439,18 +444,22 @@ create_log_files(
 	for (unsigned i = 1; i < srv_n_log_files; i++) {
 		sprintf(logfilename + dirnamelen, "ib_logfile%u", i);
 
-		if (!fil_node_create(
-			    logfilename,
-			    (ulint) srv_log_file_size,
-			    SRV_LOG_SPACE_FIRST_ID, FALSE)) {
-			ut_error;
+		if (!fil_node_create(logfilename,
+				     (ulint) srv_log_file_size,
+				     SRV_LOG_SPACE_FIRST_ID, FALSE)) {
+			ib_logf(IB_LOG_LEVEL_ERROR,
+				"Cannot create file node for log file %s",
+				logfilename);
+			return(DB_ERROR);
 		}
 	}
 
-	log_group_init(0, srv_n_log_files,
-		       srv_log_file_size * UNIV_PAGE_SIZE,
-		       SRV_LOG_SPACE_FIRST_ID,
-		       SRV_LOG_SPACE_FIRST_ID + 1);
+	if (!log_group_init(0, srv_n_log_files,
+			    srv_log_file_size * UNIV_PAGE_SIZE,
+			    SRV_LOG_SPACE_FIRST_ID,
+			    SRV_LOG_SPACE_FIRST_ID + 1)) {
+		return(DB_ERROR);
+	}
 
 	fil_open_log_and_system_tablespace_files();
 
@@ -684,7 +693,7 @@ static
 dberr_t
 srv_undo_tablespaces_init(
 /*======================*/
-	ibool		create_new_db,		/*!< in: TRUE if new db being
+	bool		create_new_db,		/*!< in: TRUE if new db being
 						created */
 	const ulint	n_conf_tablespaces,	/*!< in: configured undo
 						tablespaces */
@@ -927,7 +936,7 @@ srv_open_tmp_tablespace(
 	ib_logf(IB_LOG_LEVEL_INFO,
 		"Creating shared tablespace for temporary tables");
 
-	ibool	create_new_temp_space;
+	bool	create_new_temp_space;
 	ulint	temp_space_id = ULINT_UNDEFINED;
 
 	dict_hdr_get_new_id(NULL, NULL, &temp_space_id, NULL, true);
@@ -1085,15 +1094,25 @@ srv_shutdown_all_bg_threads()
 	}
 }
 
+#define srv_init_abort(_db_err) srv_init_abort_low(create_new_db, _db_err)
+
 /********************************************************************
 Innobase start-up aborted. Perform cleanup actions.
 @return DB_SUCCESS or error code. */
 static
 dberr_t
-srv_init_abort(
-/*===========*/
-	dberr_t	err)	/*!< in: reason for abort */
+srv_init_abort_low(
+/*===============*/
+	bool	create_new_db,	/*!< in: TRUE if new db being created */
+	dberr_t	err)		/*!< in: reason for abort */
 {
+	if (create_new_db) {
+		ib_logf(IB_LOG_LEVEL_ERROR,
+			"InnoDB Database creation was aborted. You may"
+			" need to delete the ibdata1 file before trying"
+			" to start up again.");
+	}
+
 	srv_shutdown_all_bg_threads();
 	return(err);
 }
@@ -1107,7 +1126,7 @@ dberr_t
 innobase_start_or_create_for_mysql(void)
 /*====================================*/
 {
-	ibool		create_new_db;
+	bool		create_new_db = false;
 	lsn_t		min_flushed_lsn;
 	lsn_t		max_flushed_lsn;
 	ulint		sum_of_data_file_sizes;
@@ -1615,7 +1634,8 @@ innobase_start_or_create_for_mysql(void)
 	srv_normalize_path_for_win(srv_data_home);
 
 	/* Check if the data files exist or not. */
-	err = srv_sys_space.check_file_spec(&create_new_db, 10 * 1024 * 1024);
+	err = srv_sys_space.check_file_spec(
+		&create_new_db, MIN_EXPECTED_TABLESPACE_SIZE);
 
 	if (err != DB_SUCCESS) {
 		return(srv_init_abort(DB_ERROR));
@@ -1812,9 +1832,11 @@ innobase_start_or_create_for_mysql(void)
 			}
 		}
 
-		log_group_init(0, i, srv_log_file_size * UNIV_PAGE_SIZE,
-			       SRV_LOG_SPACE_FIRST_ID,
-			       SRV_LOG_SPACE_FIRST_ID + 1);
+		if (!log_group_init(0, i, srv_log_file_size * UNIV_PAGE_SIZE,
+				    SRV_LOG_SPACE_FIRST_ID,
+				    SRV_LOG_SPACE_FIRST_ID + 1)) {
+			return(srv_init_abort(DB_ERROR));
+		}
 	}
 
 files_checked:
@@ -2101,8 +2123,10 @@ files_checked:
 
 	if (buf_dblwr == NULL) {
 		/* Create the doublewrite buffer to a new tablespace */
+		if (!buf_dblwr_create()) {
+			return(srv_init_abort(DB_ERROR));
+		}
 
-		buf_dblwr_create();
 	}
 
 	/* Here the double write buffer has already been created and so
@@ -2310,14 +2334,9 @@ files_checked:
 	os_fast_mutex_init(PFS_NOT_INSTRUMENTED, &srv_os_test_mutex);
 
 	if (0 != os_fast_mutex_trylock(&srv_os_test_mutex)) {
-		ut_print_timestamp(stderr);
-		fprintf(stderr,
-			" InnoDB: Error: pthread_mutex_trylock returns"
-			" an unexpected value on\n");
-		ut_print_timestamp(stderr);
-		fprintf(stderr,
-			" InnoDB: success! Cannot continue.\n");
-		exit(1);
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"pthread_mutex_trylock returns an unexpected"
+			" value on success! Cannot continue.");
 	}
 
 	os_fast_mutex_unlock(&srv_os_test_mutex);

=== modified file 'storage/innobase/sync/sync0arr.cc'
--- a/storage/innobase/sync/sync0arr.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/sync/sync0arr.cc	revid:kevin.lewis@stripped
@@ -413,8 +413,9 @@ sync_array_wait_event(
 
 	if (TRUE == sync_array_detect_deadlock(arr, cell, cell, 0)) {
 
-		fputs("########################################\n", stderr);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"########################################\n"
+			"Deadlock Detected!");
 	}
 
 	rw_lock_debug_mutex_exit();

=== modified file 'storage/innobase/sync/sync0sync.cc'
--- a/storage/innobase/sync/sync0sync.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/sync/sync0sync.cc	revid:kevin.lewis@stripped
@@ -1191,10 +1191,9 @@ sync_thread_add_level(
 	case SYNC_INDEX_ONLINE_LOG:
 	case SYNC_STATS_AUTO_RECALC:
 		if (!sync_thread_levels_g(array, level, TRUE)) {
-			fprintf(stderr,
-				"InnoDB: sync_thread_levels_g(array, %lu)"
-				" does not hold!\n", level);
-			ut_error;
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"sync_thread_levels_g(array, %lu)"
+				" does not hold!", level);
 		}
 		break;
 	case SYNC_TRX:
@@ -1210,10 +1209,9 @@ sync_thread_add_level(
 		/* We can have multiple mutexes of this type therefore we
 		can only check whether the greater than condition holds. */
 		if (!sync_thread_levels_g(array, level-1, TRUE)) {
-			fprintf(stderr,
-				"InnoDB: sync_thread_levels_g(array, %lu)"
-				" does not hold!\n", level-1);
-			ut_error;
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"sync_thread_levels_g(array, %lu)"
+				" does not hold!", level-1);
 		}
 		break;
 

=== modified file 'storage/innobase/trx/trx0purge.cc'
--- a/storage/innobase/trx/trx0purge.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/trx/trx0purge.cc	revid:kevin.lewis@stripped
@@ -228,10 +228,8 @@ trx_purge_add_update_undo_to_history(
 		/* The undo log segment will not be reused */
 
 		if (UNIV_UNLIKELY(undo->id >= TRX_RSEG_N_SLOTS)) {
-			fprintf(stderr,
-				"InnoDB: Error: undo->id is %lu\n",
-				(ulong) undo->id);
-			ut_error;
+			ib_logf(IB_LOG_LEVEL_FATAL,
+				"undo->id is %lu", (ulong) undo->id);
 		}
 
 		trx_rsegf_set_nth_undo(rseg_header, undo->id, FIL_NULL, mtr);

=== modified file 'storage/innobase/trx/trx0undo.cc'
--- a/storage/innobase/trx/trx0undo.cc	revid:nuno.carvalho@stripped
+++ b/storage/innobase/trx/trx0undo.cc	revid:kevin.lewis@stripped
@@ -1277,9 +1277,8 @@ trx_undo_mem_create_at_db_start(
 	ibool		xid_exists = FALSE;
 
 	if (id >= TRX_RSEG_N_SLOTS) {
-		fprintf(stderr,
-			"InnoDB: Error: undo->id is %lu\n", (ulong) id);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"undo->id is %lu", (ulong) id);
 	}
 
 	undo_page = trx_undo_page_get(rseg->space, rseg->zip_size,
@@ -1459,9 +1458,8 @@ trx_undo_mem_create(
 	ut_ad(mutex_own(&(rseg->mutex)));
 
 	if (id >= TRX_RSEG_N_SLOTS) {
-		fprintf(stderr,
-			"InnoDB: Error: undo->id is %lu\n", (ulong) id);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"undo->id is %lu", (ulong) id);
 	}
 
 	undo = static_cast<trx_undo_t*>(mem_alloc(sizeof(*undo)));
@@ -1511,11 +1509,9 @@ trx_undo_mem_init_for_reuse(
 	ut_ad(mutex_own(&((undo->rseg)->mutex)));
 
 	if (UNIV_UNLIKELY(undo->id >= TRX_RSEG_N_SLOTS)) {
-		fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
-			(ulong) undo->id);
-
 		mem_analyze_corruption(undo);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"undo->id is %lu\n", (ulong) undo->id);
 	}
 
 	undo->state = TRX_UNDO_ACTIVE;
@@ -1538,9 +1534,8 @@ trx_undo_mem_free(
 	trx_undo_t*	undo)	/*!< in: the undo object to be freed */
 {
 	if (undo->id >= TRX_RSEG_N_SLOTS) {
-		fprintf(stderr,
-			"InnoDB: Error: undo->id is %lu\n", (ulong) undo->id);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"undo->id is %lu\n", (ulong) undo->id);
 	}
 
 	mem_free(undo);
@@ -1667,10 +1662,9 @@ trx_undo_reuse_cached(
 	ut_ad(undo->size == 1);
 
 	if (undo->id >= TRX_RSEG_N_SLOTS) {
-		fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
-			(ulong) undo->id);
 		mem_analyze_corruption(undo);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"undo->id is %lu", (ulong) undo->id);
 	}
 
 	undo_page = trx_undo_page_get(undo->space, undo->zip_size,
@@ -1825,10 +1819,9 @@ trx_undo_set_state_at_finish(
 	ulint		state;
 
 	if (undo->id >= TRX_RSEG_N_SLOTS) {
-		fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
-			(ulong) undo->id);
 		mem_analyze_corruption(undo);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"undo->id is %lu\n", (ulong) undo->id);
 	}
 
 	undo_page = trx_undo_page_get(undo->space, undo->zip_size,
@@ -1876,10 +1869,9 @@ trx_undo_set_state_at_prepare(
 	ut_ad(trx && undo && mtr);
 
 	if (undo->id >= TRX_RSEG_N_SLOTS) {
-		fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
-			(ulong) undo->id);
 		mem_analyze_corruption(undo);
-		ut_error;
+		ib_logf(IB_LOG_LEVEL_FATAL,
+			"undo->id is %lu\n", (ulong) undo->id);
 	}
 
 	undo_page = trx_undo_page_get(undo->space, undo->zip_size,

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (kevin.lewis:5247) kevin.lewis3 Apr