[Commits] Rev 3117: Merge with 5.2 in lp:maria/5.3

Michael Widenius monty at askmonty.org
Fri Aug 12 17:08:26 EEST 2011


At lp:maria/5.3

------------------------------------------------------------
revno: 3117 [merge]
revision-id: monty at askmonty.org-20110812140819-v3vetatrl2b0tu4o
parent: monty at askmonty.org-20110812131443-oppgytfxivr5ls6e
parent: monty at askmonty.org-20110812125105-f4p71sflif3bc934
committer: Michael Widenius <monty at askmonty.org>
branch nick: maria-5.3
timestamp: Fri 2011-08-12 17:08:19 +0300
message:
  Merge with 5.2
  Fixed failing maria-recover test case
modified:
  client/mysqldump.c             sp1f-mysqldump.c-19700101030959-thxq2iabzu3yo5snymsubfeclf7v5rac
  mysql-test/r/mysqldump.result  sp1f-mysqldump.result-20030924111344-ly2xhpckbj53fyoa7kllzxyruwj4cg54
  mysql-test/suite/maria/t/maria-recover.test mariarecover.test-20080602174033-rnr5wg8wn2bqarwk-1
  mysql-test/t/mysqldump.test    sp1f-mysqldump.test-20030924111344-fh6llfm45dls3uxwugociq3shkpxsxn3
  storage/maria/ma_bitmap.c      sp1f-ma_bitmap.c-20070118193810-dcdqg6iu32wkt3pqyio4lqdqmaff2m7g
  storage/maria/ma_blockrec.c    sp1f-ma_blockrec.c-20070118193810-5wtbfa4irhu4voa3diiuus5km2j6jvlv
  storage/maria/ma_check.c       sp1f-ma_check.c-20060411134408-m5d5jao4sr32xsjjkig2uhdndqm5cgba
  storage/maria/ma_extra.c       sp1f-ma_extra.c-20060411134414-odsjlm2dvwmrpwdcyu3eqmkilaatl3gb
  storage/maria/ma_open.c        sp1f-ma_open.c-20060411134425-47m3424sotlyyl5b3k5brotxm23ryffh
  storage/maria/ma_pagecache.c   sp1f-mf_pagecache.c-20060706081022-sq6xnd367a2snwk4dup6yokn4paw7b5e
-------------- next part --------------
=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2011-05-10 15:17:43 +0000
+++ b/client/mysqldump.c	2011-08-12 14:08:19 +0000
@@ -36,7 +36,7 @@
 ** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
 */
 
-#define DUMP_VERSION "10.13"
+#define DUMP_VERSION "10.14"
 
 #include <my_global.h>
 #include <my_sys.h>
@@ -635,8 +635,13 @@ static void write_header(FILE *sql_file,
 
     if (!path)
     {
+      if (!opt_no_create_info)
+      {
+        /* We don't need unique checks as the table is created just before */
+        fprintf(md_result_file,"\
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n");
+      }
       fprintf(md_result_file,"\
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n\
 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n\
 ");
     }
@@ -666,8 +671,12 @@ static void write_footer(FILE *sql_file)
     if (!path)
     {
       fprintf(md_result_file,"\
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n\
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n");
+      if (!opt_no_create_info)
+      {
+        fprintf(md_result_file,"\
 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n");
+      }
     }
     if (opt_set_charset)
       fprintf(sql_file,

=== modified file 'mysql-test/r/mysqldump.result'
--- a/mysql-test/r/mysqldump.result	2011-05-02 17:58:45 +0000
+++ b/mysql-test/r/mysqldump.result	2011-08-10 10:08:19 +0000
@@ -1722,6 +1722,90 @@ insert into t2 (a, b) values (NULL, NULL
         </table_data>
 </database>
 </mysqldump>
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT INTO `t1` VALUES (NULL),(10),(20);
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `t2` WRITE;
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
+INSERT INTO `t2` VALUES (1,NULL,NULL,NULL,NULL,NULL),(2,10,NULL,NULL,NULL,NULL),(3,NULL,'twenty',NULL,NULL,NULL),(4,30,'thirty',NULL,NULL,NULL);
+/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+  `a` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT INTO `t1` VALUES (NULL),(10),(20);
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `t2`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t2` (
+  `pk` int(11) NOT NULL AUTO_INCREMENT,
+  `a` int(10) DEFAULT NULL,
+  `b` varchar(30) DEFAULT NULL,
+  `c` datetime DEFAULT NULL,
+  `d` blob,
+  `e` text,
+  PRIMARY KEY (`pk`)
+) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `t2` WRITE;
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
+INSERT INTO `t2` VALUES (1,NULL,NULL,NULL,NULL,NULL),(2,10,NULL,NULL,NULL,NULL),(3,NULL,'twenty',NULL,NULL,NULL),(4,30,'thirty',NULL,NULL,NULL);
+/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
 drop table t1, t2;
 #
 # Bug#12123 mysqldump --tab results in text file which can't be imported

=== modified file 'mysql-test/suite/maria/t/maria-recover.test'
--- a/mysql-test/suite/maria/t/maria-recover.test	2011-06-09 18:39:31 +0000
+++ b/mysql-test/suite/maria/t/maria-recover.test	2011-08-12 14:08:19 +0000
@@ -8,6 +8,7 @@
 call mtr.add_suppression("Checking table:   '\\..mysqltest.t_corrupted2'");
 call mtr.add_suppression("Recovering table: '\\..mysqltest.t_corrupted2'");
 call mtr.add_suppression("Table '\\..mysqltest.t_corrupted2' is marked as crashed and should be repaired");
+call mtr.add_suppression("Table '\\..mysqltest.t_corrupted2' was not closed properly.*");
 call mtr.add_suppression("Table 't_corrupted2' is marked as crashed and should be repaired");
 
 let $def_checkinterval=`select @@global.aria_checkpoint_interval`;

=== modified file 'mysql-test/t/mysqldump.test'
--- a/mysql-test/t/mysqldump.test	2011-05-04 18:56:29 +0000
+++ b/mysql-test/t/mysqldump.test	2011-08-10 10:08:19 +0000
@@ -661,6 +661,10 @@ a int(10), b varchar(30), c datetime, d
 insert into t1 values (NULL), (10), (20);
 insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thirty");
 --exec $MYSQL_DUMP  --skip-comments --xml --no-create-info test
+
+# Test if UNIQUE_CHECK is done correctly
+--exec $MYSQL_DUMP  --skip-comments --no-create-info test
+--exec $MYSQL_DUMP  --skip-comments test
 drop table t1, t2;
 
 

=== modified file 'storage/maria/ma_bitmap.c'
--- a/storage/maria/ma_bitmap.c	2011-07-26 04:52:15 +0000
+++ b/storage/maria/ma_bitmap.c	2011-08-12 12:51:05 +0000
@@ -907,7 +907,7 @@ void _ma_print_bitmap(MARIA_FILE_BITMAP
   fprintf(DBUG_FILE,"\nDump of bitmap page at %s\n", llstr(page, llbuff));
 
   page++;                                       /* Skip bitmap page */
-  for (pos= data, end= pos + bitmap->total_size;
+  for (pos= data, end= pos + bitmap->max_total_size;
        pos < end ;
        pos+= 6)
   {

=== modified file 'storage/maria/ma_blockrec.c'
--- a/storage/maria/ma_blockrec.c	2011-07-26 04:52:15 +0000
+++ b/storage/maria/ma_blockrec.c	2011-08-08 11:53:52 +0000
@@ -3643,6 +3643,7 @@ my_bool _ma_write_abort_block_record(MAR
       }
     }
   }
+  _ma_bitmap_unlock(share);
   if (share->now_transactional)
   {
     if (_ma_write_clr(info, info->cur_row.orig_undo_lsn,
@@ -3652,7 +3653,6 @@ my_bool _ma_write_abort_block_record(MAR
                       &lsn, (void*) 0))
       res= 1;
   }
-  _ma_bitmap_unlock(share);
   _ma_unpin_all_pages_and_finalize_row(info, lsn);
   DBUG_RETURN(res);
 }

=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c	2011-07-31 20:59:55 +0000
+++ b/storage/maria/ma_check.c	2011-08-12 14:08:19 +0000
@@ -1991,14 +1991,22 @@ static int check_block_record(HA_CHECK *
   {
     /* Not at end of bitmap */
     uint bitmap_pattern;
+    uint byte_offset;
+
     offset_page= (uint) ((page % share->bitmap.pages_covered) -1) * 3;
     offset= offset_page & 7;
-    data= bitmap_buff + offset_page / 8;
+    byte_offset= offset_page / 8;
+    data= bitmap_buff + byte_offset;
     bitmap_pattern= uint2korr(data);
+    if (byte_offset + 1 == share->bitmap.max_total_size)
+    {
+      /* On last byte of bitmap; Remove possible checksum */
+      bitmap_pattern&= 0xff;
+    }
     if (((bitmap_pattern >> offset)) ||
-        (data + 2 < bitmap_buff + share->bitmap.max_total_size &&
-         _ma_check_if_zero(data+2, bitmap_buff + share->bitmap.max_total_size -
-                           data - 2)))
+        (byte_offset + 2 < share->bitmap.max_total_size &&
+         _ma_check_if_zero(data+2, share->bitmap.max_total_size -
+                           byte_offset - 2)))
     {
       ulonglong bitmap_page;
       bitmap_page= page / share->bitmap.pages_covered;

=== modified file 'storage/maria/ma_extra.c'
--- a/storage/maria/ma_extra.c	2011-07-05 19:46:53 +0000
+++ b/storage/maria/ma_extra.c	2011-08-12 14:08:19 +0000
@@ -319,7 +319,6 @@ int maria_extra(MARIA_HA *info, enum ha_
     my_bool do_flush= test(function != HA_EXTRA_PREPARE_FOR_DROP);
     my_bool save_global_changed;
     enum flush_type type;
-    pthread_mutex_lock(&THR_LOCK_maria);
     /*
       This share, to have last_version=0, needs to save all its data/index
       blocks to disk if this is not for a DROP TABLE. Otherwise they would be
@@ -353,12 +352,14 @@ int maria_extra(MARIA_HA *info, enum ha_
     type= do_flush ? FLUSH_RELEASE : FLUSH_IGNORE_CHANGED;
     save_global_changed= share->global_changed;
     share->global_changed= 1;                 /* Don't increment open count */
+    pthread_mutex_unlock(&share->intern_lock);
     if (_ma_flush_table_files(info, MARIA_FLUSH_DATA | MARIA_FLUSH_INDEX,
                               type, type))
     {
       error=my_errno;
       share->changed= 1;
     }
+    pthread_mutex_lock(&share->intern_lock);
     share->global_changed= save_global_changed;
     if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
     {
@@ -395,10 +396,9 @@ int maria_extra(MARIA_HA *info, enum ha_
         error= my_errno;
       share->bitmap.changed_not_flushed= 0;
     }
-    /* For protection against Checkpoint, we set under intern_lock: */
+    /* last_version must be protected by intern_lock; See collect_tables() */
     share->last_version= 0L;                    /* Impossible version */
     pthread_mutex_unlock(&share->intern_lock);
-    pthread_mutex_unlock(&THR_LOCK_maria);
     break;
   }
   case HA_EXTRA_PREPARE_FOR_FORCED_CLOSE:

=== modified file 'storage/maria/ma_open.c'
--- a/storage/maria/ma_open.c	2011-08-12 13:14:43 +0000
+++ b/storage/maria/ma_open.c	2011-08-12 14:08:19 +0000
@@ -936,7 +936,7 @@ MARIA_HA *maria_open(const char *name, i
     {
       /*
         We must have internal_lock before bitmap_lock because we call
-        _ma_flush_tables_files() with internal_lock locked.
+        _ma_flush_table_files() with internal_lock locked.
       */
       pthread_mutex_lock(&share->intern_lock);
       pthread_mutex_lock(&share->bitmap.bitmap_lock);

=== modified file 'storage/maria/ma_pagecache.c'
--- a/storage/maria/ma_pagecache.c	2011-07-04 14:27:46 +0000
+++ b/storage/maria/ma_pagecache.c	2011-08-12 14:08:19 +0000
@@ -2271,8 +2271,14 @@ static PAGECACHE_BLOCK_LINK *find_block(
                           ("block->hash_link: %p  hash_link: %p  "
                            "block->status: %u", block->hash_link,
                            hash_link, block->status ));
-      KEYCACHE_DBUG_ASSERT(block->hash_link == hash_link &&
-                           hash_link->block == block);
+      /*
+        block->hash_link != hash_link can only happen when
+        the block is in PCBLOCK_IN_SWITCH above (is flushed out
+        to be replaced by another block). The SWITCH code will change
+        block->hash_link to point to hash_link.
+      */
+      KEYCACHE_DBUG_ASSERT(block->hash_link == hash_link ||
+                           block->status & PCBLOCK_IN_SWITCH);
       page_status= (((block->hash_link == hash_link) &&
                      (block->status & PCBLOCK_READ)) ?
                     PAGE_READ : PAGE_WAIT_TO_BE_READ);



More information about the commits mailing list