← Back to team overview

maria-developers team mailing list archive

[Branch ~maria-captains/maria/5.1] Rev 2727: Merge.

 

Merge authors:
  Kristian Nielsen (knielsen)
  Paul McCullagh (paul-mccullagh)
Related merge proposals:
  https://code.launchpad.net/~paul-mccullagh/maria/bug-422550/+merge/11076
  proposed by: Paul McCullagh (paul-mccullagh)
  review: Approve - Kristian Nielsen (knielsen)
------------------------------------------------------------
revno: 2727 [merge]
committer: knielsen@xxxxxxxxxxxxxxx
branch nick: work
timestamp: Fri 2009-09-04 09:45:34 +0200
message:
  Merge.
   - PBXT fixes.
   - MBug#423035 fix.
   - Compiler warning fixes.
added:
  mysql-test/r/mysqld_option_err.result
  mysql-test/t/mysqld_option_err.test
  support-files/ccfilter
modified:
  client/mysqlbinlog.cc
  config/ac-macros/misc.m4
  extra/yassl/include/yassl_int.hpp
  extra/yassl/src/handshake.cpp
  extra/yassl/src/yassl_imp.cpp
  extra/yassl/src/yassl_int.cpp
  extra/yassl/taocrypt/include/modes.hpp
  extra/yassl/taocrypt/src/asn.cpp
  mysql-test/mysql-test-run.pl
  mysys/my_compress.c
  mysys/my_getopt.c
  sql/mysqld.cc
  storage/pbxt/ChangeLog
  storage/pbxt/src/Makefile.am
  storage/pbxt/src/datalog_xt.cc
  storage/pbxt/src/discover_xt.cc
  storage/pbxt/src/filesys_xt.cc
  storage/pbxt/src/ha_pbxt.cc
  storage/pbxt/src/memory_xt.cc
  storage/pbxt/src/myxt_xt.cc
  storage/pbxt/src/myxt_xt.h
  storage/pbxt/src/restart_xt.cc
  storage/pbxt/src/restart_xt.h
  storage/pbxt/src/strutil_xt.cc
  storage/pbxt/src/tabcache_xt.cc
  storage/pbxt/src/thread_xt.cc
  storage/pbxt/src/xaction_xt.cc
  storage/pbxt/src/xactlog_xt.cc
  storage/pbxt/src/xt_errno.h
  storage/xtradb/fil/fil0fil.c
  storage/xtradb/mtr/mtr0mtr.c
  storage/xtradb/srv/srv0srv.c
  storage/xtradb/srv/srv0start.c
  strings/decimal.c
  support-files/compiler_warnings.supp


--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1

Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
=== modified file 'client/mysqlbinlog.cc'
--- client/mysqlbinlog.cc	2009-02-13 16:41:47 +0000
+++ client/mysqlbinlog.cc	2009-09-03 13:20:22 +0000
@@ -689,8 +689,8 @@
     Format events are not concerned by --offset and such, we always need to
     read them to be able to process the wanted events.
   */
-  if ((rec_count >= offset) &&
-      ((my_time_t)(ev->when) >= start_datetime) ||
+  if (((rec_count >= offset) &&
+       ((my_time_t)(ev->when) >= start_datetime)) ||
       (ev_type == FORMAT_DESCRIPTION_EVENT))
   {
     if (ev_type != FORMAT_DESCRIPTION_EVENT)

=== modified file 'config/ac-macros/misc.m4'
--- config/ac-macros/misc.m4	2008-02-26 17:38:43 +0000
+++ config/ac-macros/misc.m4	2009-09-03 13:20:22 +0000
@@ -594,15 +594,15 @@
 
 dnl MYSQL_NEEDS_MYSYS_NEW
 AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW],
-[AC_CACHE_CHECK([needs mysys_new helpers], mysql_use_mysys_new,
+[AC_CACHE_CHECK([needs mysys_new helpers], mysql_cv_use_mysys_new,
 [
 AC_LANG_PUSH(C++)
 AC_TRY_LINK([], [
 class A { public: int b; }; A *a=new A; a->b=10; delete a;
-], mysql_use_mysys_new=no, mysql_use_mysys_new=yes)
+], mysql_cv_use_mysys_new=no, mysql_cv_use_mysys_new=yes)
 AC_LANG_POP(C++)
 ])
-if test "$mysql_use_mysys_new" = "yes"
+if test "$mysql_cv_use_mysys_new" = "yes"
 then
   AC_DEFINE([USE_MYSYS_NEW], [1], [Needs to use mysys_new helpers])
 fi

=== modified file 'extra/yassl/include/yassl_int.hpp'
--- extra/yassl/include/yassl_int.hpp	2008-11-18 16:45:44 +0000
+++ extra/yassl/include/yassl_int.hpp	2009-09-03 13:20:22 +0000
@@ -441,7 +441,7 @@
     const Ciphers&    GetCiphers()  const;
     const DH_Parms&   GetDH_Parms() const;
     const Stats&      GetStats()    const;
-    const VerifyCallback getVerifyCallback() const;
+    VerifyCallback getVerifyCallback() const;
     pem_password_cb   GetPasswordCb() const;
           void*       GetUserData()   const;
           bool        GetSessionCacheOff() const;

=== modified file 'extra/yassl/src/handshake.cpp'
--- extra/yassl/src/handshake.cpp	2008-04-28 16:24:05 +0000
+++ extra/yassl/src/handshake.cpp	2009-09-03 13:20:22 +0000
@@ -789,7 +789,7 @@
 {
     if (ssl.GetError()) return;
 
-    if (DoProcessReply(ssl))
+    if (DoProcessReply(ssl)) {
         // didn't complete process
         if (!ssl.getSocket().IsNonBlocking()) {
             // keep trying now, blocking ok
@@ -799,6 +799,7 @@
         else
             // user will have try again later, non blocking
             ssl.SetError(YasslError(SSL_ERROR_WANT_READ));
+    }
 }
 
 
@@ -872,11 +873,12 @@
 // send change cipher
 void sendChangeCipher(SSL& ssl, BufferOutput buffer)
 {
-    if (ssl.getSecurity().get_parms().entity_ == server_end)
+    if (ssl.getSecurity().get_parms().entity_ == server_end) {
         if (ssl.getSecurity().get_resuming())
             ssl.verifyState(clientKeyExchangeComplete);
         else
             ssl.verifyState(clientFinishedComplete);
+    }
     if (ssl.GetError()) return;
 
     ChangeCipherSpec ccs;

=== modified file 'extra/yassl/src/yassl_imp.cpp'
--- extra/yassl/src/yassl_imp.cpp	2009-02-13 16:41:47 +0000
+++ extra/yassl/src/yassl_imp.cpp	2009-09-03 13:20:22 +0000
@@ -1304,7 +1304,7 @@
     else
         ssl.useSecurity().use_connection().sessionID_Set_ = false;
 
-    if (ssl.getSecurity().get_resuming())
+    if (ssl.getSecurity().get_resuming()) {
         if (memcmp(session_id_, ssl.getSecurity().get_resume().GetID(),
                    ID_LEN) == 0) {
             ssl.set_masterSecret(ssl.getSecurity().get_resume().GetSecret());
@@ -1319,6 +1319,7 @@
             ssl.useSecurity().set_resuming(false);
             ssl.useLog().Trace("server denied resumption");
         }
+    }
 
     if (ssl.CompressionOn() && !compression_method_)
         ssl.UnSetCompression(); // server isn't supporting yaSSL zlib request

=== modified file 'extra/yassl/src/yassl_int.cpp'
--- extra/yassl/src/yassl_int.cpp	2009-02-13 16:41:47 +0000
+++ extra/yassl/src/yassl_int.cpp	2009-09-03 13:20:22 +0000
@@ -1833,7 +1833,7 @@
 }
 
 
-const VerifyCallback SSL_CTX::getVerifyCallback() const
+VerifyCallback SSL_CTX::getVerifyCallback() const
 {
     return verifyCallback_;
 }

=== modified file 'extra/yassl/taocrypt/include/modes.hpp'
--- extra/yassl/taocrypt/include/modes.hpp	2007-03-23 12:43:09 +0000
+++ extra/yassl/taocrypt/include/modes.hpp	2009-09-03 13:20:22 +0000
@@ -95,11 +95,12 @@
 {
     if (mode_ == ECB)
         ECB_Process(out, in, sz);
-    else if (mode_ == CBC)
+    else if (mode_ == CBC) {
         if (dir_ == ENCRYPTION)
             CBC_Encrypt(out, in, sz);
         else
             CBC_Decrypt(out, in, sz);
+    }
 }
 
 

=== modified file 'extra/yassl/taocrypt/src/asn.cpp'
--- extra/yassl/taocrypt/src/asn.cpp	2009-02-13 16:41:47 +0000
+++ extra/yassl/taocrypt/src/asn.cpp	2009-09-03 13:20:22 +0000
@@ -780,11 +780,12 @@
     memcpy(date, source_.get_current(), length);
     source_.advance(length);
 
-    if (!ValidateDate(date, b, dt) && verify_)
+    if (!ValidateDate(date, b, dt) && verify_) {
         if (dt == BEFORE)
             source_.SetError(BEFORE_DATE_E);
         else
             source_.SetError(AFTER_DATE_E);
+    }
 
     // save for later use
     if (dt == BEFORE) {
@@ -1061,7 +1062,7 @@
         return 0;
     }
     word32 rLen = GetLength(source);
-    if (rLen != 20)
+    if (rLen != 20) {
         if (rLen == 21) {       // zero at front, eat
             source.next();
             --rLen;
@@ -1074,6 +1075,7 @@
             source.SetError(DSA_SZ_E);
             return 0;
         }
+    }
     memcpy(decoded, source.get_buffer() + source.get_index(), rLen);
     source.advance(rLen);
 
@@ -1083,7 +1085,7 @@
         return 0;
     }
     word32 sLen = GetLength(source);
-    if (sLen != 20)
+    if (sLen != 20) {
         if (sLen == 21) {
             source.next();          // zero at front, eat
             --sLen;
@@ -1096,6 +1098,7 @@
             source.SetError(DSA_SZ_E);
             return 0;
         }
+    }
     memcpy(decoded + rLen, source.get_buffer() + source.get_index(), sLen);
     source.advance(sLen);
 

=== modified file 'mysql-test/mysql-test-run.pl'
--- mysql-test/mysql-test-run.pl	2009-08-25 15:02:55 +0000
+++ mysql-test/mysql-test-run.pl	2009-09-04 07:45:34 +0000
@@ -1773,6 +1773,20 @@
   return mtr_args2str($exe, @$args);
 }
 
+# This is not used to actually start a mysqld server, just to allow test
+# scripts to run the mysqld binary to test invalid server startup options.
+sub mysqld_client_arguments () {
+  my $default_mysqld= default_mysqld();
+  my $exe = find_mysqld($basedir);
+  my $args;
+  mtr_init_args(\$args);
+  mtr_add_arg($args, "--no-defaults");
+  mtr_add_arg($args, "--basedir=%s", $basedir);
+  mtr_add_arg($args, "--character-sets-dir=%s", $default_mysqld->value("character-sets-dir"));
+  mtr_add_arg($args, "--language=%s", $default_mysqld->value("language"));
+  return mtr_args2str($exe, @$args);
+}
+
 
 sub have_maria_support () {
   my $maria_var= $mysqld_variables{'maria'};
@@ -1970,6 +1984,7 @@
   $ENV{'MYSQLADMIN'}=               native_path($exe_mysqladmin);
   $ENV{'MYSQL_CLIENT_TEST'}=        mysql_client_test_arguments();
   $ENV{'MYSQL_FIX_SYSTEM_TABLES'}=  mysql_fix_arguments();
+  $ENV{'MYSQLD'}=                   mysqld_client_arguments();
   $ENV{'EXE_MYSQL'}=                $exe_mysql;
 
   # ----------------------------------------------------

=== added file 'mysql-test/r/mysqld_option_err.result'
--- mysql-test/r/mysqld_option_err.result	1970-01-01 00:00:00 +0000
+++ mysql-test/r/mysqld_option_err.result	2009-09-03 13:05:02 +0000
@@ -0,0 +1,6 @@
+Test that unknown option is not silently ignored.
+Test bad binlog format.
+Test bad default storage engine.
+Test non-numeric value passed to number option.
+Test that bad value for plugin enum option is rejected correctly.
+Done.

=== added file 'mysql-test/t/mysqld_option_err.test'
--- mysql-test/t/mysqld_option_err.test	1970-01-01 00:00:00 +0000
+++ mysql-test/t/mysqld_option_err.test	2009-09-03 13:05:02 +0000
@@ -0,0 +1,47 @@
+#
+# Test error checks on mysqld command line option parsing.
+#
+# Call mysqld with different invalid options, and check that it fails in each case.
+#
+# This means that a test failure results in mysqld starting up, which is only
+# caught when the test case times out. This is not ideal, but I did not find an
+# easy way to have the server shut down after a successful startup.
+#
+
+--source include/not_embedded.inc
+
+# We have not run (and do not need) bootstrap of the server. We just
+# give it a dummy data directory (for log files etc).
+
+mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err;
+
+
+--echo Test that unknown option is not silently ignored.
+--error 2
+--exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --nonexistentoption >$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
+
+
+--echo Test bad binlog format.
+--error 1
+--exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --log-bin --binlog-format=badformat >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
+
+
+--echo Test bad default storage engine.
+--error 1
+--exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --default-storage-engine=nonexistentengine >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
+
+
+--echo Test non-numeric value passed to number option.
+--error 1
+--exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables  --min-examined-row-limit=notanumber >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
+
+
+# Test for MBug#423035: error in parsing enum value for plugin
+# variable in mysqld command-line option.
+# See also Bug#32034.
+--echo Test that bad value for plugin enum option is rejected correctly.
+--error 7
+--exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables $EXAMPLE_PLUGIN_OPT --plugin-load=EXAMPLE=ha_example.so --plugin-example-enum-var=noexist >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
+
+
+--echo Done.

=== modified file 'mysys/my_compress.c'
--- mysys/my_compress.c	2009-05-22 12:38:50 +0000
+++ mysys/my_compress.c	2009-09-03 13:20:22 +0000
@@ -81,12 +81,13 @@
   This fix is safe, since such memory is only used internally by zlib, so we
   will not hide any bugs in mysql this way.
 */
-void *my_az_allocator(void *dummy, unsigned int items, unsigned int size)
+void *my_az_allocator(void *dummy __attribute__((unused)), unsigned int items,
+                      unsigned int size)
 {
   return my_malloc((size_t)items*(size_t)size, IF_VALGRIND(MY_ZEROFILL, MYF(0)));
 }
 
-void my_az_free(void *dummy, void *address)
+void my_az_free(void *dummy __attribute__((unused)), void *address)
 {
   my_free(address, MYF(MY_ALLOW_ZERO_PTR));
 }

=== modified file 'mysys/my_getopt.c'
--- mysys/my_getopt.c	2009-05-20 15:34:34 +0000
+++ mysys/my_getopt.c	2009-09-03 13:05:02 +0000
@@ -603,6 +603,7 @@
 		  my_bool set_maximum_value)
 {
   int err= 0;
+  int pos;
 
   if (value && argument)
   {
@@ -647,7 +648,9 @@
 	return EXIT_OUT_OF_MEMORY;
       break;
     case GET_ENUM:
-      if (((*(ulong *)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0)
+      pos= find_type(argument, opts->typelib, 2) - 1;
+      (*(ulong *)result_pos)= pos;
+      if (pos < 0)
         return EXIT_ARGUMENT_INVALID;
       break;
     case GET_SET:

=== modified file 'sql/mysqld.cc'
--- sql/mysqld.cc	2009-09-03 14:56:46 +0000
+++ sql/mysqld.cc	2009-09-04 07:45:34 +0000
@@ -1016,6 +1016,7 @@
 }
 
 
+#ifdef HAVE_CLOSE_SERVER_SOCK
 static void close_socket(my_socket sock, const char *info)
 {
   DBUG_ENTER("close_socket");
@@ -1035,6 +1036,7 @@
   }
   DBUG_VOID_RETURN;
 }
+#endif
 
 
 static void close_server_sock()

=== modified file 'storage/pbxt/ChangeLog'
--- storage/pbxt/ChangeLog	2009-08-18 07:46:53 +0000
+++ storage/pbxt/ChangeLog	2009-09-03 06:15:03 +0000
@@ -1,6 +1,10 @@
 PBXT Release Notes
 ==================
 
+------- 1.0.08d RC2 - 2009-09-02
+
+RN267: Fixed a bug that caused MySQL to crash on shutdown, after an incorrect command line parameter was given. The crash occurred because the background recovery task was not cleaned up before the PBXT engine was de-initialized.
+
 ------- 1.0.08c RC2 - 2009-08-18
 
 RN266: Updated BLOB streaming glue, used with the PBMS engine. The glue code is now identical to the version of "1.0.08-rc-pbms" version of PBXT available from http://blobstreaming.org/download.

=== modified file 'storage/pbxt/src/Makefile.am'
--- storage/pbxt/src/Makefile.am	2009-08-31 11:07:44 +0000
+++ storage/pbxt/src/Makefile.am	2009-09-04 07:29:34 +0000
@@ -30,7 +30,7 @@
 						datadic_xt.cc datalog_xt.cc filesys_xt.cc hashtab_xt.cc \
 						ha_pbxt.cc heap_xt.cc index_xt.cc linklist_xt.cc \
 						memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \
-						pbms_enabled.cc sortedlist_xt.cc strutil_xt.cc \
+						sortedlist_xt.cc strutil_xt.cc \
 						tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \
 						systab_xt.cc ha_xtsys.cc discover_xt.cc \
 						util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc
@@ -49,4 +49,4 @@
 libpbxt_a_CXXFLAGS =	$(AM_CXXFLAGS)
 libpbxt_a_CFLAGS =		$(AM_CFLAGS) -std=c99
 
-EXTRA_DIST =			CMakeLists.txt
+EXTRA_DIST =			CMakeLists.txt pbms_enabled.cc

=== modified file 'storage/pbxt/src/datalog_xt.cc'
--- storage/pbxt/src/datalog_xt.cc	2009-08-18 07:46:53 +0000
+++ storage/pbxt/src/datalog_xt.cc	2009-09-04 07:29:34 +0000
@@ -410,7 +410,7 @@
 	ASSERT_NS(seq_read.sl_log_eof == seq_read.sl_rec_log_offset);
 	data_log->dlf_log_eof = seq_read.sl_rec_log_offset;
 
-	if (data_log->dlf_log_eof < sizeof(XTXactLogHeaderDRec)) {
+	if ((size_t) data_log->dlf_log_eof < sizeof(XTXactLogHeaderDRec)) {
 		data_log->dlf_log_eof = sizeof(XTXactLogHeaderDRec);
 		if (!dl_create_log_header(data_log, seq_read.sl_log_file, self))
 			xt_throw(self);
@@ -2015,7 +2015,8 @@
 	int				count;
 	void			*mysql_thread;
 
-	mysql_thread = myxt_create_thread();
+	if (!(mysql_thread = myxt_create_thread()))
+		xt_throw(self);
 
 	while (!self->t_quit) {
 		try_(a) {
@@ -2068,7 +2069,10 @@
 		}
 	}
 
+   /*
+	* {MYSQL-THREAD-KILL}
 	myxt_destroy_thread(mysql_thread, TRUE);
+	*/
 	return NULL;
 }
 

=== modified file 'storage/pbxt/src/discover_xt.cc'
--- storage/pbxt/src/discover_xt.cc	2009-08-17 11:12:36 +0000
+++ storage/pbxt/src/discover_xt.cc	2009-09-03 13:20:22 +0000
@@ -493,8 +493,8 @@
     }
     /* Don't pack rows in old tables if the user has requested this */
     if ((sql_field->flags & BLOB_FLAG) ||
-	sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
-	create_info->row_type != ROW_TYPE_FIXED)
+	(sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
+         create_info->row_type != ROW_TYPE_FIXED))
       (*db_options)|= HA_OPTION_PACK_RECORD;
     it2.rewind();
   }
@@ -963,7 +963,7 @@
 	    sql_field->sql_type == MYSQL_TYPE_VARCHAR ||
 	    sql_field->pack_flag & FIELDFLAG_BLOB)))
       {
-	if (column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB) ||
+	if ((column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB)) ||
             sql_field->sql_type == MYSQL_TYPE_VARCHAR)
 	  key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY;
 	else

=== modified file 'storage/pbxt/src/filesys_xt.cc'
--- storage/pbxt/src/filesys_xt.cc	2009-08-18 07:46:53 +0000
+++ storage/pbxt/src/filesys_xt.cc	2009-09-03 06:15:03 +0000
@@ -55,6 +55,7 @@
 //#define DEBUG_TRACE_MAP_IO
 //#define DEBUG_TRACE_FILES
 //#define INJECT_WRITE_REMAP_ERROR
+/* This is required to make testing on the Mac faster: */
 #endif
 
 #ifdef DEBUG_TRACE_FILES
@@ -62,6 +63,10 @@
 #define PRINTF		xt_trace
 #endif
 
+#if defined(XT_MAC) && defined(F_FULLFSYNC)
+#undef F_FULLFSYNC
+#endif
+
 #ifdef INJECT_WRITE_REMAP_ERROR
 #define INJECT_REMAP_FILE_SIZE			1000000
 #define INJECT_REMAP_FILE_TYPE			"xtd"

=== modified file 'storage/pbxt/src/ha_pbxt.cc'
--- storage/pbxt/src/ha_pbxt.cc	2009-08-18 07:46:53 +0000
+++ storage/pbxt/src/ha_pbxt.cc	2009-09-03 06:15:03 +0000
@@ -71,6 +71,7 @@
 #include "tabcache_xt.h"
 #include "systab_xt.h"
 #include "xaction_xt.h"
+#include "restart_xt.h"
 
 #ifdef DEBUG
 //#define XT_USE_SYS_PAR_DEBUG_SIZES
@@ -105,8 +106,6 @@
 static void		ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share);
 static void		ha_close_open_tables(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);
 
-extern void		xt_xres_start_database_recovery(XTThreadPtr self);
-
 #ifdef TRACE_STATEMENTS
 
 #ifdef PRINT_STATEMENTS
@@ -463,8 +462,14 @@
 	if (!self->st_database) {
 		if (!pbxt_database) {
 			xt_open_database(self, mysql_real_data_home, TRUE);
-			pbxt_database = self->st_database;
-			xt_heap_reference(self, pbxt_database);
+			/* {GLOBAL-DB}
+			 * This can be done at the same time as the recovery thread,
+			 * strictly speaking I need a lock.
+			 */
+			if (!pbxt_database) {
+				pbxt_database = self->st_database;
+				xt_heap_reference(self, pbxt_database);
+			}
 		}
 		else
 			xt_use_database(self, pbxt_database, XT_FOR_USER);
@@ -963,6 +968,8 @@
  */
 static void ha_exit(XTThreadPtr self)
 {
+	xt_xres_wait_for_recovery(self);
+
 	/* Wrap things up... */
 	xt_unuse_database(self, self);	/* Just in case the main thread has a database in use (for testing)? */
 	/* This may cause the streaming engine to cleanup connections and 

=== modified file 'storage/pbxt/src/memory_xt.cc'
--- storage/pbxt/src/memory_xt.cc	2009-08-17 11:12:36 +0000
+++ storage/pbxt/src/memory_xt.cc	2009-09-03 06:15:03 +0000
@@ -34,7 +34,7 @@
 #include "trace_xt.h"
 
 #ifdef DEBUG
-#define RECORD_MM
+//#define RECORD_MM
 #endif
 
 #ifdef DEBUG

=== modified file 'storage/pbxt/src/myxt_xt.cc'
--- storage/pbxt/src/myxt_xt.cc	2009-08-18 07:46:53 +0000
+++ storage/pbxt/src/myxt_xt.cc	2009-09-03 06:15:03 +0000
@@ -1957,7 +1957,7 @@
 		xt_free(self, table);
 		lex_end(&new_lex);
 		thd->lex = old_lex;
-		xt_throw_ulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, (u_long) error);
+		xt_throw_sulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, tab_path->ps_path, (u_long) error);
 		return NULL;
 	}
 #else
@@ -1975,11 +1975,23 @@
 #endif
 #endif
 
+	/* If MySQL shutsdown while we are just starting up, they
+	 * they kill the plugin sub-system before calling
+	 * shutdown for the engine!
+	 */
+	if (!ha_resolve_by_legacy_type(thd, DB_TYPE_PBXT)) {
+		xt_free(self, table);
+		lex_end(&new_lex);
+		thd->lex = old_lex;
+		xt_throw_xterr(XT_CONTEXT, XT_ERR_MYSQL_SHUTDOWN);
+		return NULL;
+	}
+
 	if ((error = open_table_def(thd, share, 0))) {
 		xt_free(self, table);
 		lex_end(&new_lex);
 		thd->lex = old_lex;
-		xt_throw_ulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, (u_long) error);
+		xt_throw_sulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, tab_path->ps_path, (u_long) error);
 		return NULL;
 	}
 
@@ -1992,7 +2004,7 @@
 		xt_free(self, table);
 		lex_end(&new_lex);
 		thd->lex = old_lex;
-		xt_throw_ulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, (u_long) error);
+		xt_throw_sulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, tab_path->ps_path, (u_long) error);
 		return NULL;
 	}
 #endif
@@ -2959,6 +2971,46 @@
 		return NULL;
 	}
 
+	/*
+	 * Unfortunately, if PBXT is the default engine, and we are shutting down
+	 * then global_system_variables.table_plugin may be NULL. Which will cause
+	 * a crash if we try to create a thread!
+	 *
+	 * The following call in plugin_shutdown() sets the global reference
+	 * to NULL:
+	 *
+	 * unlock_variables(NULL, &global_system_variables);
+	 *
+	 * Later plugin_deinitialize() is called.
+	 *
+	 * The following stack is an example crash which occurs when I call
+	 * myxt_create_thread() in ha_exit(), to force the error.
+	 *
+	 *   if (pi->state & (PLUGIN_IS_READY | PLUGIN_IS_UNINITIALIZED))
+	 *   pi is NULL!
+	 * #0	0x002ff684 in intern_plugin_lock at sql_plugin.cc:617
+	 * #1	0x0030296d in plugin_thdvar_init at sql_plugin.cc:2432
+	 * #2	0x000db4a4 in THD::init at sql_class.cc:756
+	 * #3	0x000e02ed in THD::THD at sql_class.cc:638
+	 * #4	0x00e2678d in myxt_create_thread at myxt_xt.cc:2990
+	 * #5	0x00e05d43 in ha_exit at ha_pbxt.cc:1011
+	 * #6	0x00e065c2 in pbxt_end at ha_pbxt.cc:1330
+	 * #7	0x00e065df in pbxt_panic at ha_pbxt.cc:1343
+	 * #8	0x0023e57d in ha_finalize_handlerton at handler.cc:392
+	 * #9	0x002ffc8b in plugin_deinitialize at sql_plugin.cc:816
+	 * #10	0x003037d9 in plugin_shutdown at sql_plugin.cc:1572
+	 * #11	0x000f7b2b in clean_up at mysqld.cc:1266
+	 * #12	0x000f7fca in unireg_end at mysqld.cc:1192
+	 * #13	0x000fa021 in kill_server at mysqld.cc:1134
+	 * #14	0x000fa6df in kill_server_thread at mysqld.cc:1155
+	 * #15	0x91fdb155 in _pthread_start
+	 * #16	0x91fdb012 in thread_start
+	 */
+	if (!global_system_variables.table_plugin) {
+		xt_register_xterr(XT_REG_CONTEXT, XT_ERR_MYSQL_NO_THREAD);
+		return NULL;
+	}
+
 	if (!(new_thd = new THD())) {
 		my_thread_end();
 		xt_register_error(XT_REG_CONTEXT, XT_ERR_MYSQL_ERROR, 0, "Unable to create MySQL thread (THD)");
@@ -2977,6 +3029,10 @@
 xtPublic void myxt_destroy_thread(void *, xtBool)
 {
 }
+
+xtPublic void myxt_delete_remaining_thread()
+{
+}
 #else
 xtPublic void myxt_destroy_thread(void *thread, xtBool end_threads)
 {
@@ -3004,6 +3060,14 @@
 	if (end_threads)
 		my_thread_end();
 }
+
+xtPublic void myxt_delete_remaining_thread()
+{
+	THD *thd;
+
+	if ((thd = current_thd))
+		myxt_destroy_thread((void *) thd, TRUE);
+}
 #endif
 
 xtPublic XTThreadPtr myxt_get_self()

=== modified file 'storage/pbxt/src/myxt_xt.h'
--- storage/pbxt/src/myxt_xt.h	2009-08-18 07:46:53 +0000
+++ storage/pbxt/src/myxt_xt.h	2009-09-03 06:15:03 +0000
@@ -81,6 +81,7 @@
 
 void		*myxt_create_thread();
 void		myxt_destroy_thread(void *thread, xtBool end_threads);
+void		myxt_delete_remaining_thread();
 XTThreadPtr	myxt_get_self();
 
 int			myxt_statistics_fill_table(XTThreadPtr self, void *th, void *ta, void *co, MX_CONST void *ch);

=== modified file 'storage/pbxt/src/restart_xt.cc'
--- storage/pbxt/src/restart_xt.cc	2009-08-18 07:46:53 +0000
+++ storage/pbxt/src/restart_xt.cc	2009-09-03 06:15:03 +0000
@@ -2551,7 +2551,8 @@
 	int				count;
 	void			*mysql_thread;
 
-	mysql_thread = myxt_create_thread();
+	if (!(mysql_thread = myxt_create_thread()))
+		xt_throw(self);
 
 	while (!self->t_quit) {
 		try_(a) {
@@ -2588,7 +2589,10 @@
 		}
 	}
 
+   /*
+	* {MYSQL-THREAD-KILL}
 	myxt_destroy_thread(mysql_thread, TRUE);
+	*/
 	return NULL;
 }
 
@@ -3179,22 +3183,74 @@
  * D A T A B A S E   R E C O V E R Y   T H R E A D
  */
 
-extern XTDatabaseHPtr pbxt_database;
+extern XTDatabaseHPtr	pbxt_database;
+static XTThreadPtr		xres_recovery_thread;
 
 static void *xn_xres_run_recovery_thread(XTThreadPtr self)
 {
 	THD *mysql_thread;
 
-	mysql_thread = (THD *)myxt_create_thread();
+	if (!(mysql_thread = (THD *) myxt_create_thread()))
+		xt_throw(self);
 
-	while(!ha_resolve_by_legacy_type(mysql_thread, DB_TYPE_PBXT))
+	while (!xres_recovery_thread->t_quit && !ha_resolve_by_legacy_type(mysql_thread, DB_TYPE_PBXT))
 		xt_sleep_milli_second(1);
 
-	xt_open_database(self, mysql_real_data_home, TRUE);
-	pbxt_database = self->st_database;
-	xt_heap_reference(self, pbxt_database);
+	if (!xres_recovery_thread->t_quit) {
+		/* {GLOBAL-DB}
+		 * It can happen that something will just get in before this
+		 * thread and open/recover the database!
+		 */
+		if (!pbxt_database) {
+			try_(a) {
+				xt_open_database(self, mysql_real_data_home, TRUE);
+				/* This can be done at the same time by a foreground thread,
+				 * strictly speaking I need a lock.
+				 */
+				if (!pbxt_database) {
+					pbxt_database = self->st_database;
+					xt_heap_reference(self, pbxt_database);
+				}
+			}
+			catch_(a) {
+				xt_log_and_clear_exception(self);
+			}
+			cont_(a);
+		}
+	}
+
+   /*
+    * {MYSQL-THREAD-KILL}
+	* Here is the problem with destroying the thread at this
+	* point. If we had an error started, then it can lead
+	* to a callback into pbxt: pbxt_panic().
+	*
+	* This will shutdown things, making it impossible quite the
+	* thread and do a cleanup. Solution:
+	*
+	* Move the MySQL thread descruction to a later point!
+	*
+	* sql/mysqld --no-defaults --basedir=~/maria/trunk 
+	* --character-sets-dir=~/maria/trunk/sql/share/charsets 
+	* --language=~/maria/trunk/sql/share/english 
+	* --skip-networking --datadir=/tmp/x --skip-grant-tables --nonexistentoption 
+	*
+	* #0	0x003893f9 in xt_exit_databases at database_xt.cc:304
+	* #1	0x0039dc7e in pbxt_end at ha_pbxt.cc:947
+	* #2	0x0039dd27 in pbxt_panic at ha_pbxt.cc:1289
+	* #3	0x001d619e in ha_finalize_handlerton at handler.cc:391
+	* #4	0x00279d22 in plugin_deinitialize at sql_plugin.cc:816
+	* #5	0x0027bcf5 in reap_plugins at sql_plugin.cc:904
+	* #6	0x0027c38c in plugin_thdvar_cleanup at sql_plugin.cc:2513
+	* #7	0x000c0db2 in THD::~THD at sql_class.cc:934
+	* #8	0x003b025b in myxt_destroy_thread at myxt_xt.cc:2999
+	* #9	0x003b66b5 in xn_xres_run_recovery_thread at restart_xt.cc:3196
+	* #10	0x003cbfbb in thr_main at thread_xt.cc:1020
+	*
 	myxt_destroy_thread(mysql_thread, TRUE);
+	*/
 
+	xres_recovery_thread = NULL;
 	return NULL;
 }
 
@@ -3204,6 +3260,23 @@
 
 	sprintf(name, "DB-RECOVERY-%s", xt_last_directory_of_path(mysql_real_data_home));
 	xt_remove_dir_char(name);
-	XTThreadPtr thread = xt_create_daemon(self, name);
-	xt_run_thread(self, thread, xn_xres_run_recovery_thread);
+
+	xres_recovery_thread = xt_create_daemon(self, name);
+	xt_run_thread(self, xres_recovery_thread, xn_xres_run_recovery_thread);
+}
+
+xtPublic void xt_xres_wait_for_recovery(XTThreadPtr self)
+{
+	XTThreadPtr thr_rec;
+
+	/* {MYSQL-THREAD-KILL}
+	 * Stack above shows that his is possible!
+	 */
+	if ((thr_rec = xres_recovery_thread) && (self != xres_recovery_thread)) {
+		xtThreadID tid = thr_rec->t_id;
+
+		xt_terminate_thread(self, thr_rec);
+
+		xt_wait_for_thread(tid, TRUE);
+	}
 }

=== modified file 'storage/pbxt/src/restart_xt.h'
--- storage/pbxt/src/restart_xt.h	2009-08-17 11:12:36 +0000
+++ storage/pbxt/src/restart_xt.h	2009-09-03 06:15:03 +0000
@@ -131,6 +131,7 @@
 void xt_print_log_record(xtLogID log, off_t offset, XTXactLogBufferDPtr record);
 void xt_dump_xlogs(struct XTDatabase *db, xtLogID start_log);
 
-xtPublic void xt_xres_start_database_recovery(XTThreadPtr self, const char *path);
+void xt_xres_start_database_recovery(XTThreadPtr self);
+void xt_xres_wait_for_recovery(XTThreadPtr self);
 
 #endif

=== modified file 'storage/pbxt/src/strutil_xt.cc'
--- storage/pbxt/src/strutil_xt.cc	2009-08-18 07:46:53 +0000
+++ storage/pbxt/src/strutil_xt.cc	2009-09-03 06:15:03 +0000
@@ -368,7 +368,7 @@
 /* Version number must also be set in configure.in! */
 xtPublic c_char *xt_get_version(void)
 {
-	return "1.0.08c RC";
+	return "1.0.08d RC";
 }
 
 /* Copy and URL decode! */

=== modified file 'storage/pbxt/src/tabcache_xt.cc'
--- storage/pbxt/src/tabcache_xt.cc	2009-08-17 11:12:36 +0000
+++ storage/pbxt/src/tabcache_xt.cc	2009-09-03 06:15:03 +0000
@@ -1178,7 +1178,10 @@
 		}
 	}
 
+   /*
+	* {MYSQL-THREAD-KILL}
 	myxt_destroy_thread(mysql_thread, TRUE);
+	*/
 	return NULL;
 }
 

=== modified file 'storage/pbxt/src/thread_xt.cc'
--- storage/pbxt/src/thread_xt.cc	2009-08-17 11:12:36 +0000
+++ storage/pbxt/src/thread_xt.cc	2009-09-03 06:15:03 +0000
@@ -625,7 +625,7 @@
 		case XT_ERR_NO_REFERENCED_ROW:		str = "Constraint: `%s`"; break;  // "Foreign key '%s', referenced row does not exist"
 		case XT_ERR_ROW_IS_REFERENCED:		str = "Constraint: `%s`"; break;  // "Foreign key '%s', has a referencing row"
 		case XT_ERR_BAD_DICTIONARY:			str = "Internal dictionary does not match MySQL dictionary"; break;
-		case XT_ERR_LOADING_MYSQL_DIC:		str = "Error %s loading MySQL .frm file"; break;
+		case XT_ERR_LOADING_MYSQL_DIC:		str = "Error loading %s.frm file, MySQL error: %s"; break;
 		case XT_ERR_COLUMN_IS_NOT_NULL:		str = "Column `%s` is NOT NULL"; break;
 		case XT_ERR_INCORRECT_NO_OF_COLS:	str = "Incorrect number of columns near %s"; break;
 		case XT_ERR_FK_ON_TEMP_TABLE:		str = "Cannot create foreign key on temporary table"; break;
@@ -656,6 +656,8 @@
 		case XT_ERR_NEW_TYPE_OF_XLOG:		str = "Transaction log %s, is using a newer format, upgrade required"; break;
 		case XT_ERR_NO_BEFORE_IMAGE:		str = "Internal error: no before image"; break;
 		case XT_ERR_FK_REF_TEMP_TABLE:		str = "Foreign key may not reference temporary table"; break;
+		case XT_ERR_MYSQL_SHUTDOWN:			str = "Cannot open table, MySQL has shutdown"; break;
+		case XT_ERR_MYSQL_NO_THREAD:		str = "Cannot create thread, MySQL has shutdown"; break;
 		default:							str = "Unknown XT error"; break;
 	}
 	return str;
@@ -1026,6 +1028,11 @@
 
 	outer_();
 	xt_free_thread(self);
+	
+	/* {MYSQL-THREAD-KILL}
+	 * Clean up any remaining MySQL thread!
+	 */
+	myxt_delete_remaining_thread();
 	return return_data;
 }
 

=== modified file 'storage/pbxt/src/xaction_xt.cc'
--- storage/pbxt/src/xaction_xt.cc	2009-08-17 11:12:36 +0000
+++ storage/pbxt/src/xaction_xt.cc	2009-09-03 06:15:03 +0000
@@ -2529,7 +2529,8 @@
 	int				count;
 	void			*mysql_thread;
 
-	mysql_thread = myxt_create_thread();
+	if (!(mysql_thread = myxt_create_thread()))
+		xt_throw(self);
 
 	while (!self->t_quit) {
 		try_(a) {
@@ -2586,7 +2587,10 @@
 		db->db_sw_idle = XT_THREAD_BUSY;
 	}
 
+   /*
+	* {MYSQL-THREAD-KILL}
 	myxt_destroy_thread(mysql_thread, TRUE);
+	*/
 	return NULL;
 }
 

=== modified file 'storage/pbxt/src/xactlog_xt.cc'
--- storage/pbxt/src/xactlog_xt.cc	2009-08-18 07:46:53 +0000
+++ storage/pbxt/src/xactlog_xt.cc	2009-09-03 06:15:03 +0000
@@ -2610,7 +2610,10 @@
 		db->db_wr_idle = XT_THREAD_BUSY;
 	}
 
+   /*
+	* {MYSQL-THREAD-KILL}
 	myxt_destroy_thread(mysql_thread, TRUE);
+	*/
 	return NULL;
 }
 

=== modified file 'storage/pbxt/src/xt_errno.h'
--- storage/pbxt/src/xt_errno.h	2009-03-26 12:18:01 +0000
+++ storage/pbxt/src/xt_errno.h	2009-09-03 06:15:03 +0000
@@ -117,6 +117,8 @@
 #define XT_ERR_NEW_TYPE_OF_XLOG		-93
 #define XT_ERR_NO_BEFORE_IMAGE		-94
 #define XT_ERR_FK_REF_TEMP_TABLE	-95
+#define XT_ERR_MYSQL_SHUTDOWN		-98
+#define XT_ERR_MYSQL_NO_THREAD		-99
 
 #ifdef XT_WIN
 #define XT_ENOMEM					ERROR_NOT_ENOUGH_MEMORY

=== modified file 'storage/xtradb/fil/fil0fil.c'
--- storage/xtradb/fil/fil0fil.c	2009-09-01 11:59:54 +0000
+++ storage/xtradb/fil/fil0fil.c	2009-09-03 13:20:22 +0000
@@ -45,7 +45,9 @@
 #include "trx0trx.h"
 #include "trx0sys.h"
 #include "pars0pars.h"
+#include "row0row.h"
 #include "row0mysql.h"
+#include "que0que.h"
 
 
 /*
@@ -3137,7 +3139,7 @@
 
 			rec_offs_init(offsets_);
 
-			fprintf(stderr, "InnoDB: Progress in %:");
+			fprintf(stderr, "%s", "InnoDB: Progress in %:");
 
 			for (offset = 0; offset < size_bytes; offset += UNIV_PAGE_SIZE) {
 				success = os_file_read(file, page,

=== modified file 'storage/xtradb/mtr/mtr0mtr.c'
--- storage/xtradb/mtr/mtr0mtr.c	2009-06-25 01:43:25 +0000
+++ storage/xtradb/mtr/mtr0mtr.c	2009-09-03 13:20:22 +0000
@@ -32,6 +32,7 @@
 #include "page0types.h"
 #include "mtr0log.h"
 #include "log0log.h"
+#include "buf0flu.h"
 
 /*********************************************************************
 Releases the item in the slot given. */

=== modified file 'storage/xtradb/srv/srv0srv.c'
--- storage/xtradb/srv/srv0srv.c	2009-09-01 11:59:54 +0000
+++ storage/xtradb/srv/srv0srv.c	2009-09-03 13:20:22 +0000
@@ -1815,7 +1815,6 @@
 	ulint	btr_search_sys_subtotal;
 	ulint	lock_sys_subtotal;
 	ulint	recv_sys_subtotal;
-	ulint	io_counter_subtotal;
 
 	ulint	i;
 	trx_t*	trx;

=== modified file 'storage/xtradb/srv/srv0start.c'
--- storage/xtradb/srv/srv0start.c	2009-08-03 20:09:53 +0000
+++ storage/xtradb/srv/srv0start.c	2009-09-03 13:20:22 +0000
@@ -122,20 +122,6 @@
 #define SRV_MAX_N_PENDING_SYNC_IOS	100
 
 
-/* Avoid warnings when using purify */
-
-#ifdef HAVE_valgrind
-static int inno_bcmp(register const char *s1, register const char *s2,
-	register uint len)
-{
-	while ((len-- != 0) && (*s1++ == *s2++))
-		;
-
-	return(len + 1);
-}
-#define memcmp(A,B,C) inno_bcmp((A),(B),(C))
-#endif
-
 static
 char*
 srv_parse_megabytes(

=== modified file 'strings/decimal.c'
--- strings/decimal.c	2009-05-06 12:03:24 +0000
+++ strings/decimal.c	2009-09-03 13:20:22 +0000
@@ -306,7 +306,7 @@
   {
     for (i= DIG_PER_DEC1 - ((frac - 1) % DIG_PER_DEC1);
          *buf0 % powers10[i++] == 0;
-         frac--);
+         frac--) {}
   }
   return frac;
 }
@@ -500,7 +500,7 @@
     stop= (int) ((buf_end - from->buf + 1) * DIG_PER_DEC1);
     i= 1;
   }
-  for (; *buf_end % powers10[i++] == 0; stop--);
+  for (; *buf_end % powers10[i++] == 0; stop--) {}
   *end_result= stop; /* index of position after last decimal digit (from 0) */
 }
 
@@ -1011,7 +1011,7 @@
 
   sanity(to);
 
-  for (intg1=1; from >= DIG_BASE; intg1++, from/=DIG_BASE);
+  for (intg1=1; from >= DIG_BASE; intg1++, from/=DIG_BASE) {}
   if (unlikely(intg1 > to->len))
   {
     intg1=to->len;

=== added file 'support-files/ccfilter'
--- support-files/ccfilter	1970-01-01 00:00:00 +0000
+++ support-files/ccfilter	2009-09-03 13:20:22 +0000
@@ -0,0 +1,104 @@
+#! /usr/bin/perl
+
+# Post-processor for compiler output to filter out warnings matched in
+# support-files/compiler_warnings.supp. This makes it easier to check
+# that no new warnings are introduced without needing to submit a build
+# for Buildbot.
+#
+# Use by setting CC="ccfilter gcc" CXX="ccfilter gcc" before ./configure.
+#
+# By default, just filters the output for suppressed warnings. If the
+# FAILONWARNING environment variable is set, then instead will fail the
+# compile on encountering a non-suppressed warnings.
+
+use strict;
+use warnings;
+
+my $suppressions;
+
+open STDOUT_COPY, ">&STDOUT"
+    or die "Failed to dup stdout: $!]n";
+
+my $pid= open(PIPE, '-|');
+
+if (!defined($pid)) {
+  die "Error: Cannot fork(): $!\n";
+} elsif (!$pid) {
+  # Child.
+  # actually want to send the STDERR to the parent, not the STDOUT.
+  # So shuffle things around a bit.
+  open STDERR, ">&STDOUT"
+      or die "Child: Failed to dup pipe to parent: $!\n";
+  open STDOUT, ">&STDOUT_COPY"
+      or die "Child: Failed to dup parent stdout: $!\n";
+  close STDOUT_COPY;
+  exec { $ARGV[0] } @ARGV;
+  die "Child: exec() failed: $!\n";
+} else {
+  # Parent.
+  close STDOUT_COPY;
+  my $cwd= qx(pwd);
+  chomp($cwd);
+  while (<PIPE>) {
+    my $line= $_;
+    if (/^(.*?):([0-9]+): [Ww]arning: (.*)$/) {
+      my ($file, $lineno, $msg)= ($1, $2, $3);
+      $file= "$cwd/$file";
+
+      next
+          if check_if_suppressed($file, $lineno, $msg);
+      die "$line\nGot warning, terminating.\n"
+          if $ENV{FAILONWARNING};
+      print STDERR $line;
+      next;
+    }
+
+    print STDERR $line;
+  }
+  close(PIPE);
+}
+
+exit 0;
+
+sub check_if_suppressed {
+  my ($file, $lineno, $msg)= @_;
+  load_suppressions() unless defined($suppressions);
+  for my $s (@$suppressions) {
+    my ($file_re, $msg_re, $start, $end)= @$s;
+    if ($file =~ /$file_re/ &&
+        $msg =~ /$msg_re/ &&
+        (!defined($start) || $start <= $lineno) &&
+        (!defined($end) || $end >= $lineno)) {
+      return 1;
+    }
+  }
+  return undef;
+}
+
+sub load_suppressions {
+  # First find the suppressions file, might be we need to move up to
+  # the base directory.
+  my $path = "support-files/compiler_warnings.supp";
+  my $exists;
+  for (1..10) {
+    $exists= -f $path;
+    last if $exists;
+    $path= '../'. $path;
+  }
+  die "Error: Could not find suppression file (out of source dir?).\n"
+      unless $exists;
+
+  $suppressions= [];
+  open "F", "<", $path
+      or die "Error: Could not read suppression file '$path': $!\n";
+  while (<F>) {
+    # Skip comment and empty lines.
+    next if /^\s*(\#.*)?$/;
+    die "Invalid syntax in suppression file '$path', line $.:\n$_"
+        unless /^\s*(.+?)\s*:\s*(.+?)\s*(?:[:]\s*([0-9]+)(?:-([0-9]+))?\s*)?$/;
+    my ($file_re, $line_re, $start, $end)= ($1, $2, $3, $4);
+    $end = $start
+        if defined($start) && !defined($end);
+    push @$suppressions, [$file_re, $line_re, $start, $end];
+  }
+}

=== modified file 'support-files/compiler_warnings.supp'
--- support-files/compiler_warnings.supp	2008-01-11 17:39:43 +0000
+++ support-files/compiler_warnings.supp	2009-09-03 13:20:22 +0000
@@ -25,6 +25,9 @@
 pars0grm.tab.c: .*'yyerrorlab' : unreferenced label.*
 _flex_tmp.c: .*not enough actual parameters for macro 'yywrap'.*
 pars0lex.l: .*conversion from 'ulint' to 'int', possible loss of data.*
+btr/btr0cur\.c: .*value computed is not used.*: 3175-3375
+include/buf0buf\.ic: unused parameter ‘mtr’
+fil/fil0fil\.c: comparison between signed and unsigned : 3100-3199
 
 #
 # bdb is not critical to keep up to date
@@ -41,6 +44,12 @@
 .*/cmd-line-utils/readline/.* : .*
 
 #
+# Ignore some warnings in libevent, which is not maintained by us.
+#
+.*/extra/libevent/.* : .*unused parameter.*
+.*/extra/libevent/select\.c : .*comparison between signed and unsigned.* : 270-280
+
+#
 # Ignore all conversion warnings on windows 64
 # (Is safe as we are not yet supporting strings >= 2G)
 #
@@ -75,6 +84,17 @@
 storage/maria/ma_pagecache.c: .*'info_check_pin' defined but not used
 
 #
+# I think these are due to mix of C and C++.
+#
+storage/pbxt/ : typedef.*was ignored in this declaration
+
+
+#
+# Groff warnings on OpenSUSE.
+#
+.*/dbug/.*(groff|<standard input>) : .*
+
+#
 # Unexplanable (?) stuff
 #
 listener.cc : .*conversion from 'SOCKET' to 'int'.*