Commit d272d18d authored by unknown's avatar unknown

Merge dator6.(none):/home/mikael/mysql_clones/bug33429

into  dator6.(none):/home/mikael/mysql_clones/mysql-5.1-engines

parents 21e654a8 53a8941b
......@@ -5379,4 +5379,13 @@ SHOW WARNINGS;
Level Code Message
Error 1178 The storage engine for the table doesn't support nullable columns
Error 1005 Can't create table 'test.t1' (errno: 138)
create table t1 (c1 tinyblob not null) engine=csv;
insert into t1 values("This");
update t1 set c1="That" where c1="This";
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
select * from t1;
c1
That
drop table t1;
End of 5.1 tests
......@@ -21,4 +21,14 @@ INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C');
INSERT INTO t1 VALUES('A ', 'A ');
ERROR 23000: Duplicate entry '' for key 'key1'
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL,
KEY(c1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('marshall\'s');
INSERT INTO t1 VALUES ('marsh');
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
End of 5.0 tests
......@@ -2023,4 +2023,185 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 repair status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
INSERT INTO t1 VALUES('b', 'b');
INSERT INTO t1 VALUES('c', 'b');
DELETE FROM t1 WHERE c1='b';
SELECT COUNT(*) FROM t1;
COUNT(*)
2
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
2
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1),
KEY (c1)
) ENGINE=MyISAM;
# Insert 100 rows. Query log disabled.
UPDATE t1 SET c1=REPEAT("a",128) LIMIT 90;
SELECT COUNT(*) FROM t1;
COUNT(*)
100
ALTER TABLE t1 ENGINE=MyISAM;
SELECT COUNT(*) FROM t1;
COUNT(*)
100
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 repair status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
1
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
INSERT INTO t1 VALUES('b', 'b');
INSERT INTO t1 VALUES('c', 'b');
DELETE FROM t1 WHERE c1='b';
SELECT COUNT(*) FROM t1;
COUNT(*)
2
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SELECT COUNT(*) FROM t1;
COUNT(*)
2
DROP TABLE t1;
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1),
KEY (c1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
# Insert 100 rows. Query log disabled.
UPDATE t1 SET c1=REPEAT(_utf8 x'e0ae85',43) LIMIT 90;
SELECT COUNT(*) FROM t1;
COUNT(*)
100
ALTER TABLE t1 ENGINE=MyISAM;
SELECT COUNT(*) FROM t1;
COUNT(*)
100
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1 (
c1 VARCHAR(10) NOT NULL,
c2 CHAR(10) DEFAULT NULL,
c3 VARCHAR(10) NOT NULL,
KEY (c1),
KEY (c2)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
MyISAM file: MYSQLTEST_VARDIR/master-data/test/t1
Record format: Packed
Character set: utf8_general_ci (33)
Data records: 0 Deleted blocks: 0
Recordlength: 94
table description:
Key Start Len Index Type
1 2 30 multip. varchar
2 33 30 multip. char NULL
DROP TABLE t1;
End of 5.1 tests
drop table if exists t1;
create table t1 (a int) partition by list ((a/3)*10 div 1)
(partition p0 values in (0), partition p1 values in (1));
ERROR HY000: This partition function is not allowed
CREATE TABLE t1 (
d DATE NOT NULL
)
......@@ -44,15 +47,6 @@ partition by key(a)
partitions 1e+300;
ERROR 42000: Only integers allowed as number here near '1e+300' at line 3
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by list (a)
(partition p0 values in (1));
create procedure pz()
......@@ -1207,25 +1201,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
id
22589
drop table t1, t2;
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
select @@sql_mode;
@@sql_mode
NO_DIR_IN_CREATE
create table t1 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory='/not/existing'
index directory='/not/existing'
);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
create table t1 (c1 varchar(255),c2 tinyint,primary key(c1))
partition by key (c1) partitions 10 ;
insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1;
......
......@@ -81,3 +81,34 @@ Got one of the listed errors
DROP DATABASE mysqltest2;
USE test;
DROP USER mysqltest_1@localhost;
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
select @@sql_mode;
@@sql_mode
NO_DIR_IN_CREATE
create table t1 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory='/not/existing'
index directory='/not/existing'
);
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
ERROR 42000: Incorrect table name 'part-data'
DROP TABLE IF EXISTS `example`;
CREATE TABLE `example` (
`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
`DESCRIPTION` varchar(30) NOT NULL,
`LEVEL` smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (`ID_EXAMPLE`)
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
c2 varchar(30) NOT NULL,
c3 smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (c1)
) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)(
PARTITION p0 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p0Data',
PARTITION p1 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p1Data',
PARTITION p2 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p2Data',
PARTITION p3 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p3Data'
PARTITION BY HASH(c1)(
PARTITION p0
DATA DIRECTORY = 'C:/mysqltest/p0Data'
INDEX DIRECTORY = 'D:/mysqltest/p0Index',
PARTITION p1,
PARTITION p2
DATA DIRECTORY = 'E:/mysqltest/p2Data'
INDEX DIRECTORY = 'F:/mysqltest/p2Index'
);
ERROR HY000: Can't create/write to file 'C:\build\5.1\data\partitiontest\p0Data\example#P#p0.MYD' (Errcode: 2)
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
INSERT INTO t1 VALUES (NULL, "first", 1);
INSERT INTO t1 VALUES (NULL, "second", 2);
INSERT INTO t1 VALUES (NULL, "third", 3);
ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index');
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
INSERT INTO t1 VALUES (NULL, "last", 4);
DROP TABLE t1;
SELECT @@global.example_enum_var = 'e2';
@@global.example_enum_var = 'e2'
1
......@@ -162,3 +162,11 @@ DROP DATABASE db1;
DROP DATABASE db2;
USE test;
End of 5.0 tests
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp';
Warnings:
Warning 0 DATA DIRECTORY option ignored
Warning 0 INDEX DIRECTORY option ignored
DROP TABLE t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
End of 5.1 tests
......@@ -1773,4 +1773,15 @@ drop table t1;
CREATE TABLE t1(a INT) ENGINE=CSV;
SHOW WARNINGS;
#
# BUG#33067 - .
#
create table t1 (c1 tinyblob not null) engine=csv;
insert into t1 values("This");
--enable_info
update t1 set c1="That" where c1="This";
--disable_info
select * from t1;
drop table t1;
--echo End of 5.1 tests
......@@ -39,4 +39,17 @@ INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C');
INSERT INTO t1 VALUES('A ', 'A ');
DROP TABLE t1;
#
# Bug#32705 - myisam corruption: Key in wrong position
# at page 1024 with ucs2_bin
#
CREATE TABLE t1 (
c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL,
KEY(c1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('marshall\'s');
INSERT INTO t1 VALUES ('marsh');
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
--echo End of 5.0 tests
......@@ -1278,5 +1278,189 @@ DELETE FROM t1 WHERE c1 >= 10;
CHECK TABLE t1;
DROP TABLE t1;
#
# Bug#33222 - myisam-table drops rows when column is added
# and a char-field > 128 exists
#
# Test #1 - CHECK TABLE sees wrong record, REPAR TABLE deletes it.
# Using a CHAR column that can have > 127 characters.
# Using a VARCHAR to create a table with dynamic row format.
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
SELECT COUNT(*) FROM t1;
CHECK TABLE t1;
REPAIR TABLE t1;
SELECT COUNT(*) FROM t1;
CHECK TABLE t1;
DROP TABLE t1;
#
# Test #2 - same as test #1, but using EXTENDED.
# Using a CHAR column that can have > 127 characters.
# Using a VARCHAR to create a table with dynamic row format.
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
SELECT COUNT(*) FROM t1;
CHECK TABLE t1 EXTENDED;
REPAIR TABLE t1 EXTENDED;
SELECT COUNT(*) FROM t1;
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
# Test #3 - same as test #1, but using OPTIMIZE TABLE.
# Using a CHAR column that can have > 127 characters.
# Using a VARCHAR to create a table with dynamic row format.
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
# Insert more rows and delete one in the middle to force optimize.
INSERT INTO t1 VALUES('b', 'b');
INSERT INTO t1 VALUES('c', 'b');
DELETE FROM t1 WHERE c1='b';
SELECT COUNT(*) FROM t1;
OPTIMIZE TABLE t1;
SELECT COUNT(*) FROM t1;
DROP TABLE t1;
#
# Test #4 - ALTER TABLE deletes rows.
# Using a CHAR column that can have > 127 characters.
# Using a VARCHAR to create a table with dynamic row format.
# Using an index which can be disabled during bulk insert.
CREATE TABLE t1 (
c1 CHAR(130),
c2 VARCHAR(1),
KEY (c1)
) ENGINE=MyISAM;
#
# Insert 100 rows. This turns bulk insert on during the copy phase of
# ALTER TABLE. Bulk insert disables keys before the insert and re-enables
# them by repair after the insert.
--disable_query_log
let $count= 100;
--echo # Insert $count rows. Query log disabled.
while ($count)
{
INSERT INTO t1 VALUES ('a', 'b');
dec $count;
}
--enable_query_log
#
# Change most of the rows into long character values with > 127 characters.
UPDATE t1 SET c1=REPEAT("a",128) LIMIT 90;
SELECT COUNT(*) FROM t1;
ALTER TABLE t1 ENGINE=MyISAM;
#
# With bug present, this shows that all long rows are gone.
SELECT COUNT(*) FROM t1;
CHECK TABLE t1;
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
# Test #5 - same as test #1 but UTF-8.
# Using a CHAR column that can have > 127 characters.
# Using a VARCHAR to create a table with dynamic row format.
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
# Using Tamil Letter A, Unicode U+0B85
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
SELECT COUNT(*) FROM t1;
CHECK TABLE t1;
REPAIR TABLE t1;
SELECT COUNT(*) FROM t1;
CHECK TABLE t1;
DROP TABLE t1;
#
# Test #6 - same as test #2, but UTF-8.
# Using a CHAR column that can have > 127 characters.
# Using a VARCHAR to create a table with dynamic row format.
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
# Using Tamil Letter A, Unicode U+0B85
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
SELECT COUNT(*) FROM t1;
CHECK TABLE t1 EXTENDED;
REPAIR TABLE t1 EXTENDED;
SELECT COUNT(*) FROM t1;
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
# Test #7 - same as test #3, but UTF-8.
# Using a CHAR column that can have > 127 characters.
# Using a VARCHAR to create a table with dynamic row format.
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
# Using Tamil Letter A, Unicode U+0B85
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
# Insert more rows and delete one in the middle to force optimize.
INSERT INTO t1 VALUES('b', 'b');
INSERT INTO t1 VALUES('c', 'b');
DELETE FROM t1 WHERE c1='b';
SELECT COUNT(*) FROM t1;
OPTIMIZE TABLE t1;
SELECT COUNT(*) FROM t1;
DROP TABLE t1;
#
# Test #8 - same as test #4, but UTF-8.
# Using a CHAR column that can have > 42 UTF-8 characters.
# Using a VARCHAR to create a table with dynamic row format.
# Using an index which can be disabled during bulk insert.
CREATE TABLE t1 (
c1 CHAR(50),
c2 VARCHAR(1),
KEY (c1)
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
#
# Insert 100 rows. This turns bulk insert on during the copy phase of
# ALTER TABLE. Bulk insert disables keys before the insert and re-enables
# them by repair after the insert.
--disable_query_log
let $count= 100;
--echo # Insert $count rows. Query log disabled.
while ($count)
{
INSERT INTO t1 VALUES ('a', 'b');
dec $count;
}
--enable_query_log
#
# Change most of the rows into long character values with > 42 characters.
# Using Tamil Letter A, Unicode U+0B85
UPDATE t1 SET c1=REPEAT(_utf8 x'e0ae85',43) LIMIT 90;
SELECT COUNT(*) FROM t1;
ALTER TABLE t1 ENGINE=MyISAM;
#
# With bug present, this shows that all long rows are gone.
SELECT COUNT(*) FROM t1;
CHECK TABLE t1;
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
#
# Bug#29182 - MyISAMCHK reports wrong character set
#
CREATE TABLE t1 (
c1 VARCHAR(10) NOT NULL,
c2 CHAR(10) DEFAULT NULL,
c3 VARCHAR(10) NOT NULL,
KEY (c1),
KEY (c2)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYISAMCHK -d $MYSQLTEST_VARDIR/master-data/test/t1
DROP TABLE t1;
--echo End of 5.1 tests
......@@ -14,6 +14,10 @@
drop table if exists t1;
--enable_warnings
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
create table t1 (a int) partition by list ((a/3)*10 div 1)
(partition p0 values in (0), partition p1 values in (1));
#
# Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash.
#
......@@ -78,24 +82,6 @@ create table t1 (a int)
partition by key(a)
partitions 1e+300;
#
# Bug 21350: Data Directory problems
#
-- error ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
#
# Insert a test that manages to create the first partition and fails with
# the second, ensure that we clean up afterwards in a proper manner.
#
--error ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
#
# Bug 19309 Partitions: Crash if double procedural alter
#
......@@ -1398,35 +1384,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified'
drop table t1, t2;
#
# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
#
disable_query_log;
eval create table t2 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory="$MYSQLTEST_VARDIR/master-data/test/"
index directory="$MYSQLTEST_VARDIR/master-data/test/"
);
enable_query_log;
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
select @@sql_mode;
create table t1 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory='/not/existing'
index directory='/not/existing'
);
show create table t2;
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
#
# Bug #27123 partition + on duplicate key update + varchar = Can't find record in <table>
#
......
......@@ -2,7 +2,9 @@
# (DATA/INDEX DIR requires symlinks)
-- source include/have_partition.inc
-- source include/have_symlink.inc
# remove the not_windows line after fixing bug#30459
# remove the not_windows line after fixing bug#33687
# symlinks must also work for files, not only directories
# as in --skip-symbolic-links
-- source include/not_windows.inc
-- disable_warnings
DROP TABLE IF EXISTS t1;
......@@ -118,4 +120,50 @@ connection default;
DROP USER mysqltest_1@localhost;
disconnect con1;
#
# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
#
disable_query_log;
eval create table t2 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory="$MYSQLTEST_VARDIR/master-data/test/"
index directory="$MYSQLTEST_VARDIR/master-data/test/"
);
enable_query_log;
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
select @@sql_mode;
create table t1 (i int )
partition by range (i)
(
partition p01 values less than (1000)
data directory='/not/existing'
index directory='/not/existing'
);
show create table t2;
DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
#
# Bug 21350: Data Directory problems
#
-- error ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
#
# Insert a test that manages to create the first partition and fails with
# the second, ensure that we clean up afterwards in a proper manner.
#
--error ER_WRONG_TABLE_NAME
create table t1 (a int)
partition by key (a)
(partition p0,
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
......@@ -7,23 +7,34 @@
#
# Bug 25141: Crash Server on Partitioning command
#
# Bug#30459: Partitioning across disks failing on Windows
# updated this test, since symlinked files are not supported on Windows
# (not the same as symlinked directories that have a special hack
# on windows). This test is not dependent on have_symlink.
--disable_warnings
DROP TABLE IF EXISTS `example`;
DROP TABLE IF EXISTS t1;
--enable_warnings
--disable_abort_on_error
CREATE TABLE `example` (
`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
`DESCRIPTION` varchar(30) NOT NULL,
`LEVEL` smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (`ID_EXAMPLE`)
CREATE TABLE t1 (
c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
c2 varchar(30) NOT NULL,
c3 smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (c1)
) ENGINE = MYISAM
PARTITION BY HASH(ID_EXAMPLE)(
PARTITION p0 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p0Data',
PARTITION p1 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p1Data',
PARTITION p2 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p2Data',
PARTITION p3 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p3Data'
PARTITION BY HASH(c1)(
PARTITION p0
DATA DIRECTORY = 'C:/mysqltest/p0Data'
INDEX DIRECTORY = 'D:/mysqltest/p0Index',
PARTITION p1,
PARTITION p2
DATA DIRECTORY = 'E:/mysqltest/p2Data'
INDEX DIRECTORY = 'F:/mysqltest/p2Index'
);
--enable_abort_on_error
INSERT INTO t1 VALUES (NULL, "first", 1);
INSERT INTO t1 VALUES (NULL, "second", 2);
INSERT INTO t1 VALUES (NULL, "third", 3);
ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index');
INSERT INTO t1 VALUES (NULL, "last", 4);
DROP TABLE t1;
$EXAMPLE_PLUGIN_OPT
"--plugin-load=;EXAMPLE=ha_example.so;"
--loose-plugin-example-enum-var=e2
--source include/have_example_plugin.inc
SELECT @@global.example_enum_var = 'e2';
......@@ -226,3 +226,15 @@ USE test;
--echo End of 5.0 tests
#
# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
# silently ignored
#
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
DROP TABLE t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
--echo End of 5.1 tests
......@@ -256,6 +256,7 @@ main(void)
char * str;
char * dst;
require(src);
for (j= 0; j<src_len; j++)
{
char c= rand();
......@@ -265,6 +266,7 @@ main(void)
/* Encode */
needed_length= base64_needed_encoded_length(src_len);
str= (char *) malloc(needed_length);
require(str);
for (k= 0; k < needed_length; k++)
str[k]= 0xff; /* Fill memory to check correct NUL termination */
require(base64_encode(src, src_len, str) == 0);
......@@ -272,7 +274,8 @@ main(void)
/* Decode */
dst= (char *) malloc(base64_needed_decoded_length(strlen(str)));
dst_len= base64_decode(str, strlen(str), dst);
require(dst);
dst_len= base64_decode(str, strlen(str), dst, NULL);
require(dst_len == src_len);
if (memcmp(src, dst, src_len) != 0)
......
......@@ -296,7 +296,6 @@ class Item_num_op :public Item_func_numhybrid
void print(String *str) { print_op(str); }
void find_num_type();
String *str_op(String *str) { DBUG_ASSERT(0); return 0; }
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
......@@ -382,6 +381,7 @@ class Item_func_additive_op :public Item_num_op
public:
Item_func_additive_op(Item *a,Item *b) :Item_num_op(a,b) {}
void result_precision();
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
......@@ -416,6 +416,7 @@ class Item_func_mul :public Item_num_op
double real_op();
my_decimal *decimal_op(my_decimal *);
void result_precision();
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
......@@ -456,6 +457,7 @@ class Item_func_mod :public Item_num_op
const char *func_name() const { return "%"; }
void result_precision();
void fix_length_and_dec();
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
};
......
......@@ -794,8 +794,18 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
partition_element *part_elem= part_it++;
if (part_elem->engine_type == NULL)
part_elem->engine_type= default_engine_type;
if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
part_elem->data_file_name= part_elem->index_file_name= 0;
#ifdef HAVE_READLINK
if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
#endif
{
if (part_elem->data_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"DATA DIRECTORY option ignored");
if (part_elem->index_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"INDEX DIRECTORY option ignored");
part_elem->data_file_name= part_elem->index_file_name= NULL;
}
if (!is_sub_partitioned())
{
if (check_table_name(part_elem->partition_name,
......
......@@ -118,11 +118,14 @@ void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status)
}
#define get_object(p, obj) \
#define get_object(p, obj, msg) \
{\
uint len = (uint)*p++; \
if (p + len > p_end || len >= sizeof(obj)) \
{\
errmsg= msg;\
goto err; \
}\
strmake(obj,(char*) p,len); \
p+= len; \
}\
......@@ -168,6 +171,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
int res;
SLAVE_INFO *si;
uchar *p= packet, *p_end= packet + packet_length;
const char *errmsg= "Wrong parameters to function register_slave";
if (check_access(thd, REPL_SLAVE_ACL, any_db,0,0,0,0))
return 1;
......@@ -176,9 +180,9 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
thd->server_id= si->server_id= uint4korr(p);
p+= 4;
get_object(p,si->host);
get_object(p,si->user);
get_object(p,si->password);
get_object(p,si->host, "Failed to register slave: too long 'report-host'");
get_object(p,si->user, "Failed to register slave: too long 'report-user'");
get_object(p,si->password, "Failed to register slave; too long 'report-password'");
if (p+10 > p_end)
goto err;
si->port= uint2korr(p);
......@@ -197,8 +201,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
err:
my_free(si, MYF(MY_WME));
my_message(ER_UNKNOWN_ERROR, "Wrong parameters to function register_slave",
MYF(0));
my_message(ER_UNKNOWN_ERROR, errmsg, MYF(0));
err2:
return 1;
}
......
......@@ -2356,15 +2356,7 @@ mysql_execute_command(THD *thd)
/* Might have been updated in create_table_precheck */
create_info.alias= create_table->alias;
#ifndef HAVE_READLINK
if (create_info.data_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"DATA DIRECTORY option ignored");
if (create_info.index_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"INDEX DIRECTORY option ignored");
create_info.data_file_name= create_info.index_file_name= NULL;
#else
#ifdef HAVE_READLINK
/* Fix names if symlinked tables */
if (append_file_to_dir(thd, &create_info.data_file_name,
create_table->table_name) ||
......
......@@ -1181,9 +1181,8 @@ int plugin_init(int *argc, char **argv, int flags)
/* Register all dynamic plugins */
if (!(flags & PLUGIN_INIT_SKIP_DYNAMIC_LOADING))
{
if (opt_plugin_load &&
plugin_load_list(&tmp_root, argc, argv, opt_plugin_load))
goto err;
if (opt_plugin_load)
plugin_load_list(&tmp_root, argc, argv, opt_plugin_load);
if (!(flags & PLUGIN_INIT_SKIP_PLUGIN_TABLE))
plugin_load(&tmp_root, argc, argv);
}
......@@ -1412,7 +1411,11 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv,
while (list)
{
if (p == buffer + sizeof(buffer) - 1)
break;
{
sql_print_error("plugin-load parameter too long");
DBUG_RETURN(TRUE);
}
switch ((*(p++)= *(list++))) {
case '\0':
list= NULL; /* terminate the loop */
......@@ -1421,10 +1424,17 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv,
case ':': /* can't use this as delimiter as it may be drive letter */
#endif
case ';':
name.str[name.length]= '\0';
if (str != &dl) // load all plugins in named module
str->str[str->length]= '\0';
if (str == &name) // load all plugins in named module
{
if (!name.length)
{
p--; /* reset pointer */
continue;
}
dl= name;
pthread_mutex_lock(&LOCK_plugin);
if ((plugin_dl= plugin_dl_add(&dl, REPORT_TO_LOG)))
{
for (plugin= plugin_dl->plugins; plugin->info; plugin++)
......@@ -1434,17 +1444,25 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv,
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG))
{
pthread_mutex_unlock(&LOCK_plugin);
goto error;
}
}
plugin_dl_del(&dl); // reduce ref count
}
}
else
{
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
pthread_mutex_lock(&LOCK_plugin);
if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG))
{
pthread_mutex_unlock(&LOCK_plugin);
goto error;
}
}
pthread_mutex_unlock(&LOCK_plugin);
name.length= dl.length= 0;
dl.str= NULL; name.str= p= buffer;
str= &name;
......@@ -1453,6 +1471,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv,
case '#':
if (str == &name)
{
name.str[name.length]= '\0';
str= &dl;
str->str= p;
continue;
......@@ -2999,7 +3018,8 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
DBUG_RETURN(-1);
}
if (opt->flags & PLUGIN_VAR_NOCMDOPT)
if ((opt->flags & (PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_THDLOCAL))
== PLUGIN_VAR_NOCMDOPT)
continue;
if (!opt->name)
......@@ -3009,7 +3029,7 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
DBUG_RETURN(-1);
}
if (!(v= find_bookmark(name, opt->name, opt->flags)))
if (!(opt->flags & PLUGIN_VAR_THDLOCAL))
{
optnamelen= strlen(opt->name);
optname= (char*) alloc_root(mem_root, namelen + optnamelen + 2);
......@@ -3017,7 +3037,23 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
optnamelen= namelen + optnamelen + 1;
}
else
optname= (char*) memdup_root(mem_root, v->key + 1, (optnamelen= v->name_len) + 1);
{
/* this should not fail because register_var should create entry */
if (!(v= find_bookmark(name, opt->name, opt->flags)))
{
sql_print_error("Thread local variable '%s' not allocated "
"in plugin '%s'.", opt->name, plugin_name);
DBUG_RETURN(-1);
}
*(int*)(opt + 1)= offset= v->offset;
if (opt->flags & PLUGIN_VAR_NOCMDOPT)
continue;
optname= (char*) memdup_root(mem_root, v->key + 1,
(optnamelen= v->name_len) + 1);
}
/* convert '_' to '-' */
for (p= optname; *p; p++)
......@@ -3029,20 +3065,13 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
options->app_type= opt;
options->id= (options-1)->id + 1;
if (opt->flags & PLUGIN_VAR_THDLOCAL)
*(int*)(opt + 1)= offset= v->offset;
plugin_opt_set_limits(options, opt);
if ((opt->flags & PLUGIN_VAR_TYPEMASK) != PLUGIN_VAR_ENUM &&
(opt->flags & PLUGIN_VAR_TYPEMASK) != PLUGIN_VAR_SET)
{
if (opt->flags & PLUGIN_VAR_THDLOCAL)
options->value= options->u_max_value= (uchar**)
(global_system_variables.dynamic_variables_ptr + offset);
else
options->value= options->u_max_value= *(uchar***) (opt + 1);
}
options[1]= options[0];
options[1].name= p= (char*) alloc_root(mem_root, optnamelen + 8);
......
......@@ -3480,8 +3480,18 @@ bool mysql_create_table_no_lock(THD *thd,
thd_proc_info(thd, "creating table");
create_info->table_existed= 0; // Mark that table is created
if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
#ifdef HAVE_READLINK
if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
#endif
{
if (create_info->data_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"DATA DIRECTORY option ignored");
if (create_info->index_file_name)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"INDEX DIRECTORY option ignored");
create_info->data_file_name= create_info->index_file_name= 0;
}
create_info->table_options=db_options;
path[path_length - reg_ext_length]= '\0'; // Remove .frm extension
......
......@@ -892,11 +892,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
ha_legacy_type(share->db_type())));
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
else
{
LEX_STRING pname= { C_STRING_WITH_LEN( "partition" ) };
if (str_db_type_length == pname.length &&
!strncmp((char *) next_chunk + 2, pname.str, pname.length))
else if (str_db_type_length == 9 &&
!strncmp((char *) next_chunk + 2, "partition", 9))
{
/*
Use partition handler
......@@ -910,8 +907,16 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
str_db_type_length, next_chunk + 2,
ha_legacy_type(share->db_type())));
}
}
#endif
else if (!tmp_plugin)
{
/* purecov: begin inspected */
error= 8;
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name.str);
my_free(buff, MYF(0));
goto err;
/* purecov: end */
}
next_chunk+= str_db_type_length + 2;
}
if (next_chunk + 5 < buff_end)
......@@ -2200,6 +2205,8 @@ void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg)
"of MySQL and cannot be read",
MYF(0), buff);
break;
case 8:
break;
default: /* Better wrong error than none */
case 4:
strxmov(buff, share->normalized_path.str, reg_ext, NullS);
......
......@@ -225,11 +225,17 @@ int get_byte(s)
if (s->stream.avail_in == 0)
{
errno = 0;
s->stream.avail_in = my_read(s->file, (uchar *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
s->stream.avail_in= (uInt) my_read(s->file, (uchar *)s->inbuf,
AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
/* if (ferror(s->file)) s->z_err = Z_ERRNO; */
return EOF;
}
else if (s->stream.avail_in == (uInt) -1)
{
s->z_eof= 1;
s->z_err= Z_ERRNO;
return EOF;
}
s->stream.next_in = s->inbuf;
......
......@@ -56,6 +56,7 @@
#define META_BUFFER_SIZE sizeof(uchar) + sizeof(uchar) + sizeof(ulonglong) \
+ sizeof(ulonglong) + sizeof(ulonglong) + sizeof(ulonglong) + sizeof(uchar)
#define TINA_CHECK_HEADER 254 // The number we use to determine corruption
#define BLOB_MEMROOT_ALLOC_SIZE 8192
/* The file extension */
#define CSV_EXT ".CSV" // The data file
......@@ -597,6 +598,8 @@ int ha_tina::find_current_row(uchar *buf)
bool read_all;
DBUG_ENTER("ha_tina::find_current_row");
free_root(&blobroot, MYF(MY_MARK_BLOCKS_FREE));
/*
We do not read further then local_saved_data_file_length in order
not to conflict with undergoing concurrent insert.
......@@ -684,6 +687,22 @@ int ha_tina::find_current_row(uchar *buf)
if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset(),
CHECK_FIELD_WARN))
goto err;
if ((*field)->flags & BLOB_FLAG)
{
Field_blob *blob= *(Field_blob**) field;
uchar *src, *tgt;
uint length, packlength;
packlength= blob->pack_length_no_ptr();
length= blob->get_length(blob->ptr);
memcpy_fixed(&src, blob->ptr + packlength, sizeof(char*));
if (src)
{
tgt= (uchar*) alloc_root(&blobroot, length);
bmove(tgt, src, length);
memcpy_fixed(blob->ptr + packlength, &tgt, sizeof(char*));
}
}
}
}
next_position= end_offset + eoln_len;
......@@ -914,9 +933,10 @@ int ha_tina::open_update_temp_file_if_needed()
int ha_tina::update_row(const uchar * old_data, uchar * new_data)
{
int size;
int rc= -1;
DBUG_ENTER("ha_tina::update_row");
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
ha_statistic_increment(&SSV::ha_update_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
......@@ -931,20 +951,23 @@ int ha_tina::update_row(const uchar * old_data, uchar * new_data)
The temp_file_length is used to calculate new data file length.
*/
if (chain_append())
DBUG_RETURN(-1);
goto err;
if (open_update_temp_file_if_needed())
DBUG_RETURN(-1);
goto err;
if (my_write(update_temp_file, (uchar*)buffer.ptr(), size,
MYF(MY_WME | MY_NABP)))
DBUG_RETURN(-1);
goto err;
temp_file_length+= size;
rc= 0;
/* UPDATE should never happen on the log tables */
DBUG_ASSERT(!share->is_log_table);
DBUG_RETURN(0);
err:
DBUG_PRINT("info",("rc = %d", rc));
DBUG_RETURN(rc);
}
......@@ -1050,6 +1073,8 @@ int ha_tina::rnd_init(bool scan)
records_is_known= 0;
chain_ptr= chain;
init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0);
DBUG_RETURN(0);
}
......@@ -1115,7 +1140,7 @@ void ha_tina::position(const uchar *record)
int ha_tina::rnd_pos(uchar * buf, uchar *pos)
{
DBUG_ENTER("ha_tina::rnd_pos");
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
ha_statistic_increment(&SSV::ha_read_rnd_count);
current_position= (off_t)my_get_ptr(pos,ref_length);
DBUG_RETURN(find_current_row(buf));
}
......@@ -1179,6 +1204,7 @@ int ha_tina::rnd_end()
off_t file_buffer_start= 0;
DBUG_ENTER("ha_tina::rnd_end");
free_root(&blobroot, MYF(0));
records_is_known= 1;
if ((chain_ptr - chain) > 0)
......@@ -1350,6 +1376,8 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
/* set current position to the beginning of the file */
current_position= next_position= 0;
init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0);
/* Read the file row-by-row. If everything is ok, repair is not needed. */
while (!(rc= find_current_row(buf)))
{
......@@ -1358,6 +1386,8 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
current_position= next_position;
}
free_root(&blobroot, MYF(0));
my_free((char*)buf, MYF(0));
if (rc == HA_ERR_END_OF_FILE)
......@@ -1535,6 +1565,9 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
local_saved_data_file_length= share->saved_data_file_length;
/* set current position to the beginning of the file */
current_position= next_position= 0;
init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0);
/* Read the file row-by-row. If everything is ok, repair is not needed. */
while (!(rc= find_current_row(buf)))
{
......@@ -1543,6 +1576,8 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt)
current_position= next_position;
}
free_root(&blobroot, MYF(0));
my_free((char*)buf, MYF(0));
thd_proc_info(thd, old_proc_info);
......
......@@ -82,6 +82,7 @@ class ha_tina: public handler
uint32 chain_size;
uint local_data_file_version; /* Saved version of the data file used */
bool records_is_known;
MEM_ROOT blobroot;
private:
bool get_write_pos(off_t *end_pos, tina_set *closest_hole);
......
......@@ -608,7 +608,6 @@ const char *ft_precompiled_stopwords[] = {
"won't",
"wonder",
"would",
"would",
"wouldn't",
"yes",
"yet",
......
......@@ -1859,6 +1859,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
share->avg_row_length);
create_info.data_file_name= ha_create_info->data_file_name;
create_info.index_file_name= ha_create_info->index_file_name;
create_info.language= share->table_charset->number;
if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
create_flags|= HA_CREATE_TMP_TABLE;
......
......@@ -1006,12 +1006,12 @@ uint _mi_rec_pack(MI_INFO *info, register uchar *to,
{
if (rec->length > 255 && new_length > 127)
{
to[0]=(char) ((new_length & 127)+128);
to[1]=(char) (new_length >> 7);
to[0]= (uchar) ((new_length & 127) + 128);
to[1]= (uchar) (new_length >> 7);
to+=2;
}
else
*to++= (char) new_length;
*to++= (uchar) new_length;
memcpy((uchar*) to,pos,(size_t) new_length); to+=new_length;
flag|=bit;
}
......@@ -1045,7 +1045,7 @@ uint _mi_rec_pack(MI_INFO *info, register uchar *to,
}
if ((bit= bit << 1) >= 256)
{
*packpos++ = (char) (uchar) flag;
*packpos++= (uchar) flag;
bit=1; flag=0;
}
}
......@@ -1055,9 +1055,9 @@ uint _mi_rec_pack(MI_INFO *info, register uchar *to,
}
}
if (bit != 1)
*packpos= (char) (uchar) flag;
*packpos= (uchar) flag;
if (info->s->calc_checksum)
*to++=(char) info->checksum;
*to++= (uchar) info->checksum;
DBUG_PRINT("exit",("packed length: %d",(int) (to-startpos)));
DBUG_RETURN((uint) (to-startpos));
} /* _mi_rec_pack */
......@@ -1128,12 +1128,14 @@ my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *rec_buff,
goto err;
if (rec->length > 255 && new_length > 127)
{
if (to[0] != (char) ((new_length & 127)+128) ||
to[1] != (char) (new_length >> 7))
/* purecov: begin inspected */
if (to[0] != (uchar) ((new_length & 127) + 128) ||
to[1] != (uchar) (new_length >> 7))
goto err;
to+=2;
/* purecov: end */
}
else if (*to++ != (char) new_length)
else if (*to++ != (uchar) new_length)
goto err;
to+=new_length;
}
......
......@@ -815,8 +815,17 @@ static void setup_key_functions(register MI_KEYDEF *keyinfo)
keyinfo->get_key= _mi_get_pack_key;
if (keyinfo->seg[0].flag & HA_PACK_KEY)
{ /* Prefix compression */
/*
_mi_prefix_search() compares end-space against ASCII blank (' ').
It cannot be used for character sets, that do not encode the
blank character like ASCII does. UCS2 is an example. All
character sets with a fixed width > 1 or a mimimum width > 1
cannot represent blank like ASCII does. In these cases we have
to use _mi_seq_search() for the search.
*/
if (!keyinfo->seg->charset || use_strnxfrm(keyinfo->seg->charset) ||
(keyinfo->seg->flag & HA_NULL_PART))
(keyinfo->seg->flag & HA_NULL_PART) ||
(keyinfo->seg->charset->mbminlen > 1))
keyinfo->bin_search=_mi_seq_search;
else
keyinfo->bin_search=_mi_prefix_search;
......
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