Merge anubis.xiphis.org:/usr/home/antony/work/mysql-4.1-engines

into  anubis.xiphis.org:/usr/home/antony/work/mysql-4.1-engines.merge
This commit is contained in:
unknown 2007-10-19 13:01:08 -07:00
commit 1a74cdf9d7
18 changed files with 216 additions and 15 deletions

View File

@ -2428,6 +2428,18 @@ static int start_transaction(MYSQL *mysql_con)
need the REPEATABLE READ level (not anything lower, for example READ need the REPEATABLE READ level (not anything lower, for example READ
COMMITTED would give one new consistent read per dumped table). COMMITTED would give one new consistent read per dumped table).
*/ */
if ((mysql_get_server_version(mysql_con) < 40100) && opt_master_data)
{
fprintf(stderr, "-- %s: the combination of --single-transaction and "
"--master-data requires a MySQL server version of at least 4.1 "
"(current server's version is %s). %s\n",
ignore_errors ? "Warning" : "Error",
mysql_con->server_version ? mysql_con->server_version : "unknown",
ignore_errors ? "Continuing due to --force, backup may not be consistent across all tables!" : "Aborting.");
if (!ignore_errors)
exit(EX_MYSQLERR);
}
return (mysql_query_with_error_report(mysql_con, 0, return (mysql_query_with_error_report(mysql_con, 0,
"SET SESSION TRANSACTION ISOLATION " "SET SESSION TRANSACTION ISOLATION "
"LEVEL REPEATABLE READ") || "LEVEL REPEATABLE READ") ||

View File

@ -559,9 +559,10 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
if (!mergebuf) if (!mergebuf)
{ {
length=param->sort_buffer_length; length=param->sort_buffer_length;
while (length >= MIN_SORT_MEMORY && !mergebuf) while (length >= MIN_SORT_MEMORY)
{ {
mergebuf=my_malloc(length, MYF(0)); if ((mergebuf= my_malloc(length, MYF(0))))
break;
length=length*3/4; length=length*3/4;
} }
if (!mergebuf) if (!mergebuf)
@ -897,6 +898,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
count=error=0; count=error=0;
maxcount=keys/((uint) (Tb-Fb) +1); maxcount=keys/((uint) (Tb-Fb) +1);
DBUG_ASSERT(maxcount > 0);
LINT_INIT(to_start_filepos); LINT_INIT(to_start_filepos);
if (to_file) if (to_file)
to_start_filepos=my_b_tell(to_file); to_start_filepos=my_b_tell(to_file);

View File

@ -51,6 +51,15 @@ SELECT c1 as want1result from t1 where c1 like 'locatio%';
SELECT c1 as want1result from t1 where c1 like 'location%'; SELECT c1 as want1result from t1 where c1 like 'location%';
DROP TABLE t1; DROP TABLE t1;
#
# Bug #31070: crash during conversion of charsets
#
create table t1 (a set('a') not null);
insert into t1 values (),();
select cast(a as char(1)) from t1;
select a sounds like a from t1;
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
# Restore settings # Restore settings
USE test; USE test;

View File

@ -52,6 +52,17 @@ SELECT c1 as want1result from t1 where c1 like 'location%';
want1result want1result
location location
DROP TABLE t1; DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;

View File

@ -52,6 +52,17 @@ SELECT c1 as want1result from t1 where c1 like 'location%';
want1result want1result
location location
DROP TABLE t1; DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;

View File

@ -52,6 +52,17 @@ SELECT c1 as want1result from t1 where c1 like 'location%';
want1result want1result
location location
DROP TABLE t1; DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;

View File

@ -52,6 +52,17 @@ SELECT c1 as want1result from t1 where c1 like 'location%';
want1result want1result
location location
DROP TABLE t1; DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;

View File

@ -2371,6 +2371,17 @@ SELECT c1 as want1result from t1 where c1 like 'location%';
want1result want1result
location location
DROP TABLE t1; DROP TABLE t1;
create table t1 (a set('a') not null);
insert into t1 values (),();
select cast(a as char(1)) from t1;
cast(a as char(1))
select a sounds like a from t1;
a sounds like a
1
1
drop table t1;
DROP DATABASE d1; DROP DATABASE d1;
USE test; USE test;
SET character_set_server= @safe_character_set_server; SET character_set_server= @safe_character_set_server;

View File

@ -182,4 +182,40 @@ t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
INSERT INTO t1 VALUES ('uk'),('bg');
SELECT * FROM t1 WHERE a = 'uk';
a
uk
DELETE FROM t1 WHERE a = 'uk';
SELECT * FROM t1 WHERE a = 'uk';
a
UPDATE t1 SET a = 'us' WHERE a = 'uk';
SELECT * FROM t1 WHERE a = 'uk';
a
CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
INSERT INTO t2 VALUES ('uk'),('bg');
SELECT * FROM t2 WHERE a = 'uk';
a
uk
DELETE FROM t2 WHERE a = 'uk';
SELECT * FROM t2 WHERE a = 'uk';
a
INSERT INTO t2 VALUES ('uk');
UPDATE t2 SET a = 'us' WHERE a = 'uk';
SELECT * FROM t2 WHERE a = 'uk';
a
CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
INSERT INTO t3 VALUES ('uk'),('bg');
SELECT * FROM t3 WHERE a = 'uk';
a
uk
DELETE FROM t3 WHERE a = 'uk';
SELECT * FROM t3 WHERE a = 'uk';
a
INSERT INTO t3 VALUES ('uk');
UPDATE t3 SET a = 'us' WHERE a = 'uk';
SELECT * FROM t3 WHERE a = 'uk';
a
DROP TABLE t1,t2,t3;
End of 4.1 tests End of 4.1 tests

View File

@ -83,3 +83,30 @@ test.t1 repair status OK
SET myisam_repair_threads=@@global.myisam_repair_threads; SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a CHAR(255), KEY(a));
SET myisam_sort_buffer_size=4496;
INSERT INTO t1 VALUES
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0');
SET myisam_repair_threads=2;
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1;
End of 4.1 tests

View File

@ -216,4 +216,36 @@ t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVkXmzyf325R1DwLURkbYHwhydANIZMbKTgdcR5xS';
DROP TABLE t1; DROP TABLE t1;
#
# Bug #28878: InnoDB tables with UTF8 character set and indexes cause wrong result for DML
#
CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
INSERT INTO t1 VALUES ('uk'),('bg');
SELECT * FROM t1 WHERE a = 'uk';
DELETE FROM t1 WHERE a = 'uk';
SELECT * FROM t1 WHERE a = 'uk';
UPDATE t1 SET a = 'us' WHERE a = 'uk';
SELECT * FROM t1 WHERE a = 'uk';
CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
INSERT INTO t2 VALUES ('uk'),('bg');
SELECT * FROM t2 WHERE a = 'uk';
DELETE FROM t2 WHERE a = 'uk';
SELECT * FROM t2 WHERE a = 'uk';
INSERT INTO t2 VALUES ('uk');
UPDATE t2 SET a = 'us' WHERE a = 'uk';
SELECT * FROM t2 WHERE a = 'uk';
CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
INSERT INTO t3 VALUES ('uk'),('bg');
SELECT * FROM t3 WHERE a = 'uk';
DELETE FROM t3 WHERE a = 'uk';
SELECT * FROM t3 WHERE a = 'uk';
INSERT INTO t3 VALUES ('uk');
UPDATE t3 SET a = 'us' WHERE a = 'uk';
SELECT * FROM t3 WHERE a = 'uk';
DROP TABLE t1,t2,t3;
--echo End of 4.1 tests --echo End of 4.1 tests

View File

@ -83,4 +83,33 @@ SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1; DROP TABLE t1;
# End of 4.1 tests #
# BUG#31174 - "Repair" command on MyISAM crashes with small
# myisam_sort_buffer_size
#
CREATE TABLE t1(a CHAR(255), KEY(a));
SET myisam_sort_buffer_size=4496;
INSERT INTO t1 VALUES
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
('0'),('0'),('0'),('0'),('0'),('0'),('0');
SET myisam_repair_threads=2;
REPAIR TABLE t1;
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
DROP TABLE t1;
--echo End of 4.1 tests

View File

@ -5211,7 +5211,8 @@ uint Field_string::get_key_image(char *buff, uint length, CHARSET_INFO *cs,
length / field_charset->mbmaxlen); length / field_charset->mbmaxlen);
memcpy(buff, ptr, bytes); memcpy(buff, ptr, bytes);
if (bytes < length) if (bytes < length)
bzero(buff + bytes, length - bytes); field_charset->cset->fill(field_charset, buff + bytes, length - bytes,
' ');
return bytes; return bytes;
} }

View File

@ -6256,12 +6256,12 @@ my_mb_wc_big5(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc,const uchar *s,const uchar *e) my_wc_t *pwc,const uchar *s,const uchar *e)
{ {
int hi=s[0]; int hi;
if (s >= e) if (s >= e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
if (hi<0x80) if ((hi= s[0]) < 0x80)
{ {
pwc[0]=hi; pwc[0]=hi;
return 1; return 1;

View File

@ -5352,12 +5352,12 @@ my_wc_mb_cp932(CHARSET_INFO *cs __attribute__((unused)),
static int static int
my_mb_wc_cp932(CHARSET_INFO *cs __attribute__((unused)), my_mb_wc_cp932(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){ my_wc_t *pwc, const uchar *s, const uchar *e){
int hi=s[0]; int hi;
if (s >= e) if (s >= e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
if (hi < 0x80) if ((hi= s[0]) < 0x80)
{ {
pwc[0]=hi; pwc[0]=hi;
return 1; return 1;

View File

@ -8614,12 +8614,12 @@ my_mb_wc_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e) my_wc_t *pwc, const uchar *s, const uchar *e)
{ {
int hi=s[0]; int hi;
if (s >= e) if (s >= e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
if (hi<0x80) if ((hi= s[0]) < 0x80)
{ {
pwc[0]=hi; pwc[0]=hi;
return 1; return 1;

View File

@ -5665,12 +5665,10 @@ my_mb_wc_gb2312(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){ my_wc_t *pwc, const uchar *s, const uchar *e){
int hi; int hi;
hi=(int) s[0];
if (s >= e) if (s >= e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
if (hi<0x80) if ((hi= s[0]) < 0x80)
{ {
pwc[0]=hi; pwc[0]=hi;
return 1; return 1;

View File

@ -4512,12 +4512,12 @@ mb:
static int static int
my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)), my_mb_wc_sjis(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e){ my_wc_t *pwc, const uchar *s, const uchar *e){
int hi=s[0]; int hi;
if (s >= e) if (s >= e)
return MY_CS_TOOSMALL; return MY_CS_TOOSMALL;
if (hi < 0x80) if ((hi= s[0]) < 0x80)
{ {
pwc[0]=hi; pwc[0]=hi;
return 1; return 1;