Commit fb135f7e authored by Michael Widenius's avatar Michael Widenius

Automatic merge with 5.2

parents d2206ad1 b5f830d8
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov ** 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_global.h>
#include <my_sys.h> #include <my_sys.h>
...@@ -635,8 +635,13 @@ static void write_header(FILE *sql_file, char *db_name) ...@@ -635,8 +635,13 @@ static void write_header(FILE *sql_file, char *db_name)
if (!path) 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,"\ 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\ /*!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) ...@@ -666,8 +671,12 @@ static void write_footer(FILE *sql_file)
if (!path) if (!path)
{ {
fprintf(md_result_file,"\ 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"); /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n");
}
} }
if (opt_set_charset) if (opt_set_charset)
fprintf(sql_file, fprintf(sql_file,
......
...@@ -18,7 +18,7 @@ dnl When merging new MySQL releases, update the version number to match the ...@@ -18,7 +18,7 @@ dnl When merging new MySQL releases, update the version number to match the
dnl MySQL version number. dnl MySQL version number.
dnl dnl
dnl Note: the following line must be parseable by win/configure.js:GetVersion() 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_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
......
...@@ -1722,6 +1722,90 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir ...@@ -1722,6 +1722,90 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
</table_data> </table_data>
</database> </database>
</mysqldump> </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; drop table t1, t2;
# #
# Bug#12123 mysqldump --tab results in text file which can't be imported # Bug#12123 mysqldump --tab results in text file which can't be imported
......
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,
`Zubehr` 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, Zubehr, Datum_Annahme) VALUES ('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006');
INSERT INTO t1 (Datum_Eingang, BenutzerID, Zubehr, Datum_Annahme) VALUES ('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '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;
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;
#
# 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,
`Zubehr` 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, Zubehr, Datum_Annahme) VALUES ('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '21.06.2006'),('2006-06-21 00:00:00', 713, 'ohne Zubehr', '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;
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;
...@@ -661,6 +661,10 @@ a int(10), b varchar(30), c datetime, d blob, e text); ...@@ -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 t1 values (NULL), (10), (20);
insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thirty"); insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thirty");
--exec $MYSQL_DUMP --skip-comments --xml --no-create-info test --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; drop table t1, t2;
......
...@@ -909,7 +909,7 @@ double ha_maria::scan_time() ...@@ -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 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 we also can't use any compression, which may make the index file much
larger) larger)
......
...@@ -907,7 +907,7 @@ void _ma_print_bitmap(MARIA_FILE_BITMAP *bitmap, uchar *data, ...@@ -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)); fprintf(DBUG_FILE,"\nDump of bitmap page at %s\n", llstr(page, llbuff));
page++; /* Skip bitmap page */ page++; /* Skip bitmap page */
for (pos= data, end= pos + bitmap->total_size; for (pos= data, end= pos + bitmap->max_total_size;
pos < end ; pos < end ;
pos+= 6) pos+= 6)
{ {
...@@ -1853,7 +1853,7 @@ static void use_head(MARIA_HA *info, pgcache_page_no_t page, uint size, ...@@ -1853,7 +1853,7 @@ static void use_head(MARIA_HA *info, pgcache_page_no_t page, uint size,
find_where_to_split_row() find_where_to_split_row()
share Maria share share Maria share
row Information of what is in the row (from calc_record_size()) 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 split_size Free size on the page (The head length must be less
than this) than this)
...@@ -1862,7 +1862,7 @@ static void use_head(MARIA_HA *info, pgcache_page_no_t page, uint size, ...@@ -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, 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; uint *lengths, *lengths_end;
/* /*
...@@ -1872,19 +1872,20 @@ static uint find_where_to_split_row(MARIA_SHARE *share, MARIA_ROW *row, ...@@ -1872,19 +1872,20 @@ static uint find_where_to_split_row(MARIA_SHARE *share, MARIA_ROW *row,
- One extent - One extent
*/ */
uint row_length= (row->min_length + uint row_length= (row->min_length +
size_to_store_key_length(extents_length) + size_to_store_key_length(extents) +
ROW_EXTENT_SIZE); 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 Store first in all_field_lengths the different parts that are written
to the row. This needs to be in same order as in to the row. This needs to be in same order as in
ma_block_rec.c::write_block_record() 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[-2]= share->base.fixed_not_null_fields_length;
row->null_field_lengths[-1]= row->field_lengths_length; row->null_field_lengths[-1]= row->field_lengths_length;
for (lengths= row->null_field_lengths - EXTRA_LENGTH_FIELDS, 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++) EXTRA_LENGTH_FIELDS); lengths < lengths_end; lengths++)
{ {
if (row_length + *lengths > split_size) if (row_length + *lengths > split_size)
...@@ -2040,18 +2041,19 @@ my_bool _ma_bitmap_find_place(MARIA_HA *info, MARIA_ROW *row, ...@@ -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; head_length+= ELEMENTS_RESERVED_FOR_MAIN_PART * ROW_EXTENT_SIZE;
/* The first segment size is stored in 'row_length' */ /* 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); max_page_size);
full_page_size= MAX_TAIL_SIZE(share->block_size); full_page_size= MAX_TAIL_SIZE(share->block_size);
position= 0; 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 */ position= ELEMENTS_RESERVED_FOR_MAIN_PART -2; /* Only head and tail */
if (find_head(info, row_length, position)) if (find_head(info, row_length, position))
goto abort; goto abort;
row->space_on_head_page= row_length; row->space_on_head_page= row_length;
rest_length= head_length - row_length;
if (write_rest_of_head(info, position, rest_length)) if (write_rest_of_head(info, position, rest_length))
goto abort; goto abort;
...@@ -2137,16 +2139,22 @@ my_bool _ma_bitmap_find_new_place(MARIA_HA *info, MARIA_ROW *row, ...@@ -2137,16 +2139,22 @@ my_bool _ma_bitmap_find_new_place(MARIA_HA *info, MARIA_ROW *row,
/* Allocate enough space */ /* Allocate enough space */
head_length+= ELEMENTS_RESERVED_FOR_MAIN_PART * ROW_EXTENT_SIZE; 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; 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 */ position= ELEMENTS_RESERVED_FOR_MAIN_PART -2; /* Only head and tail */
use_head(info, page, row_length, position); use_head(info, page, row_length, position);
row->space_on_head_page= row_length; row->space_on_head_page= row_length;
rest_length= head_length - row_length;
if (write_rest_of_head(info, position, rest_length)) if (write_rest_of_head(info, position, rest_length))
goto abort; goto abort;
......
...@@ -1721,7 +1721,7 @@ struct st_row_pos_info ...@@ -1721,7 +1721,7 @@ struct st_row_pos_info
static my_bool get_head_or_tail_page(MARIA_HA *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, uchar *buff, uint length, uint page_type,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
struct st_row_pos_info *res) struct st_row_pos_info *res)
...@@ -1821,7 +1821,7 @@ crashed: ...@@ -1821,7 +1821,7 @@ crashed:
*/ */
static my_bool get_rowpos_in_head_or_tail_page(MARIA_HA *info, 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, uchar *buff, uint length,
uint page_type, uint page_type,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
...@@ -2257,7 +2257,7 @@ static void store_extent_info(uchar *to, ...@@ -2257,7 +2257,7 @@ static void store_extent_info(uchar *to,
for (block= first_block, end_block= first_block+count ; for (block= first_block, end_block= first_block+count ;
block < end_block; block++) 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)) if (likely(block->used & BLOCKUSED_USED))
{ {
uint page_count= block->page_count; uint page_count= block->page_count;
...@@ -3088,9 +3088,10 @@ static my_bool write_block_record(MARIA_HA *info, ...@@ -3088,9 +3088,10 @@ static my_bool write_block_record(MARIA_HA *info,
extent_data= row_extents_second_part + extent_data= row_extents_second_part +
((last_head_block - head_block) - 2) * ROW_EXTENT_SIZE; ((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); 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 else
...@@ -3643,6 +3644,7 @@ my_bool _ma_write_abort_block_record(MARIA_HA *info) ...@@ -3643,6 +3644,7 @@ my_bool _ma_write_abort_block_record(MARIA_HA *info)
} }
} }
} }
_ma_bitmap_unlock(share);
if (share->now_transactional) if (share->now_transactional)
{ {
if (_ma_write_clr(info, info->cur_row.orig_undo_lsn, 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) ...@@ -3652,7 +3654,6 @@ my_bool _ma_write_abort_block_record(MARIA_HA *info)
&lsn, (void*) 0)) &lsn, (void*) 0))
res= 1; res= 1;
} }
_ma_bitmap_unlock(share);
_ma_unpin_all_pages_and_finalize_row(info, lsn); _ma_unpin_all_pages_and_finalize_row(info, lsn);
DBUG_RETURN(res); DBUG_RETURN(res);
} }
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
/* Minimum header size needed for a new row */ /* Minimum header size needed for a new row */
#define BASE_ROW_HEADER_SIZE FLAG_SIZE #define BASE_ROW_HEADER_SIZE FLAG_SIZE
#define TRANS_ROW_EXTRA_HEADER_SIZE TRANSID_SIZE
#define PAGE_TYPE_MASK 7 #define PAGE_TYPE_MASK 7
enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_TYPE }; enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_TYPE };
......
...@@ -1991,14 +1991,22 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend, ...@@ -1991,14 +1991,22 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend,
{ {
/* Not at end of bitmap */ /* Not at end of bitmap */
uint bitmap_pattern; uint bitmap_pattern;
uint byte_offset;
offset_page= (uint) ((page % share->bitmap.pages_covered) -1) * 3; offset_page= (uint) ((page % share->bitmap.pages_covered) -1) * 3;
offset= offset_page & 7; offset= offset_page & 7;
data= bitmap_buff + offset_page / 8; byte_offset= offset_page / 8;
data= bitmap_buff + byte_offset;
bitmap_pattern= uint2korr(data); 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)) || if (((bitmap_pattern >> offset)) ||
(data + 2 < bitmap_buff + share->bitmap.max_total_size && (byte_offset + 2 < share->bitmap.max_total_size &&
_ma_check_if_zero(data+2, bitmap_buff + share->bitmap.max_total_size - _ma_check_if_zero(data+2, share->bitmap.max_total_size -
data - 2))) byte_offset - 2)))
{ {
ulonglong bitmap_page; ulonglong bitmap_page;
bitmap_page= page / share->bitmap.pages_covered; bitmap_page= page / share->bitmap.pages_covered;
......
...@@ -571,6 +571,7 @@ static int del(MARIA_HA *info, MARIA_KEY *key, ...@@ -571,6 +571,7 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
endpos= leaf_page->buff + leaf_length; endpos= leaf_page->buff + leaf_length;
tmp_key.keyinfo= keyinfo; tmp_key.keyinfo= keyinfo;
tmp_key.data= keybuff; tmp_key.data= keybuff;
next_buff= 0;
if (!(key_start= _ma_get_last_key(&tmp_key, leaf_page, endpos))) if (!(key_start= _ma_get_last_key(&tmp_key, leaf_page, endpos)))
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -597,9 +598,11 @@ static int del(MARIA_HA *info, MARIA_KEY *key, ...@@ -597,9 +598,11 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
/* underflow writes "next_page" to disk */ /* underflow writes "next_page" to disk */
ret_value= underflow(info, keyinfo, leaf_page, &next_page, ret_value= underflow(info, keyinfo, leaf_page, &next_page,
endpos); endpos);
if (ret_value == 0 && leaf_page->size > if (ret_value < 0)
share->max_index_block_size) 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, ret_value= (_ma_split_page(info, key, leaf_page,
share->max_index_block_size, share->max_index_block_size,
(uchar*) 0, 0, 0, (uchar*) 0, 0, 0,
...@@ -632,6 +635,7 @@ static int del(MARIA_HA *info, MARIA_KEY *key, ...@@ -632,6 +635,7 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
goto err; goto err;
} }
my_afree(next_buff); my_afree(next_buff);
DBUG_ASSERT(leaf_page->size <= share->max_index_block_size);
DBUG_RETURN(ret_value); DBUG_RETURN(ret_value);
} }
...@@ -709,10 +713,14 @@ static int del(MARIA_HA *info, MARIA_KEY *key, ...@@ -709,10 +713,14 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
KEY_OP_DEBUG_LOG_ADD_2)) KEY_OP_DEBUG_LOG_ADD_2))
goto err; goto err;
DBUG_ASSERT(leaf_page->size <= share->max_index_block_size);
DBUG_RETURN(new_leaf_length <= DBUG_RETURN(new_leaf_length <=
(info->quick_mode ? MARIA_MIN_KEYBLOCK_LENGTH : (info->quick_mode ? MARIA_MIN_KEYBLOCK_LENGTH :
(uint) keyinfo->underflow_block_length)); (uint) keyinfo->underflow_block_length));
err: err:
if (next_buff)
my_afree(next_buff);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} /* del */ } /* del */
...@@ -731,9 +739,18 @@ err: ...@@ -731,9 +739,18 @@ err:
leaf_page is saved to disk leaf_page is saved to disk
Caller must save anc_buff 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 @return
@retval 0 ok @retval 0 ok
@retval 1 ok, but anc_buff did underflow @retval 1 ok, but anc_page did underflow
@retval -1 error @retval -1 error
*/ */
...@@ -1153,7 +1170,7 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo, ...@@ -1153,7 +1170,7 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
_ma_kpointer(info,leaf_key.data + leaf_key.data_length + _ma_kpointer(info,leaf_key.data + leaf_key.data_length +
leaf_key.ref_length, leaf_page->pos); 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("anc_buff", anc_buff, new_anc_length);
DBUG_DUMP_KEY("key_to_anc", &leaf_key); DBUG_DUMP_KEY("key_to_anc", &leaf_key);
anc_end_pos= anc_buff + new_anc_length; anc_end_pos= anc_buff + new_anc_length;
...@@ -1191,6 +1208,7 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo, ...@@ -1191,6 +1208,7 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
bmove(leaf_buff+p_length+t_length, half_pos, tmp_length); bmove(leaf_buff+p_length+t_length, half_pos, tmp_length);
(*keyinfo->store_key)(keyinfo,leaf_buff+p_length, &key_inserted); (*keyinfo->store_key)(keyinfo,leaf_buff+p_length, &key_inserted);
new_leaf_length= tmp_length + t_length + p_length; 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->size= new_leaf_length;
leaf_page->flag= page_flag; leaf_page->flag= page_flag;
...@@ -1232,7 +1250,6 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo, ...@@ -1232,7 +1250,6 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
/* /*
Log changes to next page Log changes to next page
This contains original data with some suffix data deleted This contains original data with some suffix data deleted
*/ */
DBUG_ASSERT(new_buff_length <= buff_length); DBUG_ASSERT(new_buff_length <= buff_length);
if (_ma_log_suffix(&next_page, buff_length, new_buff_length)) if (_ma_log_suffix(&next_page, buff_length, new_buff_length))
......
...@@ -143,7 +143,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, ...@@ -143,7 +143,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
(READ_CACHE_USED | WRITE_CACHE_USED | OPT_NO_ROWS)) && (READ_CACHE_USED | WRITE_CACHE_USED | OPT_NO_ROWS)) &&
!share->state.header.uniques) !share->state.header.uniques)
if (!(init_io_cache(&info->rec_cache, info->dfile.file, cache_size, 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), (pbool) (info->lock_type != F_UNLCK),
MYF(share->write_flag & MY_WAIT_IF_FULL)))) MYF(share->write_flag & MY_WAIT_IF_FULL))))
{ {
...@@ -319,7 +319,6 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, ...@@ -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 do_flush= test(function != HA_EXTRA_PREPARE_FOR_DROP);
my_bool save_global_changed; my_bool save_global_changed;
enum flush_type type; enum flush_type type;
pthread_mutex_lock(&THR_LOCK_maria);
/* /*
This share, to have last_version=0, needs to save all its data/index 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 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, ...@@ -353,12 +352,14 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
type= do_flush ? FLUSH_RELEASE : FLUSH_IGNORE_CHANGED; type= do_flush ? FLUSH_RELEASE : FLUSH_IGNORE_CHANGED;
save_global_changed= share->global_changed; save_global_changed= share->global_changed;
share->global_changed= 1; /* Don't increment open count */ 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, if (_ma_flush_table_files(info, MARIA_FLUSH_DATA | MARIA_FLUSH_INDEX,
type, type)) type, type))
{ {
error=my_errno; error=my_errno;
share->changed= 1; share->changed= 1;
} }
pthread_mutex_lock(&share->intern_lock);
share->global_changed= save_global_changed; share->global_changed= save_global_changed;
if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) 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, ...@@ -395,10 +396,9 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function,
error= my_errno; error= my_errno;
share->bitmap.changed_not_flushed= 0; 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 */ share->last_version= 0L; /* Impossible version */
pthread_mutex_unlock(&share->intern_lock); pthread_mutex_unlock(&share->intern_lock);
pthread_mutex_unlock(&THR_LOCK_maria);
break; break;
} }
case HA_EXTRA_PREPARE_FOR_FORCED_CLOSE: case HA_EXTRA_PREPARE_FOR_FORCED_CLOSE:
......
...@@ -570,21 +570,40 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) ...@@ -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->block_size= share->base.block_size; /* Convenience */
share->max_index_block_size= share->block_size - KEYPAGE_CHECKSUM_SIZE; 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; HA_KEYSEG *pos=share->keyparts;
uint32 ftkey_nr= 1; uint32 ftkey_nr= 1;
for (i=0 ; i < keys ; i++) for (i=0 ; i < keys ; i++)
{ {
share->keyinfo[i].share= share; MARIA_KEYDEF *keyinfo= &share->keyinfo[i];
disk_pos=_ma_keydef_read(disk_pos, &share->keyinfo[i]); keyinfo->share= share;
share->keyinfo[i].key_nr= i; 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_assert(share,
disk_pos + share->keyinfo[i].keysegs * HA_KEYSEG_SIZE, disk_pos + keyinfo->keysegs * HA_KEYSEG_SIZE,
end_pos); 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->have_rtree= 1;
share->keyinfo[i].seg=pos; keyinfo->seg=pos;
for (j=0 ; j < share->keyinfo[i].keysegs; j++,pos++) for (j=0 ; j < keyinfo->keysegs; j++,pos++)
{ {
disk_pos=_ma_keyseg_read(disk_pos, pos); disk_pos=_ma_keyseg_read(disk_pos, pos);
if (pos->type == HA_KEYTYPE_TEXT || if (pos->type == HA_KEYTYPE_TEXT ||
...@@ -602,25 +621,25 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) ...@@ -602,25 +621,25 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
else if (pos->type == HA_KEYTYPE_BINARY) else if (pos->type == HA_KEYTYPE_BINARY)
pos->charset= &my_charset_bin; pos->charset= &my_charset_bin;
} }
if (share->keyinfo[i].flag & HA_SPATIAL) if (keyinfo->flag & HA_SPATIAL)
{ {
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
uint sp_segs=SPDIMS*2; uint sp_segs=SPDIMS*2;
share->keyinfo[i].seg=pos-sp_segs; keyinfo->seg=pos-sp_segs;
share->keyinfo[i].keysegs--; keyinfo->keysegs--;
versioning= 0; versioning= 0;
#else #else
my_errno=HA_ERR_UNSUPPORTED; my_errno=HA_ERR_UNSUPPORTED;
goto err; goto err;
#endif #endif
} }
else if (share->keyinfo[i].flag & HA_FULLTEXT) else if (keyinfo->flag & HA_FULLTEXT)
{ {
versioning= 0; versioning= 0;
DBUG_ASSERT(fulltext_keys); DBUG_ASSERT(fulltext_keys);
{ {
uint k; uint k;
share->keyinfo[i].seg=pos; keyinfo->seg=pos;
for (k=0; k < FT_SEGS; k++) for (k=0; k < FT_SEGS; k++)
{ {
*pos= ft_keysegs[k]; *pos= ft_keysegs[k];
...@@ -635,8 +654,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) ...@@ -635,8 +654,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
} }
if (!share->ft2_keyinfo.seg) if (!share->ft2_keyinfo.seg)
{ {
memcpy(&share->ft2_keyinfo, &share->keyinfo[i], memcpy(&share->ft2_keyinfo, keyinfo, sizeof(MARIA_KEYDEF));
sizeof(MARIA_KEYDEF));
share->ft2_keyinfo.keysegs=1; share->ft2_keyinfo.keysegs=1;
share->ft2_keyinfo.flag=0; share->ft2_keyinfo.flag=0;
share->ft2_keyinfo.keylength= share->ft2_keyinfo.keylength=
...@@ -646,10 +664,10 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) ...@@ -646,10 +664,10 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share->ft2_keyinfo.end=pos; share->ft2_keyinfo.end=pos;
setup_key_functions(& share->ft2_keyinfo); setup_key_functions(& share->ft2_keyinfo);
} }
share->keyinfo[i].ftkey_nr= ftkey_nr++; keyinfo->ftkey_nr= ftkey_nr++;
} }
setup_key_functions(share->keyinfo+i); setup_key_functions(keyinfo);
share->keyinfo[i].end=pos; keyinfo->end=pos;
pos->type=HA_KEYTYPE_END; /* End */ pos->type=HA_KEYTYPE_END; /* End */
pos->length=share->base.rec_reflength; pos->length=share->base.rec_reflength;
pos->null_bit=0; pos->null_bit=0;
...@@ -693,10 +711,6 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) ...@@ -693,10 +711,6 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share->base.null_bytes + share->base.null_bytes +
share->base.pack_bytes + share->base.pack_bytes +
test(share->options & HA_OPTION_CHECKSUM)); 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; share->kfile.file= kfile;
if (open_flags & HA_OPEN_COPY) if (open_flags & HA_OPEN_COPY)
...@@ -933,7 +947,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) ...@@ -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 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->intern_lock);
pthread_mutex_lock(&share->bitmap.bitmap_lock); pthread_mutex_lock(&share->bitmap.bitmap_lock);
...@@ -1607,7 +1621,6 @@ uchar *_ma_keydef_read(uchar *ptr, MARIA_KEYDEF *keydef) ...@@ -1607,7 +1621,6 @@ uchar *_ma_keydef_read(uchar *ptr, MARIA_KEYDEF *keydef)
keydef->keylength = mi_uint2korr(ptr); ptr+= 2; keydef->keylength = mi_uint2korr(ptr); ptr+= 2;
keydef->minlength = mi_uint2korr(ptr); ptr+= 2; keydef->minlength = mi_uint2korr(ptr); ptr+= 2;
keydef->maxlength = 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->version = 0; /* Not saved */
keydef->parser = &ft_default_parser; keydef->parser = &ft_default_parser;
keydef->ftkey_nr = 0; keydef->ftkey_nr = 0;
......
...@@ -193,6 +193,7 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock, ...@@ -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); nod_flag= _ma_test_if_nod(share, buff);
DBUG_ASSERT(page->size == page_length); 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)); DBUG_ASSERT(page->flag == _ma_get_keypage_flag(share, buff));
if (page->pos < share->base.keystart || if (page->pos < share->base.keystart ||
......
...@@ -2271,8 +2271,14 @@ restart: ...@@ -2271,8 +2271,14 @@ restart:
("block->hash_link: %p hash_link: %p " ("block->hash_link: %p hash_link: %p "
"block->status: %u", block->hash_link, "block->status: %u", block->hash_link,
hash_link, block->status )); 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) && page_status= (((block->hash_link == hash_link) &&
(block->status & PCBLOCK_READ)) ? (block->status & PCBLOCK_READ)) ?
PAGE_READ : PAGE_WAIT_TO_BE_READ); PAGE_READ : PAGE_WAIT_TO_BE_READ);
......
...@@ -1079,7 +1079,6 @@ int _ma_split_page(MARIA_HA *info, MARIA_KEY *key, MARIA_PAGE *split_page, ...@@ -1079,7 +1079,6 @@ int _ma_split_page(MARIA_HA *info, MARIA_KEY *key, MARIA_PAGE *split_page,
Returns pointer to start of key. Returns pointer to start of key.
key will contain the 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 after_key will contain the position to where the next key starts
*/ */
......
...@@ -747,7 +747,7 @@ struct st_maria_handler ...@@ -747,7 +747,7 @@ struct st_maria_handler
{ length=mi_uint2korr((key)+1)+3; } \ { 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 get_pack_length(length) ((length) >= 255 ? 3 : 1)
#define _ma_have_versioning(info) ((info)->row_flag & ROW_FLAG_TRANSID) #define _ma_have_versioning(info) ((info)->row_flag & ROW_FLAG_TRANSID)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment