summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-08-15 22:14:08 +0300
committerMichael Widenius <monty@askmonty.org>2011-08-15 22:14:08 +0300
commitfb135f7ee570a199d78db7c3222db1980b75060f (patch)
treec87f9822d8855101d390f9cb1f93ebbc43049900
parentd2206ad14920e85907c965256e1ce061633c36ee (diff)
parentb5f830d88d7b7a5cc1981ca80fda52fcfa2f4150 (diff)
downloadmariadb-git-fb135f7ee570a199d78db7c3222db1980b75060f.tar.gz
Automatic merge with 5.2
-rw-r--r--client/mysqldump.c15
-rw-r--r--configure.in2
-rw-r--r--mysql-test/r/mysqldump.result84
-rw-r--r--mysql-test/suite/maria/r/locking.result31
-rw-r--r--mysql-test/suite/maria/r/small_blocksize.result75
-rw-r--r--mysql-test/suite/maria/t/locking.test43
-rw-r--r--mysql-test/suite/maria/t/small_blocksize-master.opt1
-rw-r--r--mysql-test/suite/maria/t/small_blocksize.test35
-rw-r--r--mysql-test/t/mysqldump.test4
-rw-r--r--storage/maria/ha_maria.cc2
-rw-r--r--storage/maria/ma_bitmap.c36
-rw-r--r--storage/maria/ma_blockrec.c13
-rw-r--r--storage/maria/ma_blockrec.h1
-rw-r--r--storage/maria/ma_check.c16
-rw-r--r--storage/maria/ma_delete.c27
-rw-r--r--storage/maria/ma_extra.c8
-rw-r--r--storage/maria/ma_open.c59
-rw-r--r--storage/maria/ma_page.c1
-rw-r--r--storage/maria/ma_pagecache.c10
-rw-r--r--storage/maria/ma_write.c1
-rw-r--r--storage/maria/maria_def.h2
21 files changed, 400 insertions, 66 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 0eab2ae8e0b..d7d99e0cc17 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -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, char *db_name)
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,
diff --git a/configure.in b/configure.in
index 57bf2d3a6a5..663d5c535ce 100644
--- a/configure.in
+++ b/configure.in
@@ -18,7 +18,7 @@ dnl When merging new MySQL releases, update the version number to match the
dnl MySQL version number.
dnl
dnl Note: the following line must be parseable by win/configure.js:GetVersion()
-AC_INIT([MariaDB Server], [5.3.0-MariaDB-beta], [], [mysql])
+AC_INIT([MariaDB Server], [5.3.1-MariaDB-beta], [], [mysql])
AC_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 9723c40721c..86754f1b458 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -1722,6 +1722,90 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
</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
diff --git a/mysql-test/suite/maria/r/locking.result b/mysql-test/suite/maria/r/locking.result
new file mode 100644
index 00000000000..772e43f5983
--- /dev/null
+++ b/mysql-test/suite/maria/r/locking.result
@@ -0,0 +1,31 @@
+drop table if exists t1;
+CREATE TABLE t1 (
+`Vorgangsnr` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`Datum_Eingang` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Erfassungs-/Buchungsdatum',
+`Warennummer` varchar(20) DEFAULT NULL,
+`BenutzerID` int(10) unsigned DEFAULT NULL,
+`Vermerke_Versand` varchar(1024) DEFAULT NULL,
+`Zubehör` varchar(250) DEFAULT NULL,
+`Datum_Annahme` varchar(12) DEFAULT NULL,
+`K_Lieferscheinnummer` int(10) unsigned DEFAULT NULL,
+`RMANr` int(10) unsigned DEFAULT '0',
+`K_Bestelldaten` varchar(1024) DEFAULT NULL COMMENT 'Bestellnr, Datum, Auftraggeber',
+PRIMARY KEY (`Vorgangsnr`),
+KEY `Datum_Eingang` (`Datum_Eingang`)
+) ENGINE=Aria AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+alter table t1 disable keys;
+lock tables t1 write;
+INSERT INTO t1 (Datum_Eingang, BenutzerID, Zubehör, Datum_Annahme) VALUES ('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006');
+INSERT INTO t1 (Datum_Eingang, BenutzerID, Zubehör, Datum_Annahme) VALUES ('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006');
+unlock tables;
+select count(*) from t1;
+count(*)
+88
+check table t1 extended;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+alter table t1 enable keys;
+check table t1 extended;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
diff --git a/mysql-test/suite/maria/r/small_blocksize.result b/mysql-test/suite/maria/r/small_blocksize.result
new file mode 100644
index 00000000000..41d9a561a4d
--- /dev/null
+++ b/mysql-test/suite/maria/r/small_blocksize.result
@@ -0,0 +1,75 @@
+DROP TABLE if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (col_longtext_ucs2 longtext, col_longtext_utf8 longtext, col_varchar_255_ucs2_key varchar(255), col_set_utf8 set ('a','b'), col_char_255_ucs2 char(255), col_char_255_ucs2_key char(255), col_enum_ucs2 enum ('a','b'), col_varchar_255_ucs2 varchar(255), col_longtext_ucs2_key longtext, col_longtext_utf8_key longtext, col_enum_utf8 enum ('a','b'), col_varchar_255_utf8_key varchar(1024), col_varchar_255_utf8 varchar(255), col_enum_ucs2_key enum ('a','b'), col_enum_utf8_key enum ('a','b'), col_set_utf8_key set ('a','b'), col_char_255_utf8 char(255), pk integer auto_increment, col_set_ucs2_key set ('a','b'), col_char_255_utf8_key char(255), col_set_ucs2 set ('a','b'), primary key (pk)) ENGINE=aria;
+INSERT INTO t1 ( col_char_255_utf8, col_varchar_255_utf8_key, col_longtext_utf8_key ) VALUES ( 'lggnqojgqectqlkvskffihliqcwoakzzzjvhkqlwjybkngdbubskflpmzegdrk', REPEAT( 'a', 627 ), 'mlggnqojgqectqlkvskffihliqcwoakzzzjvhkqlwjybkngdbubskflpmzegdrklnipcmzbtwdqfnyinqfohgtiwmvfpbuslgobjhslxnaybcyebhsrlipnuvalhmvhlwbwujtvjsdrbyapfzprnxfgtrukwhywtkaoupsaogxsjxhqjkidvnpeytjgndtnrrbm' );
+UPDATE t1 SET col_varchar_255_utf8 = REPEAT('a', 197 );
+UPDATE t1 SET col_char_255_utf8 = 'bmjihzjtxegprqfvmczyzbavjuozkyxrlxvqyzcfvsjrhcccqnecyohzhzbgsbqkqvzmtlhtlcgzheirkyfwczoolilkrfimfnuoapyylbghdhdgfebjjajfoigagozypqtrflrvdiwfgqalsqbmlllsanvtuuutiaastqtbzeoaawl';
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+create table t1 (a int primary key auto_increment, e1 enum('a','b'), e2 enum('a','b'), vl int, bl int, c char(10), v1 varchar(10000), v2 varchar(10000), b1 blob, b2 blob) engine=aria;
+insert into t1 (vl,bl) values (10,10),(100,100),(1000,1000),(5000,5000),(8000,12000);
+update t1 set c="test", v1=repeat('a',vl),v2=repeat('b',vl/2),b1=repeat('c',bl),b2=repeat('d',bl);
+insert into t1 (vl,bl) values (10,10),(100,100),(1000,1000),(1000,5000);
+update t1 set c="test", v1=repeat(vl/4,'a'),v2=repeat(vl/5,'b'),b1=repeat(b1*2,'c'),b2=repeat(bl/2,'d');
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'b'
+Warning 1292 Truncated incorrect INTEGER value: 'c'
+Warning 1292 Truncated incorrect INTEGER value: 'd'
+update t1 set c="test", v1=repeat('a',vl/4),v2=repeat('b',vl/5),b1=repeat('c',bl*2),b2=repeat('d',bl/2);
+insert into t1 (vl,bl) values (100,100);
+update t1 set c="test", v1=repeat('a',vl),v2=repeat('b',vl),b1=repeat('c',bl*2),b2=repeat('d',bl/2);
+update t1 set c="test", v1=repeat('a',vl/2),v2=repeat('b',vl/2),b1=repeat('c',bl/2),b2=repeat('d',bl/2);
+update t1 set c="test", v1=repeat('a',vl/4),v2=repeat('b',vl/4),b1=repeat('c',bl/4),b2=repeat('d',bl/4);
+update t1 set c="test", v1=repeat('a',vl/20),v2=repeat('b',vl),b1=repeat('c',bl/20),b2=repeat('d',bl/20);
+insert into t1 (vl,bl) values (100,100);
+update t1 set c="test", v1=repeat('a',vl/100),b1=repeat('c',bl/100);
+insert into t1 (vl,bl) values (100,100);
+update t1 set c="test", v1=repeat('a',vl),b1=repeat('c',bl);
+insert into t1 (vl,bl) values (100,100);
+update t1 set c="test", v1=repeat('a',10),v2=repeat('b',10);
+insert into t1 (vl,bl) values (100,100);
+update t1 set c="test", v1=repeat('a',2000),v2=repeat('b',2000);
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
diff --git a/mysql-test/suite/maria/t/locking.test b/mysql-test/suite/maria/t/locking.test
new file mode 100644
index 00000000000..c20ca33e162
--- /dev/null
+++ b/mysql-test/suite/maria/t/locking.test
@@ -0,0 +1,43 @@
+#
+# Aria bugs that has to do with locking
+#
+--source include/have_maria.inc
+
+disable_warnings;
+drop table if exists t1;
+enable_warnings;
+
+#
+# Test generating data with insert select
+#
+
+CREATE TABLE t1 (
+ `Vorgangsnr` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `Datum_Eingang` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Erfassungs-/Buchungsdatum',
+ `Warennummer` varchar(20) DEFAULT NULL,
+ `BenutzerID` int(10) unsigned DEFAULT NULL,
+ `Vermerke_Versand` varchar(1024) DEFAULT NULL,
+ `Zubehör` varchar(250) DEFAULT NULL,
+ `Datum_Annahme` varchar(12) DEFAULT NULL,
+ `K_Lieferscheinnummer` int(10) unsigned DEFAULT NULL,
+ `RMANr` int(10) unsigned DEFAULT '0',
+ `K_Bestelldaten` varchar(1024) DEFAULT NULL COMMENT 'Bestellnr, Datum, Auftraggeber',
+ PRIMARY KEY (`Vorgangsnr`),
+ KEY `Datum_Eingang` (`Datum_Eingang`)
+) ENGINE=Aria AUTO_INCREMENT=250 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+
+alter table t1 disable keys;
+lock tables t1 write;
+
+let $loop=2;
+while ($loop)
+{
+ INSERT INTO t1 (Datum_Eingang, BenutzerID, Zubehör, Datum_Annahme) VALUES ('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehör', '21.06.2006');
+ dec $loop;
+}
+unlock tables;
+select count(*) from t1;
+check table t1 extended;
+alter table t1 enable keys;
+check table t1 extended;
+drop table t1;
diff --git a/mysql-test/suite/maria/t/small_blocksize-master.opt b/mysql-test/suite/maria/t/small_blocksize-master.opt
new file mode 100644
index 00000000000..59fd35a7846
--- /dev/null
+++ b/mysql-test/suite/maria/t/small_blocksize-master.opt
@@ -0,0 +1 @@
+--aria-block-size=1024
diff --git a/mysql-test/suite/maria/t/small_blocksize.test b/mysql-test/suite/maria/t/small_blocksize.test
new file mode 100644
index 00000000000..673558e6b20
--- /dev/null
+++ b/mysql-test/suite/maria/t/small_blocksize.test
@@ -0,0 +1,35 @@
+DROP TABLE if exists t1;
+
+#
+# Test of extending updated rows.
+# This caused failures in lp:815022
+#
+CREATE TABLE t1 (col_longtext_ucs2 longtext, col_longtext_utf8 longtext, col_varchar_255_ucs2_key varchar(255), col_set_utf8 set ('a','b'), col_char_255_ucs2 char(255), col_char_255_ucs2_key char(255), col_enum_ucs2 enum ('a','b'), col_varchar_255_ucs2 varchar(255), col_longtext_ucs2_key longtext, col_longtext_utf8_key longtext, col_enum_utf8 enum ('a','b'), col_varchar_255_utf8_key varchar(1024), col_varchar_255_utf8 varchar(255), col_enum_ucs2_key enum ('a','b'), col_enum_utf8_key enum ('a','b'), col_set_utf8_key set ('a','b'), col_char_255_utf8 char(255), pk integer auto_increment, col_set_ucs2_key set ('a','b'), col_char_255_utf8_key char(255), col_set_ucs2 set ('a','b'), primary key (pk)) ENGINE=aria;
+INSERT INTO t1 ( col_char_255_utf8, col_varchar_255_utf8_key, col_longtext_utf8_key ) VALUES ( 'lggnqojgqectqlkvskffihliqcwoakzzzjvhkqlwjybkngdbubskflpmzegdrk', REPEAT( 'a', 627 ), 'mlggnqojgqectqlkvskffihliqcwoakzzzjvhkqlwjybkngdbubskflpmzegdrklnipcmzbtwdqfnyinqfohgtiwmvfpbuslgobjhslxnaybcyebhsrlipnuvalhmvhlwbwujtvjsdrbyapfzprnxfgtrukwhywtkaoupsaogxsjxhqjkidvnpeytjgndtnrrbm' );
+UPDATE t1 SET col_varchar_255_utf8 = REPEAT('a', 197 );
+UPDATE t1 SET col_char_255_utf8 = 'bmjihzjtxegprqfvmczyzbavjuozkyxrlxvqyzcfvsjrhcccqnecyohzhzbgsbqkqvzmtlhtlcgzheirkyfwczoolilkrfimfnuoapyylbghdhdgfebjjajfoigagozypqtrflrvdiwfgqalsqbmlllsanvtuuutiaastqtbzeoaawl';
+check table t1;
+drop table t1;
+
+create table t1 (a int primary key auto_increment, e1 enum('a','b'), e2 enum('a','b'), vl int, bl int, c char(10), v1 varchar(10000), v2 varchar(10000), b1 blob, b2 blob) engine=aria;
+
+insert into t1 (vl,bl) values (10,10),(100,100),(1000,1000),(5000,5000),(8000,12000);
+update t1 set c="test", v1=repeat('a',vl),v2=repeat('b',vl/2),b1=repeat('c',bl),b2=repeat('d',bl);
+insert into t1 (vl,bl) values (10,10),(100,100),(1000,1000),(1000,5000);
+update t1 set c="test", v1=repeat(vl/4,'a'),v2=repeat(vl/5,'b'),b1=repeat(b1*2,'c'),b2=repeat(bl/2,'d');
+update t1 set c="test", v1=repeat('a',vl/4),v2=repeat('b',vl/5),b1=repeat('c',bl*2),b2=repeat('d',bl/2);
+insert into t1 (vl,bl) values (100,100);
+update t1 set c="test", v1=repeat('a',vl),v2=repeat('b',vl),b1=repeat('c',bl*2),b2=repeat('d',bl/2);
+update t1 set c="test", v1=repeat('a',vl/2),v2=repeat('b',vl/2),b1=repeat('c',bl/2),b2=repeat('d',bl/2);
+update t1 set c="test", v1=repeat('a',vl/4),v2=repeat('b',vl/4),b1=repeat('c',bl/4),b2=repeat('d',bl/4);
+update t1 set c="test", v1=repeat('a',vl/20),v2=repeat('b',vl),b1=repeat('c',bl/20),b2=repeat('d',bl/20);
+insert into t1 (vl,bl) values (100,100);
+update t1 set c="test", v1=repeat('a',vl/100),b1=repeat('c',bl/100);
+insert into t1 (vl,bl) values (100,100);
+update t1 set c="test", v1=repeat('a',vl),b1=repeat('c',bl);
+insert into t1 (vl,bl) values (100,100);
+update t1 set c="test", v1=repeat('a',10),v2=repeat('b',10);
+insert into t1 (vl,bl) values (100,100);
+update t1 set c="test", v1=repeat('a',2000),v2=repeat('b',2000);
+check table t1;
+drop table t1;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 99537618011..a28dff09bce 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -661,6 +661,10 @@ a int(10), b varchar(30), c datetime, d blob, e text);
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;
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 4ecdde7d28e..f378aae6263 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -909,7 +909,7 @@ double ha_maria::scan_time()
}
/*
- We need to be able to store at least two keys on an index page as the
+ We need to be able to store at least 2 keys on an index page as the
splitting algorithms depends on this. (With only one key on a page
we also can't use any compression, which may make the index file much
larger)
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index 86c721f75fa..a98ef71604d 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -907,7 +907,7 @@ void _ma_print_bitmap(MARIA_FILE_BITMAP *bitmap, uchar *data,
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)
{
@@ -1853,7 +1853,7 @@ static void use_head(MARIA_HA *info, pgcache_page_no_t page, uint size,
find_where_to_split_row()
share Maria share
row Information of what is in the row (from calc_record_size())
- extents_length Number of bytes needed to store all extents
+ extents Max number of extents we have to store in header
split_size Free size on the page (The head length must be less
than this)
@@ -1862,7 +1862,7 @@ static void use_head(MARIA_HA *info, pgcache_page_no_t page, uint size,
*/
static uint find_where_to_split_row(MARIA_SHARE *share, MARIA_ROW *row,
- uint extents_length, uint split_size)
+ uint extents, uint split_size)
{
uint *lengths, *lengths_end;
/*
@@ -1872,19 +1872,20 @@ static uint find_where_to_split_row(MARIA_SHARE *share, MARIA_ROW *row,
- One extent
*/
uint row_length= (row->min_length +
- size_to_store_key_length(extents_length) +
+ size_to_store_key_length(extents) +
ROW_EXTENT_SIZE);
- DBUG_ASSERT(row_length < split_size);
+ DBUG_ASSERT(row_length <= split_size);
+
/*
Store first in all_field_lengths the different parts that are written
to the row. This needs to be in same order as in
ma_block_rec.c::write_block_record()
*/
- row->null_field_lengths[-3]= extents_length;
+ row->null_field_lengths[-3]= extents * ROW_EXTENT_SIZE;
row->null_field_lengths[-2]= share->base.fixed_not_null_fields_length;
row->null_field_lengths[-1]= row->field_lengths_length;
for (lengths= row->null_field_lengths - EXTRA_LENGTH_FIELDS,
- lengths_end= (lengths + share->base.pack_fields - share->base.blobs +
+ lengths_end= (lengths + share->base.fields - share->base.blobs +
EXTRA_LENGTH_FIELDS); lengths < lengths_end; lengths++)
{
if (row_length + *lengths > split_size)
@@ -2040,18 +2041,19 @@ my_bool _ma_bitmap_find_place(MARIA_HA *info, MARIA_ROW *row,
head_length+= ELEMENTS_RESERVED_FOR_MAIN_PART * ROW_EXTENT_SIZE;
/* The first segment size is stored in 'row_length' */
- row_length= find_where_to_split_row(share, row, extents_length,
+ row_length= find_where_to_split_row(share, row, row->extents_count +
+ ELEMENTS_RESERVED_FOR_MAIN_PART-1,
max_page_size);
full_page_size= MAX_TAIL_SIZE(share->block_size);
position= 0;
- if (head_length - row_length <= full_page_size)
+ rest_length= head_length - row_length;
+ if (rest_length <= full_page_size)
position= ELEMENTS_RESERVED_FOR_MAIN_PART -2; /* Only head and tail */
if (find_head(info, row_length, position))
goto abort;
row->space_on_head_page= row_length;
- rest_length= head_length - row_length;
if (write_rest_of_head(info, position, rest_length))
goto abort;
@@ -2137,16 +2139,22 @@ my_bool _ma_bitmap_find_new_place(MARIA_HA *info, MARIA_ROW *row,
/* Allocate enough space */
head_length+= ELEMENTS_RESERVED_FOR_MAIN_PART * ROW_EXTENT_SIZE;
- /* The first segment size is stored in 'row_length' */
- row_length= find_where_to_split_row(share, row, extents_length, free_size);
+ /*
+ The first segment size is stored in 'row_length'
+ We have to add ELEMENTS_RESERVED_FOR_MAIN_PART here as the extent
+ information may be up to this size when the header splits.
+ */
+ row_length= find_where_to_split_row(share, row, row->extents_count +
+ ELEMENTS_RESERVED_FOR_MAIN_PART-1,
+ free_size);
position= 0;
- if (head_length - row_length < MAX_TAIL_SIZE(share->block_size))
+ rest_length= head_length - row_length;
+ if (rest_length <= MAX_TAIL_SIZE(share->block_size))
position= ELEMENTS_RESERVED_FOR_MAIN_PART -2; /* Only head and tail */
use_head(info, page, row_length, position);
row->space_on_head_page= row_length;
- rest_length= head_length - row_length;
if (write_rest_of_head(info, position, rest_length))
goto abort;
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 3a5bbd6c6f2..ad5ec3fe2b9 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -1721,7 +1721,7 @@ struct st_row_pos_info
static my_bool get_head_or_tail_page(MARIA_HA *info,
- MARIA_BITMAP_BLOCK *block,
+ const MARIA_BITMAP_BLOCK *block,
uchar *buff, uint length, uint page_type,
enum pagecache_page_lock lock,
struct st_row_pos_info *res)
@@ -1821,7 +1821,7 @@ crashed:
*/
static my_bool get_rowpos_in_head_or_tail_page(MARIA_HA *info,
- MARIA_BITMAP_BLOCK *block,
+ const MARIA_BITMAP_BLOCK *block,
uchar *buff, uint length,
uint page_type,
enum pagecache_page_lock lock,
@@ -2257,7 +2257,7 @@ static void store_extent_info(uchar *to,
for (block= first_block, end_block= first_block+count ;
block < end_block; block++)
{
- /* The following is only false for marker blocks */
+ /* The following is only false for marker (unused) blocks */
if (likely(block->used & BLOCKUSED_USED))
{
uint page_count= block->page_count;
@@ -3088,9 +3088,10 @@ static my_bool write_block_record(MARIA_HA *info,
extent_data= row_extents_second_part +
((last_head_block - head_block) - 2) * ROW_EXTENT_SIZE;
}
- DBUG_ASSERT(uint2korr(extent_data+5) & TAIL_BIT);
+ /* Write information for tail block in the reserved space */
page_store(extent_data, head_tail_block->page);
- int2store(extent_data + PAGE_STORE_SIZE, head_tail_block->page_count);
+ pagerange_store(extent_data + PAGE_STORE_SIZE,
+ head_tail_block->page_count);
}
}
else
@@ -3643,6 +3644,7 @@ my_bool _ma_write_abort_block_record(MARIA_HA *info)
}
}
}
+ _ma_bitmap_unlock(share);
if (share->now_transactional)
{
if (_ma_write_clr(info, info->cur_row.orig_undo_lsn,
@@ -3652,7 +3654,6 @@ my_bool _ma_write_abort_block_record(MARIA_HA *info)
&lsn, (void*) 0))
res= 1;
}
- _ma_bitmap_unlock(share);
_ma_unpin_all_pages_and_finalize_row(info, lsn);
DBUG_RETURN(res);
}
diff --git a/storage/maria/ma_blockrec.h b/storage/maria/ma_blockrec.h
index 2a323d16ffa..45f5613bb60 100644
--- a/storage/maria/ma_blockrec.h
+++ b/storage/maria/ma_blockrec.h
@@ -59,7 +59,6 @@
/* Minimum header size needed for a new row */
#define BASE_ROW_HEADER_SIZE FLAG_SIZE
-#define TRANS_ROW_EXTRA_HEADER_SIZE TRANSID_SIZE
#define PAGE_TYPE_MASK 7
enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_TYPE };
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index ec48e294bdd..221a96c8285 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -1991,14 +1991,22 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend,
{
/* 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;
diff --git a/storage/maria/ma_delete.c b/storage/maria/ma_delete.c
index ab66499ecfe..a4e485066f5 100644
--- a/storage/maria/ma_delete.c
+++ b/storage/maria/ma_delete.c
@@ -571,6 +571,7 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
endpos= leaf_page->buff + leaf_length;
tmp_key.keyinfo= keyinfo;
tmp_key.data= keybuff;
+ next_buff= 0;
if (!(key_start= _ma_get_last_key(&tmp_key, leaf_page, endpos)))
DBUG_RETURN(-1);
@@ -597,9 +598,11 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
/* underflow writes "next_page" to disk */
ret_value= underflow(info, keyinfo, leaf_page, &next_page,
endpos);
- if (ret_value == 0 && leaf_page->size >
- share->max_index_block_size)
+ if (ret_value < 0)
+ goto err;
+ if (leaf_page->size > share->max_index_block_size)
{
+ DBUG_ASSERT(ret_value == 0);
ret_value= (_ma_split_page(info, key, leaf_page,
share->max_index_block_size,
(uchar*) 0, 0, 0,
@@ -632,6 +635,7 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
goto err;
}
my_afree(next_buff);
+ DBUG_ASSERT(leaf_page->size <= share->max_index_block_size);
DBUG_RETURN(ret_value);
}
@@ -709,10 +713,14 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
KEY_OP_DEBUG_LOG_ADD_2))
goto err;
+ DBUG_ASSERT(leaf_page->size <= share->max_index_block_size);
DBUG_RETURN(new_leaf_length <=
(info->quick_mode ? MARIA_MIN_KEYBLOCK_LENGTH :
(uint) keyinfo->underflow_block_length));
err:
+ if (next_buff)
+ my_afree(next_buff);
+
DBUG_RETURN(-1);
} /* del */
@@ -731,9 +739,18 @@ err:
leaf_page is saved to disk
Caller must save anc_buff
+ For the algoritm to work, we have to ensure for packed keys that
+ key_length + (underflow_length + max_block_length + key_length) / 2
+ <= block_length.
+ From which follows that underflow_length <= block_length - key_length *3
+ For not packed keys we have:
+ (underflow_length + max_block_length + key_length) / 2 <= block_length
+ From which follows that underflow_length < block_length - key_length
+ This is ensured by setting of underflow_block_length.
+
@return
@retval 0 ok
- @retval 1 ok, but anc_buff did underflow
+ @retval 1 ok, but anc_page did underflow
@retval -1 error
*/
@@ -1153,7 +1170,7 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
_ma_kpointer(info,leaf_key.data + leaf_key.data_length +
leaf_key.ref_length, leaf_page->pos);
- /* Save key in anc_page */
+ /* Save parting key found by _ma_find_half_pos() in anc_page */
DBUG_DUMP("anc_buff", anc_buff, new_anc_length);
DBUG_DUMP_KEY("key_to_anc", &leaf_key);
anc_end_pos= anc_buff + new_anc_length;
@@ -1191,6 +1208,7 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
bmove(leaf_buff+p_length+t_length, half_pos, tmp_length);
(*keyinfo->store_key)(keyinfo,leaf_buff+p_length, &key_inserted);
new_leaf_length= tmp_length + t_length + p_length;
+ DBUG_ASSERT(new_leaf_length <= share->max_index_block_size);
leaf_page->size= new_leaf_length;
leaf_page->flag= page_flag;
@@ -1232,7 +1250,6 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
/*
Log changes to next page
This contains original data with some suffix data deleted
-
*/
DBUG_ASSERT(new_buff_length <= buff_length);
if (_ma_log_suffix(&next_page, buff_length, new_buff_length))
diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c
index 68102b389fb..183f74835b2 100644
--- a/storage/maria/ma_extra.c
+++ b/storage/maria/ma_extra.c
@@ -143,7 +143,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
(READ_CACHE_USED | WRITE_CACHE_USED | OPT_NO_ROWS)) &&
!share->state.header.uniques)
if (!(init_io_cache(&info->rec_cache, info->dfile.file, cache_size,
- WRITE_CACHE,share->state.state.data_file_length,
+ WRITE_CACHE, info->state->data_file_length,
(pbool) (info->lock_type != F_UNLCK),
MYF(share->write_flag & MY_WAIT_IF_FULL))))
{
@@ -319,7 +319,6 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
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_extra_function function,
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_extra_function function,
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:
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index cf7d5df5339..c9dc20ce78b 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -570,21 +570,40 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share->block_size= share->base.block_size; /* Convenience */
share->max_index_block_size= share->block_size - KEYPAGE_CHECKSUM_SIZE;
+ share->keypage_header= ((share->base.born_transactional ?
+ LSN_STORE_SIZE + TRANSID_SIZE :
+ 0) + KEYPAGE_KEYID_SIZE + KEYPAGE_FLAG_SIZE +
+ KEYPAGE_USED_SIZE);
{
HA_KEYSEG *pos=share->keyparts;
uint32 ftkey_nr= 1;
for (i=0 ; i < keys ; i++)
{
- share->keyinfo[i].share= share;
- disk_pos=_ma_keydef_read(disk_pos, &share->keyinfo[i]);
- share->keyinfo[i].key_nr= i;
+ MARIA_KEYDEF *keyinfo= &share->keyinfo[i];
+ keyinfo->share= share;
+ disk_pos=_ma_keydef_read(disk_pos, keyinfo);
+ keyinfo->key_nr= i;
+
+ /* See ma_delete.cc::underflow() */
+ if (!(keyinfo->flag & (HA_BINARY_PACK_KEY | HA_PACK_KEY)))
+ keyinfo->underflow_block_length= keyinfo->block_length/3;
+ else
+ {
+ /* Packed key, ensure we don't get overflow in underflow() */
+ keyinfo->underflow_block_length=
+ max((int) (share->max_index_block_size - keyinfo->maxlength * 3),
+ (int) (share->keypage_header + share->base.key_reflength));
+ set_if_smaller(keyinfo->underflow_block_length,
+ keyinfo->block_length/3);
+ }
+
disk_pos_assert(share,
- disk_pos + share->keyinfo[i].keysegs * HA_KEYSEG_SIZE,
+ disk_pos + keyinfo->keysegs * HA_KEYSEG_SIZE,
end_pos);
- if (share->keyinfo[i].key_alg == HA_KEY_ALG_RTREE)
+ if (keyinfo->key_alg == HA_KEY_ALG_RTREE)
share->have_rtree= 1;
- share->keyinfo[i].seg=pos;
- for (j=0 ; j < share->keyinfo[i].keysegs; j++,pos++)
+ keyinfo->seg=pos;
+ for (j=0 ; j < keyinfo->keysegs; j++,pos++)
{
disk_pos=_ma_keyseg_read(disk_pos, pos);
if (pos->type == HA_KEYTYPE_TEXT ||
@@ -602,25 +621,25 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
else if (pos->type == HA_KEYTYPE_BINARY)
pos->charset= &my_charset_bin;
}
- if (share->keyinfo[i].flag & HA_SPATIAL)
+ if (keyinfo->flag & HA_SPATIAL)
{
#ifdef HAVE_SPATIAL
uint sp_segs=SPDIMS*2;
- share->keyinfo[i].seg=pos-sp_segs;
- share->keyinfo[i].keysegs--;
+ keyinfo->seg=pos-sp_segs;
+ keyinfo->keysegs--;
versioning= 0;
#else
my_errno=HA_ERR_UNSUPPORTED;
goto err;
#endif
}
- else if (share->keyinfo[i].flag & HA_FULLTEXT)
+ else if (keyinfo->flag & HA_FULLTEXT)
{
versioning= 0;
DBUG_ASSERT(fulltext_keys);
{
uint k;
- share->keyinfo[i].seg=pos;
+ keyinfo->seg=pos;
for (k=0; k < FT_SEGS; k++)
{
*pos= ft_keysegs[k];
@@ -635,8 +654,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
}
if (!share->ft2_keyinfo.seg)
{
- memcpy(&share->ft2_keyinfo, &share->keyinfo[i],
- sizeof(MARIA_KEYDEF));
+ memcpy(&share->ft2_keyinfo, keyinfo, sizeof(MARIA_KEYDEF));
share->ft2_keyinfo.keysegs=1;
share->ft2_keyinfo.flag=0;
share->ft2_keyinfo.keylength=
@@ -646,10 +664,10 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share->ft2_keyinfo.end=pos;
setup_key_functions(& share->ft2_keyinfo);
}
- share->keyinfo[i].ftkey_nr= ftkey_nr++;
+ keyinfo->ftkey_nr= ftkey_nr++;
}
- setup_key_functions(share->keyinfo+i);
- share->keyinfo[i].end=pos;
+ setup_key_functions(keyinfo);
+ keyinfo->end=pos;
pos->type=HA_KEYTYPE_END; /* End */
pos->length=share->base.rec_reflength;
pos->null_bit=0;
@@ -693,10 +711,6 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share->base.null_bytes +
share->base.pack_bytes +
test(share->options & HA_OPTION_CHECKSUM));
- share->keypage_header= ((share->base.born_transactional ?
- LSN_STORE_SIZE + TRANSID_SIZE :
- 0) + KEYPAGE_KEYID_SIZE + KEYPAGE_FLAG_SIZE +
- KEYPAGE_USED_SIZE);
share->kfile.file= kfile;
if (open_flags & HA_OPEN_COPY)
@@ -933,7 +947,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
{
/*
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);
@@ -1607,7 +1621,6 @@ uchar *_ma_keydef_read(uchar *ptr, MARIA_KEYDEF *keydef)
keydef->keylength = mi_uint2korr(ptr); ptr+= 2;
keydef->minlength = mi_uint2korr(ptr); ptr+= 2;
keydef->maxlength = mi_uint2korr(ptr); ptr+= 2;
- keydef->underflow_block_length=keydef->block_length/3;
keydef->version = 0; /* Not saved */
keydef->parser = &ft_default_parser;
keydef->ftkey_nr = 0;
diff --git a/storage/maria/ma_page.c b/storage/maria/ma_page.c
index bcd50f028ec..9f6a7406ea7 100644
--- a/storage/maria/ma_page.c
+++ b/storage/maria/ma_page.c
@@ -193,6 +193,7 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock,
nod_flag= _ma_test_if_nod(share, buff);
DBUG_ASSERT(page->size == page_length);
+ DBUG_ASSERT(page->size <= share->max_index_block_size);
DBUG_ASSERT(page->flag == _ma_get_keypage_flag(share, buff));
if (page->pos < share->base.keystart ||
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index ad25e72bebe..e96bf0cda25 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -2271,8 +2271,14 @@ restart:
("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);
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index f3357bfb921..7b80ca5a5b8 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -1079,7 +1079,6 @@ int _ma_split_page(MARIA_HA *info, MARIA_KEY *key, MARIA_PAGE *split_page,
Returns pointer to start of key.
key will contain the key.
- return_key_length will contain the length of key
after_key will contain the position to where the next key starts
*/
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index cf074c8aa98..6932ae0d4f1 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -747,7 +747,7 @@ struct st_maria_handler
{ length=mi_uint2korr((key)+1)+3; } \
}
-#define maria_max_key_length() ((maria_block_size - MAX_KEYPAGE_HEADER_SIZE)/2 - MARIA_INDEX_OVERHEAD_SIZE)
+#define maria_max_key_length() ((maria_block_size - MAX_KEYPAGE_HEADER_SIZE)/3 - MARIA_INDEX_OVERHEAD_SIZE)
#define get_pack_length(length) ((length) >= 255 ? 3 : 1)
#define _ma_have_versioning(info) ((info)->row_flag & ROW_FLAG_TRANSID)