diff --git a/.bzrignore b/.bzrignore
index 1a756801461ffe5ca721cf24be3243441a3d07c9..7d2c00136efef7ae18c0dd574b875d5d0684ccfd 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -907,3 +907,4 @@ vio/test-ssl
 vio/test-sslclient
 vio/test-sslserver
 vio/viotest-ssl
+support-files/my-innodb-heavy-4G.cnf
diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright
index 92b8f13bf48ce25786b47667387b3da6e499ad68..77a90fbf4e4c99fecfab237d117ae7723bb167d7 100755
--- a/Build-tools/mysql-copyright
+++ b/Build-tools/mysql-copyright
@@ -204,7 +204,7 @@ sub trim_the_fat
                 open(CONFIGURE,">configure.in") or die "Unable to open configure.in for write: $!\n";
                 print CONFIGURE $configure;
                 close(CONFIGURE);
-                `autoconf`;
+                `aclocal && autoheader && aclocal && automake && autoconf`;
                 die "'./configure' was not produced!" unless (-f "configure");
                 chdir("$cwd");
         }
diff --git a/myisam/mi_key.c b/myisam/mi_key.c
index 8f5f0e829ef04ff51d2c5899542f10bf8f36ec4e..043dd7c68843e745681e6c30506c3e8ce2776c99 100644
--- a/myisam/mi_key.c
+++ b/myisam/mi_key.c
@@ -25,9 +25,12 @@
 
 #define CHECK_KEYS
 
-#define FIX_LENGTH if (length > char_length) \
-                     char_length= my_charpos(cs, pos, pos+length, char_length); \
-                   set_if_smaller(char_length,length); \
+#define FIX_LENGTH                                                          \
+            do {                                                            \
+              if (length > char_length)                                     \
+                char_length= my_charpos(cs, pos, pos+length, char_length);  \
+              set_if_smaller(char_length,length);                           \
+            } while(0)
 
 static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record);
 
@@ -157,7 +160,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
     FIX_LENGTH;
     memcpy((byte*) key, pos, char_length);
     if (length > char_length)
-      bfill(key+char_length, length-char_length, ' ');
+      cs->cset->fill(cs, key+char_length, length-char_length, ' ');
     key+= length;
   }
   _mi_dpointer(info,key,filepos);
@@ -267,7 +270,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
     FIX_LENGTH;
     memcpy((byte*) key, pos, char_length);
     if (length > char_length)
-      bfill(key+char_length, length-char_length, ' ');
+      cs->cset->fill(cs,key+char_length, length-char_length, ' ');
     key+= length;
     k_length-=length;
   }
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 58d7af75284b056006cb2252be6c61738a06defd..454dc7b327b32c4224bc51e0891dddb7d55d6ff7 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -367,10 +367,12 @@ while test $# -gt 0; do
       VALGRIND=`which valgrind` # this will print an error if not found
       # Give good warning to the user and stop
       if [ -z "$VALGRIND" ] ; then
-        $ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://developer.kde.org/~sewardj ."
+        $ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ."
         exit 1
       fi
-      VALGRIND="$VALGRIND --tool=memcheck --alignment=8 --leak-check=yes --num-callers=16"
+      # >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
+      valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && VALGRIND="$VALGRIND --tool=memcheck"
+      VALGRIND="$VALGRIND --alignment=8 --leak-check=yes --num-callers=16"
       EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc --skip-bdb"
       EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc --skip-bdb"
       SLEEP_TIME_AFTER_RESTART=10
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index ef5ec012078a72175b28f3bc84e231fa8380d3cf..38fc8e17d141629f54ed6f513d7cf8085a667f96 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -412,6 +412,36 @@ select c as c_a from t1 where c='б';
 c_a
 б
 drop table t1;
+create table t1 (
+c char(10) character set utf8,
+unique key a (c(1))
+) engine=bdb;
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+insert into t1 values ('aa');
+ERROR 23000: Duplicate entry 'aa' for key 1
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+select c as c_all from t1 order by c;
+c_all
+a
+b
+c
+d
+e
+f
+б
+select c as c_a from t1 where c='a';
+c_a
+a
+select c as c_a from t1 where c='б';
+c_a
+б
+drop table t1;
 create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10)));
 insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
 insert into t1 values ('aaaaaaaaaa');
@@ -541,6 +571,36 @@ c_a
 б
 drop table t1;
 create table t1 (
+c char(10) character set utf8 collate utf8_bin,
+unique key a (c(1))
+) engine=bdb;
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+insert into t1 values ('aa');
+ERROR 23000: Duplicate entry 'aa' for key 1
+insert into t1 values ('aaa');
+ERROR 23000: Duplicate entry 'aaa' for key 1
+insert into t1 values ('б');
+insert into t1 values ('бб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+insert into t1 values ('ббб');
+ERROR 23000: Duplicate entry 'бÐ' for key 1
+select c as c_all from t1 order by c;
+c_all
+a
+b
+c
+d
+e
+f
+б
+select c as c_a from t1 where c='a';
+c_a
+a
+select c as c_a from t1 where c='б';
+c_a
+б
+drop table t1;
+create table t1 (
 str varchar(255) character set utf8 not null,
 key str  (str(2))
 ) engine=myisam;
@@ -570,3 +630,13 @@ select * from t1 where str='str';
 str
 str
 drop table t1;
+create table t1 (
+str varchar(255) character set utf8 not null,
+key str (str(2))
+) engine=bdb;
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+str
+str
+drop table t1;
diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result
index 4918617f85fb912b6f9c0aa6dbb5b6a9f3d57e03..2431406c1287764c2488483dce6c0337d9f110ae 100644
--- a/mysql-test/r/func_set.result
+++ b/mysql-test/r/func_set.result
@@ -41,8 +41,7 @@ interval(null, 1, 10, 100)
 -1
 drop table if exists t1,t2;
 create  table t1 (id int(10) not null unique);
-create  table t2 (id int(10) not null primary key,
-val int(10) not null);
+create  table t2 (id int(10) not null primary key, val int(10) not null);
 insert into t1 values (1),(2),(4);
 insert into t2 values (1,1),(2,1),(3,1),(4,2);
 select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id;
@@ -56,3 +55,12 @@ id	elt(two.val,'one','two')
 2	one
 4	two
 drop table t1,t2;
+select find_in_set(binary 'a',binary 'A,B,C');
+find_in_set(binary 'a',binary 'A,B,C')
+0
+select find_in_set('a',binary 'A,B,C');
+find_in_set('a',binary 'A,B,C')
+0
+select find_in_set(binary 'a', 'A,B,C');
+find_in_set(binary 'a', 'A,B,C')
+0
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index d777bd184b237258090bb9c146121cb33442bc81..74a6cb72cc65613045fee8e2bacd7bec5a59d7c1 100644
--- a/mysql-test/r/truncate.result
+++ b/mysql-test/r/truncate.result
@@ -31,4 +31,25 @@ SELECT * from t1;
 a
 1
 2
+delete from t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+a
+3
+4
+drop table t1;
+create temporary table t1 (a integer auto_increment primary key);
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+a
+1
+2
+delete from t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+a
+3
+4
 drop table t1;
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 41ea95cf93318814d47485dd4ddf3074be4f8ab5..5d3f32cdd55e6eb63a43d0b3d5ca707f36ad8f3b 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -436,3 +436,19 @@ SELECT @@global.session.key_buffer_size;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1
 SELECT @@global.local.key_buffer_size;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1
+set @tstlw = @@log_warnings;
+show global variables like 'log_warnings';
+Variable_name	Value
+log_warnings	1
+set global log_warnings = 0;
+show global variables like 'log_warnings';
+Variable_name	Value
+log_warnings	0
+set global log_warnings = 42;
+show global variables like 'log_warnings';
+Variable_name	Value
+log_warnings	42
+set global log_warnings = @tstlw;
+show global variables like 'log_warnings';
+Variable_name	Value
+log_warnings	1
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 83055d058302b3046ca304660c1b57a30ab93f66..4624f2ec78cab363ebeded36553d2be65e0559f2 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -294,6 +294,30 @@ select c as c_a from t1 where c='a';
 select c as c_a from t1 where c='б';
 drop table t1;
 
+#
+# Bug 4531: unique key prefix interacts poorly with utf8
+# Check BDB, case insensitive collation
+#
+--disable_warnings
+create table t1 (
+c char(10) character set utf8,
+unique key a (c(1))
+) engine=bdb;
+--enable_warnings
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+--error 1062
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('б');
+--error 1062
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+select c as c_all from t1 order by c;
+select c as c_a from t1 where c='a';
+select c as c_a from t1 where c='б';
+drop table t1;
 
 #
 # Bug 4521: unique key prefix interacts poorly with utf8
@@ -393,6 +417,31 @@ select c as c_a from t1 where c='a';
 select c as c_a from t1 where c='б';
 drop table t1;
 
+#
+# Bug 4531: unique key prefix interacts poorly with utf8
+# Check BDB, binary collation
+#
+--disable_warnings
+create table t1 (
+c char(10) character set utf8 collate utf8_bin,
+unique key a (c(1))
+) engine=bdb;
+--enable_warnings
+insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
+--error 1062
+insert into t1 values ('aa');
+--error 1062
+insert into t1 values ('aaa');
+insert into t1 values ('б');
+--error 1062
+insert into t1 values ('бб');
+--error 1062
+insert into t1 values ('ббб');
+select c as c_all from t1 order by c;
+select c as c_a from t1 where c='a';
+select c as c_a from t1 where c='б';
+drop table t1;
+
 
 # Bug#4594: column index make = failed for gbk, but like works
 # Check MYISAM
@@ -429,3 +478,18 @@ INSERT INTO t1 VALUES ('str');
 INSERT INTO t1 VALUES ('str2');
 select * from t1 where str='str';
 drop table t1;
+
+# the same for BDB
+#
+
+--disable_warnings
+create table t1 (
+  str varchar(255) character set utf8 not null,
+  key str (str(2))
+) engine=bdb;
+--enable_warnings
+INSERT INTO t1 VALUES ('str');
+INSERT INTO t1 VALUES ('str2');
+select * from t1 where str='str';
+drop table t1;
+
diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test
index 03843fd3da55bed7ed0c696a040dae823f34d9cb..d669739bcb43a484133d9722b983cee7d2ef11a1 100644
--- a/mysql-test/t/func_set.test
+++ b/mysql-test/t/func_set.test
@@ -31,11 +31,19 @@ drop table if exists t1,t2;
 --enable_warnings
 
 create  table t1 (id int(10) not null unique);
-create  table t2 (id int(10) not null primary key,
-val int(10) not null);
+create  table t2 (id int(10) not null primary key, val int(10) not null);
 insert into t1 values (1),(2),(4);
 insert into t2 values (1,1),(2,1),(3,1),(4,2);
 
 select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id;
 select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
 drop table t1,t2;
+
+#
+# Bug4340: find_in_set is case insensitive even on binary operators
+#
+
+select find_in_set(binary 'a',binary 'A,B,C');
+select find_in_set('a',binary 'A,B,C');
+select find_in_set(binary 'a', 'A,B,C');
+
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
index 434a1907e42cd36c114b3bac70276de937c31708..b7ec506ecf1d344c1b0450b08b48ae040aa9af0d 100644
--- a/mysql-test/t/truncate.test
+++ b/mysql-test/t/truncate.test
@@ -26,7 +26,7 @@ drop table t1;
 truncate non_existing_table;
 
 #
-# test autoincrement with TRUNCATE
+# test autoincrement with TRUNCATE; verifying difference with DELETE
 #
 
 create table t1 (a integer auto_increment primary key);
@@ -34,5 +34,19 @@ insert into t1 (a) values (NULL),(NULL);
 truncate table t1;
 insert into t1 (a) values (NULL),(NULL);
 SELECT * from t1;
+delete from t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
 drop table t1;
 
+# Verifying that temp tables are handled the same way
+
+create temporary table t1 (a integer auto_increment primary key);
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+delete from t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+drop table t1;
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 60ebeb045f59ce4a8db3cd9a7f0bedaa64911165..a480ecb570afa461b49537b686d2ade8be9521a8 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -324,3 +324,14 @@ SELECT @@global.global.key_buffer_size;
 SELECT @@global.session.key_buffer_size;
 --error 1064
 SELECT @@global.local.key_buffer_size;
+
+# BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
+set @tstlw = @@log_warnings;
+show global variables like 'log_warnings';
+set global log_warnings = 0;
+show global variables like 'log_warnings';
+set global log_warnings = 42;
+show global variables like 'log_warnings';
+set global log_warnings = @tstlw;
+show global variables like 'log_warnings';
+
diff --git a/sql/field.cc b/sql/field.cc
index 96f4fa8fd8684c053252e71b6e644fa4f752442c..bbb91fc534dd8837c102d8ecb69d7d7925ba47a2 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4382,7 +4382,7 @@ void Field_string::sql_type(String &res) const
 			    (field_length > 3 &&
 			     (table->db_options_in_use &
 			      HA_OPTION_PACK_RECORD) ?
-			      (has_charset() ? "varchar" : "varbinary") : 
+			      (has_charset() ? "varchar" : "varbinary") :
 			      (has_charset() ? "char" : "binary")),
 			    (int) field_length / charset()->mbmaxlen);
   res.length(length);
@@ -4401,6 +4401,22 @@ char *Field_string::pack(char *to, const char *from, uint max_length)
 }
 
 
+char *Field_string::pack_key(char *to, const char *from, uint max_length)
+{
+  int length=min(field_length,max_length);
+  uint char_length= (field_charset->mbmaxlen > 1) ?
+              max_length/field_charset->mbmaxlen : max_length;
+  if (length > char_length)
+    char_length= my_charpos(field_charset, from, from+length, char_length);
+  set_if_smaller(length, char_length);
+  while (length && from[length-1] == ' ')
+    length--;
+  *to= (uchar)length;
+  memcpy(to+1, from, length);
+  return to+1+length;
+}
+
+
 const char *Field_string::unpack(char *to, const char *from)
 {
   uint length= (uint) (uchar) *from++;
@@ -4564,6 +4580,24 @@ char *Field_varstring::pack(char *to, const char *from, uint max_length)
 }
 
 
+char *Field_varstring::pack_key(char *to, const char *from, uint max_length)
+{
+  uint length=uint2korr(from);
+  uint char_length= (field_charset->mbmaxlen > 1) ?
+              max_length/field_charset->mbmaxlen : max_length;
+  from+=HA_KEY_BLOB_LENGTH;
+  if (length > char_length)
+    char_length= my_charpos(field_charset, from, from+length, char_length);
+  set_if_smaller(length, char_length);
+  *to++= (char) (length & 255);
+  if (max_length > 255)
+    *to++= (char) (length >> 8);
+  if (length)
+    memcpy(to, from, length);
+  return to+length;
+}
+
+
 const char *Field_varstring::unpack(char *to, const char *from)
 {
   uint length;
@@ -5139,16 +5173,17 @@ char *Field_blob::pack_key(char *to, const char *from, uint max_length)
   char *save=ptr;
   ptr=(char*) from;
   uint32 length=get_length();			// Length of from string
-  if (length > max_length)
-    length=max_length;
+  uint char_length= (field_charset->mbmaxlen > 1) ?
+              max_length/field_charset->mbmaxlen : max_length;
+  if (length)
+    get_ptr((char**) &from);
+  if (length > char_length)
+    char_length= my_charpos(field_charset, from, from+length, char_length);
+  set_if_smaller(length, char_length);
   *to++= (uchar) length;
   if (max_length > 255)				// 2 byte length
     *to++= (uchar) (length >> 8);
-  if (length)
-  {
-    get_ptr((char**) &from);
-    memcpy(to, from, length);
-  }
+  memcpy(to, from, length);
   ptr=save;					// Restore org row pointer
   return to+length;
 }
diff --git a/sql/field.h b/sql/field.h
index 843961e64c3b66eac6d81a4685e80d0e21837723..eaf90ddc0ff320264246e7b409c09824997930b2 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -917,6 +917,7 @@ class Field_string :public Field_str {
   void sort_string(char *buff,uint length);
   void sql_type(String &str) const;
   char *pack(char *to, const char *from, uint max_length=~(uint) 0);
+  char *pack_key(char *to, const char *from, uint max_length);
   const char *unpack(char* to, const char *from);
   int pack_cmp(const char *a,const char *b,uint key_length);
   int pack_cmp(const char *b,uint key_length);
@@ -965,6 +966,7 @@ class Field_varstring :public Field_str {
   void set_key_image(char *buff,uint length, CHARSET_INFO *cs);
   void sql_type(String &str) const;
   char *pack(char *to, const char *from, uint max_length=~(uint) 0);
+  char *pack_key(char *to, const char *from, uint max_length);
   const char *unpack(char* to, const char *from);
   int pack_cmp(const char *a, const char *b, uint key_length);
   int pack_cmp(const char *b, uint key_length);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index c90a70a6bb6a6b57522f6f592759b522a9006006..adcba34d56bbe53cce44e8078376dcaa030bde29 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1435,30 +1435,43 @@ longlong Item_func_find_in_set::val_int()
   int diff;
   if ((diff=buffer->length() - find->length()) >= 0)
   {
-    const char *f_pos=find->ptr();
-    const char *f_end=f_pos+find->length();
-    const char *str=buffer->ptr();
-    const char *end=str+diff+1;
-    const char *real_end=str+buffer->length();
-    uint position=1;
-    do
+    my_wc_t wc;
+    CHARSET_INFO *cs= cmp_collation.collation;
+    const char *str_begin= buffer->ptr();
+    const char *str_end= buffer->ptr();
+    const char *real_end= str_end+buffer->length();
+    const uchar *find_str= (const uchar *) find->ptr();
+    uint find_str_len= find->length();
+    int position= 0;
+    while (1)
     {
-      const char *pos= f_pos;
-      while (pos != f_end)
+      int symbol_len;
+      if ((symbol_len= cs->cset->mb_wc(cs, &wc, (uchar*) str_end, 
+                                       (uchar*) real_end)) > 0)
       {
-	if (my_toupper(cmp_collation.collation,*str) != 
-	    my_toupper(cmp_collation.collation,*pos))
-	  goto not_found;
-	str++;
-	pos++;
+        const char *substr_end= str_end + symbol_len;
+        bool is_last_item= (substr_end == real_end);
+        if (wc == (my_wc_t) separator || is_last_item)
+        {
+          position++;
+          if (is_last_item)
+            str_end= substr_end;
+          if (!my_strnncoll(cs, (const uchar *) str_begin,
+                            str_end - str_begin,
+                            find_str, find_str_len))
+            return (longlong) position;
+          else
+            str_begin= substr_end;
+        }
+        str_end= substr_end;
       }
-      if (str == real_end || str[0] == separator)
-	return (longlong) position;
-  not_found:
-      while (str < end && str[0] != separator)
-	str++;
-      position++;
-    } while (++str <= end);
+      else if (str_end - str_begin == 0 && 
+               find_str_len == 0 && 
+               wc == (my_wc_t) separator)
+        return (longlong) ++position;
+      else
+        return (longlong) 0;
+    }
   }
   return 0;
 }
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 9b40768f0da8e479c3791bd98ca7aeb45346212b..4ef41e62f326f8253b0fee8fbf56f2d98d313b98 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4241,7 +4241,7 @@ Disable with --skip-isam.",
    OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"log-warnings", 'W', "Log some non-critical warnings to the error log file. Use this option twice or --log-warnings=2 if you also want 'Aborted connections' warnings.",
    (gptr*) &global_system_variables.log_warnings,
-   (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
+   (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ~0L,
    0, 0, 0},
   {"low-priority-updates", OPT_LOW_PRIORITY_UPDATES,
    "INSERT/DELETE/UPDATE has lower priority than selects.",
@@ -4551,7 +4551,7 @@ replicating a LOAD DATA INFILE command.",
    NO_ARG, 0, 0, 0, 0, 0, 0},
   {"warnings", 'W', "Deprecated; use --log-warnings instead.",
    (gptr*) &global_system_variables.log_warnings,
-   (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
+   (gptr*) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, ~0L,
    0, 0, 0},
   { "back_log", OPT_BACK_LOG,
     "The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.",
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index b76bad2805bc30d5f61269c1e5476185d649c1cb..ffeeb98488ac4cac49ed37589a7597b5c709fc8b 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -607,17 +607,13 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
   int error;
   DBUG_ENTER("mysql_truncate");
 
+  bzero((char*) &create_info,sizeof(create_info));
   /* If it is a temporary table, close and regenerate it */
   if (!dont_send_ok && (table_ptr=find_temporary_table(thd,table_list->db,
 						       table_list->real_name)))
   {
     TABLE *table= *table_ptr;
-    HA_CREATE_INFO create_info;
     table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
-    bzero((char*) &create_info,sizeof(create_info));
-    create_info.auto_increment_value=  table->file->auto_increment_value;
-    create_info.default_table_charset= table->table_charset;
-
     db_type table_type=table->db_type;
     strmov(path,table->path);
     *table_ptr= table->next;			// Unlink table from list
@@ -659,8 +655,6 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
       DBUG_RETURN(-1);
   }
 
-  bzero((char*) &create_info,sizeof(create_info));
-
   *fn_ext(path)=0;				// Remove the .frm extension
   error= ha_create_table(path,&create_info,1) ? -1 : 0;
   query_cache_invalidate3(thd, table_list, 0); 
diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c
index 71b5f345fdab5337c50acc0d0f504470deb6c271..268f7d18f2a56400c93cd1b3438bc6d26e9746d5 100644
--- a/strings/my_vsnprintf.c
+++ b/strings/my_vsnprintf.c
@@ -33,17 +33,6 @@
     length of result string
 */
 
-int my_snprintf(char* to, size_t n, const char* fmt, ...)
-{
-  int result;
-  va_list args;
-  va_start(args,fmt);
-  result= my_vsnprintf(to, n, fmt, args);
-  va_end(args);
-  return result;
-}
-
-
 int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
 {
   char *start=to, *end=to+n-1;
@@ -141,6 +130,15 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
   return (uint) (to - start);
 }
 
+int my_snprintf(char* to, size_t n, const char* fmt, ...)
+{
+  int result;
+  va_list args;
+  va_start(args,fmt);
+  result= my_vsnprintf(to, n, fmt, args);
+  va_end(args);
+  return result;
+}
 
 #ifdef MAIN
 #define OVERRUN_SENTRY  250
diff --git a/support-files/Makefile.am b/support-files/Makefile.am
index 196da3d8744113b2db1da8fd4732f97db9785687..3b43f7b7911582116271d6f58bc175a947ead761 100644
--- a/support-files/Makefile.am
+++ b/support-files/Makefile.am
@@ -22,6 +22,7 @@ EXTRA_DIST =		mysql.spec.sh \
 			my-medium.cnf.sh \
 			my-large.cnf.sh \
 			my-huge.cnf.sh \
+			my-innodb-heavy-4G \
 			mysql-log-rotate.sh \
 			mysql.server.sh \
 			binary-configure.sh \
@@ -34,6 +35,7 @@ pkgdata_DATA =		my-small.cnf \
 			my-medium.cnf \
 			my-large.cnf \
 			my-huge.cnf \
+      my-innodb-heavy-4G.cnf \
 			mysql-log-rotate \
 			mysql-@VERSION@.spec \
 			MySQL-shared-compat.spec
@@ -44,6 +46,7 @@ CLEANFILES =		my-small.cnf \
 			my-medium.cnf \
 			my-large.cnf \
 			my-huge.cnf \
+			my-innodb-heavy-4G.cnf \
 			mysql.spec \
 			mysql-@VERSION@.spec \
 			mysql-log-rotate \