Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
03793f4c
Commit
03793f4c
authored
Jul 10, 2009
by
Staale Smedseng
Browse files
Options
Browse Files
Download
Plain Diff
Merge from 5.1-bugteam
parents
ab2f3dd2
9752d4c8
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
768 additions
and
127 deletions
+768
-127
BUILD/check-cpu
BUILD/check-cpu
+7
-2
mysql-test/include/mix1.inc
mysql-test/include/mix1.inc
+2
-33
mysql-test/include/mtr_warnings.sql
mysql-test/include/mtr_warnings.sql
+2
-2
mysql-test/lib/My/SafeProcess/safe_process.cc
mysql-test/lib/My/SafeProcess/safe_process.cc
+14
-11
mysql-test/r/bug46080.result
mysql-test/r/bug46080.result
+15
-0
mysql-test/r/innodb_bug21704.result
mysql-test/r/innodb_bug21704.result
+55
-0
mysql-test/r/innodb_bug42101-nonzero.result
mysql-test/r/innodb_bug42101-nonzero.result
+5
-1
mysql-test/r/innodb_bug42101.result
mysql-test/r/innodb_bug42101.result
+4
-0
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+74
-3
mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45983.result
mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45983.result
+20
-0
mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45983.test
mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45983.test
+47
-0
mysql-test/suite/parts/r/partition_auto_increment_memory.result
...test/suite/parts/r/partition_auto_increment_memory.result
+2
-2
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
...test/suite/parts/r/partition_auto_increment_myisam.result
+2
-2
mysql-test/t/bug46080-master.opt
mysql-test/t/bug46080-master.opt
+1
-0
mysql-test/t/bug46080.test
mysql-test/t/bug46080.test
+20
-0
mysql-test/t/innodb_bug21704.test
mysql-test/t/innodb_bug21704.test
+96
-0
mysql-test/t/innodb_bug42101-nonzero.test
mysql-test/t/innodb_bug42101-nonzero.test
+2
-0
mysql-test/t/innodb_bug42101.test
mysql-test/t/innodb_bug42101.test
+2
-0
mysql-test/t/innodb_mysql.test
mysql-test/t/innodb_mysql.test
+81
-0
sql/ha_partition.cc
sql/ha_partition.cc
+5
-0
sql/item_sum.cc
sql/item_sum.cc
+5
-0
sql/rpl_rli.cc
sql/rpl_rli.cc
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+9
-1
storage/heap/ha_heap.cc
storage/heap/ha_heap.cc
+8
-0
storage/heap/ha_heap.h
storage/heap/ha_heap.h
+1
-0
storage/ibmdb2i/ha_ibmdb2i.cc
storage/ibmdb2i/ha_ibmdb2i.cc
+128
-65
storage/ibmdb2i/ha_ibmdb2i.h
storage/ibmdb2i/ha_ibmdb2i.h
+13
-0
storage/innobase/Makefile.am
storage/innobase/Makefile.am
+1
-1
storage/innobase/fil/fil0fil.c
storage/innobase/fil/fil0fil.c
+3
-3
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+132
-0
storage/innobase/include/trx0sys.ic
storage/innobase/include/trx0sys.ic
+1
-0
storage/innobase/trx/trx0purge.c
storage/innobase/trx/trx0purge.c
+1
-0
storage/innobase/trx/trx0sys.c
storage/innobase/trx/trx0sys.c
+1
-1
storage/innobase/trx/trx0undo.c
storage/innobase/trx/trx0undo.c
+1
-0
storage/myisam/ha_myisam.cc
storage/myisam/ha_myisam.cc
+6
-0
storage/myisam/ha_myisam.h
storage/myisam/ha_myisam.h
+1
-0
No files found.
BUILD/check-cpu
View file @
03793f4c
...
...
@@ -47,8 +47,13 @@ check_cpu () {
model_name
=
`
sysctl
-n
hw.model
`
;;
Darwin
)
cpu_family
=
`
uname
-p
`
model_name
=
`
machine
`
cpu_family
=
`
sysctl
-n
machdep.cpu.vendor
`
model_name
=
`
sysctl
-n
machdep.cpu.brand_string
`
if
[
-z
"
$cpu_family
"
-o
-z
"
$model_name
"
]
then
cpu_family
=
`
uname
-p
`
model_name
=
`
machine
`
fi
;;
*
)
cpu_family
=
`
uname
-m
`
;
...
...
mysql-test/include/mix1.inc
View file @
03793f4c
...
...
@@ -1498,43 +1498,12 @@ INSERT INTO t1 VALUES
(
4
,
1
,
3
,
'pk'
,
NULL
),(
5
,
1
,
3
,
'c2'
,
NULL
),
(
2
,
1
,
4
,
'c_extra'
,
NULL
),(
3
,
1
,
4
,
'c_extra'
,
NULL
);
EXPLAIN
SELECT
*
FROM
t1
WHERE
tid
=
1
AND
vid
=
3
ORDER
BY
idx
DESC
;
EXPLAIN
SELECT
*
FROM
t1
FORCE
INDEX
(
PRIMARY
)
WHERE
tid
=
1
AND
vid
=
3
ORDER
BY
idx
DESC
;
SELECT
*
FROM
t1
WHERE
tid
=
1
AND
vid
=
3
ORDER
BY
idx
DESC
;
SELECT
*
FROM
t1
FORCE
INDEX
(
PRIMARY
)
WHERE
tid
=
1
AND
vid
=
3
ORDER
BY
idx
DESC
;
DROP
TABLE
t1
;
#
# Bug#21704: Renaming column does not update FK definition.
#
#
# --disable_warnings
# DROP TABLE IF EXISTS t1;
# DROP TABLE IF EXISTS t2;
# --enable_warnings
#
# CREATE TABLE t1(id INT PRIMARY KEY)
# ENGINE=innodb;
#
# CREATE TABLE t2(
# t1_id INT PRIMARY KEY,
# CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
# ENGINE=innodb;
#
# --echo
#
# --disable_result_log
# --error ER_ERROR_ON_RENAME
# ALTER TABLE t1 CHANGE id id2 INT;
# --enable_result_log
#
# --echo
#
# DROP TABLE t2;
# DROP TABLE t1;
#
--
echo
#
--
echo
# Bug #44290: explain crashes for subquery with distinct in
--
echo
# SQL_SELECT::test_quick_select
...
...
mysql-test/include/mtr_warnings.sql
View file @
03793f4c
...
...
@@ -139,9 +139,9 @@ INSERT INTO global_suppressions VALUES
(
"Cannot find or open table test
\/
bug29807 from"
),
/* innodb foreign key tests that fail in ALTER or RENAME produce this */
(
"InnoDB: Error: in ALTER TABLE `test`.`t[12]`"
),
(
"InnoDB: Error: in ALTER TABLE `test`.`t[12
3
]`"
),
(
"InnoDB: Error: in RENAME TABLE table `test`.`t1`"
),
(
"InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal"
),
(
"InnoDB: Error: table `test`.`t[12
3
]` does not exist in the InnoDB internal"
),
/* Test case for Bug#14233 produces the following warnings: */
(
"Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"
),
...
...
mysql-test/lib/My/SafeProcess/safe_process.cc
View file @
03793f4c
...
...
@@ -89,7 +89,7 @@ static void die(const char* fmt, ...)
}
static
void
kill_child
(
void
)
static
void
kill_child
(
void
)
{
int
status
=
0
;
...
...
@@ -119,7 +119,7 @@ static void kill_child (void)
}
static
void
handle_abort
(
int
sig
)
extern
"C"
void
handle_abort
(
int
sig
)
{
message
(
"Got signal %d, child_pid: %d, sending ABRT"
,
sig
,
child_pid
);
...
...
@@ -128,8 +128,8 @@ static void handle_abort (int sig)
}
}
static
void
handle_signal
(
int
sig
)
extern
"C"
void
handle_signal
(
int
sig
)
{
message
(
"Got signal %d, child_pid: %d"
,
sig
,
child_pid
);
terminated
=
1
;
...
...
@@ -152,7 +152,7 @@ int main(int argc, char* const argv[] )
pid_t
own_pid
=
getpid
();
pid_t
parent_pid
=
getppid
();
bool
nocore
=
false
;
/* Install signal handlers */
signal
(
SIGTERM
,
handle_signal
);
signal
(
SIGINT
,
handle_signal
);
...
...
@@ -232,10 +232,11 @@ int main(int argc, char* const argv[] )
message
(
"setrlimit failed, errno=%d"
,
errno
);
}
}
// Signal that child is ready
buf
=
37
;
write
(
pfd
[
1
],
&
buf
,
1
);
if
((
write
(
pfd
[
1
],
&
buf
,
1
))
<
1
)
die
(
"Failed to signal that child is ready"
);
// Close write end
close
(
pfd
[
1
]);
...
...
@@ -246,8 +247,10 @@ int main(int argc, char* const argv[] )
close
(
pfd
[
1
]);
// Close unused write end
// Wait for child to signal it's ready
read
(
pfd
[
0
],
&
buf
,
1
);
if
(
buf
!=
37
)
if
((
read
(
pfd
[
0
],
&
buf
,
1
))
<
1
)
die
(
"Failed to read signal from child"
);
if
(
buf
!=
37
)
die
(
"Didn't get 37 from pipe"
);
close
(
pfd
[
0
]);
// Close read end
...
...
@@ -272,7 +275,7 @@ int main(int argc, char* const argv[] )
if
(
WIFEXITED
(
status
))
{
// Process has exited, collect return status
int
ret_code
=
WEXITSTATUS
(
status
);
ret_code
=
WEXITSTATUS
(
status
);
message
(
"Child exit: %d"
,
ret_code
);
// Exit with exit status of the child
exit
(
ret_code
);
...
...
@@ -287,6 +290,6 @@ int main(int argc, char* const argv[] )
}
kill_child
();
exit
(
1
)
;
return
1
;
}
mysql-test/r/bug46080.result
0 → 100644
View file @
03793f4c
#
# Bug #46080: group_concat(... order by) crashes server when
# sort_buffer_size cannot allocate
#
CREATE TABLE t1(a CHAR(255));
INSERT INTO t1 VALUES ('a');
SET @@SESSION.sort_buffer_size=5*16*1000000;
SET @@SESSION.max_heap_table_size=5*1000000;
# Must not crash.
SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a;
Got one of the listed errors
DROP TABLE t1;
SET @@SESSION.sort_buffer_size=default;
SET @@SESSION.max_heap_table_size=default;
End of 5.0 tests
mysql-test/r/innodb_bug21704.result
0 → 100644
View file @
03793f4c
#
# Bug#21704: Renaming column does not update FK definition.
#
# Test that it's not possible to rename columns participating in a
# foreign key (either in the referencing or referenced table).
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
ROW_FORMAT=COMPACT ENGINE=INNODB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT,
CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a))
ROW_FORMAT=COMPACT ENGINE=INNODB;
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
# Test renaming the column in the referenced table.
ALTER TABLE t1 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t1 CHANGE b c INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
# Test renaming the column in the referencing table
ALTER TABLE t2 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t2 CHANGE b c INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
# Test with self-referential constraints
ALTER TABLE t3 CHANGE a d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
ALTER TABLE t3 CHANGE b d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t3 CHANGE c d INT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
# Cleanup.
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
mysql-test/r/innodb_bug42101-nonzero.result
View file @
03793f4c
...
...
@@ -11,11 +11,15 @@ set global innodb_commit_concurrency=42;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
42
set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
1
set global innodb_commit_concurrency=0;
ERROR HY000: Incorrect arguments to SET
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
42
1
set global innodb_commit_concurrency=1;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
...
...
mysql-test/r/innodb_bug42101.result
View file @
03793f4c
...
...
@@ -16,3 +16,7 @@ set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
0
set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
0
mysql-test/r/innodb_mysql.result
View file @
03793f4c
...
...
@@ -1701,10 +1701,10 @@ INSERT INTO t1 VALUES
(4,1,2,'c2',NULL),(5,1,2,'c1',NULL),(2,1,3,'c2',NULL),(3,1,3,'c2',NULL),
(4,1,3,'pk',NULL),(5,1,3,'c2',NULL),
(2,1,4,'c_extra',NULL),(3,1,4,'c_extra',NULL);
EXPLAIN SELECT * FROM t1 WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
EXPLAIN SELECT * FROM t1
FORCE INDEX (PRIMARY)
WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index
vid
PRIMARY 12 NULL 16 Using where
SELECT * FROM t1 WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
1 SIMPLE t1 index
NULL
PRIMARY 12 NULL 16 Using where
SELECT * FROM t1
FORCE INDEX (PRIMARY)
WHERE tid = 1 AND vid = 3 ORDER BY idx DESC;
vid tid idx name type
3 1 4 c_extra NULL
3 1 3 c2 NULL
...
...
@@ -2137,4 +2137,75 @@ GROUP BY t1.b;
a b c d a b e a b
1 1 1 0 1 1 2 1 1
DROP TABLE t1, t2, t3;
#
# Bug #45828: Optimizer won't use partial primary key if another
# index can prevent filesort
#
CREATE TABLE `t1` (
c1 int NOT NULL,
c2 int NOT NULL,
c3 int NOT NULL,
PRIMARY KEY (c1,c2),
KEY (c3)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (5,2,1246276747);
INSERT INTO t1 VALUES (2,1,1246281721);
INSERT INTO t1 VALUES (7,3,1246281756);
INSERT INTO t1 VALUES (4,2,1246282139);
INSERT INTO t1 VALUES (3,1,1246282230);
INSERT INTO t1 VALUES (1,0,1246282712);
INSERT INTO t1 VALUES (8,3,1246282765);
INSERT INTO t1 SELECT c1+10,c2+10,c3+10 FROM t1;
INSERT INTO t1 SELECT c1+100,c2+100,c3+100 from t1;
INSERT INTO t1 SELECT c1+1000,c2+1000,c3+1000 from t1;
INSERT INTO t1 SELECT c1+10000,c2+10000,c3+10000 from t1;
INSERT INTO t1 SELECT c1+100000,c2+100000,c3+100000 from t1;
INSERT INTO t1 SELECT c1+1000000,c2+1000000,c3+1000000 from t1;
SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
c1 c2 c3
EXPLAIN SELECT * FROM t1 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref PRIMARY,c3 PRIMARY 4 const 1 Using where; Using filesort
EXPLAIN SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref PRIMARY PRIMARY 4 const 1 Using where; Using filesort
CREATE TABLE t2 (
c1 int NOT NULL,
c2 int NOT NULL,
c3 int NOT NULL,
KEY (c1,c2),
KEY (c3)
) ENGINE=InnoDB;
explain SELECT * FROM t2 WHERE c1 = 99999999 AND c3 > 1 ORDER BY c3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c1,c3 c1 4 const 1 Using where; Using filesort
DROP TABLE t1,t2;
#
# 36259: Optimizing with ORDER BY
#
CREATE TABLE t1 (
a INT NOT NULL AUTO_INCREMENT,
b INT NOT NULL,
c INT NOT NULL,
d VARCHAR(5),
e INT NOT NULL,
PRIMARY KEY (a), KEY i2 (b,c,d)
) ENGINE=InnoDB;
INSERT INTO t1 (b,c,d,e) VALUES (1,1,'a',1), (2,2,'b',2);
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
INSERT INTO t1 (b,c,d,e) SELECT RAND()*10000, RAND()*10000, d, e FROM t1;
EXPLAIN SELECT * FROM t1 WHERE b=1 AND c=1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref i2 i2 8 const,const 1 Using where; Using filesort
EXPLAIN SELECT * FROM t1 FORCE INDEX(i2) WHERE b=1 and c=1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref i2 i2 8 const,const 1 Using where; Using filesort
EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using where
DROP TABLE t1;
End of 5.1 tests
mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_45983.result
0 → 100644
View file @
03793f4c
set ibmdb2i_create_index_option=1;
drop schema if exists test1;
create schema test1;
use test1;
CREATE TABLE t1 (f int primary key, index(f)) engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (f char(10) collate utf8_bin primary key, index(f)) engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, index(f)) engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (f char(10) collate latin1_swedish_ci primary key, i int, index i(i,f)) engine=ibmdb2i;
drop table t1;
create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
select * from fd;
SQSSEQ
*HEX
*HEX
*HEX
*HEX
drop table fd;
mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_45983.test
0 → 100644
View file @
03793f4c
source
suite
/
ibmdb2i
/
include
/
have_ibmdb2i
.
inc
;
# Confirm that ibmdb2i_create_index_option causes additional *HEX sorted indexes to be created for all non-binary keys.
set
ibmdb2i_create_index_option
=
1
;
--
disable_warnings
drop
schema
if
exists
test1
;
create
schema
test1
;
use
test1
;
--
enable_warnings
--
disable_abort_on_error
--
error
0
,
255
exec
system
"DLTF QGPL/FDOUT"
>
/
dev
/
null
;
--
enable_abort_on_error
#No additional index because no string fields in key
CREATE
TABLE
t1
(
f
int
primary
key
,
index
(
f
))
engine
=
ibmdb2i
;
--
error
255
exec
system
"DSPFD FILE(
\"
test1
\"
/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)"
>
/
dev
/
null
;
--
error
255
exec
system
"DSPFD FILE(
\"
test1
\"
/
\"
f___H_t1
\"
) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)"
>
/
dev
/
null
;
drop
table
t1
;
#No additional index because binary sorting
CREATE
TABLE
t1
(
f
char
(
10
)
collate
utf8_bin
primary
key
,
index
(
f
))
engine
=
ibmdb2i
;
--
error
255
exec
system
"DSPFD FILE(
\"
test1
\"
/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)"
>
/
dev
/
null
;
--
error
255
exec
system
"DSPFD FILE(
\"
test1
\"
/
\"
f___H_t1
\"
) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)"
>
/
dev
/
null
;
drop
table
t1
;
CREATE
TABLE
t1
(
f
char
(
10
)
collate
latin1_swedish_ci
primary
key
,
index
(
f
))
engine
=
ibmdb2i
;
exec
system
"DSPFD FILE(
\"
test1
\"
/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)"
>
/
dev
/
null
;
exec
system
"DSPFD FILE(
\"
test1
\"
/
\"
f___H_t1
\"
) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)"
>
/
dev
/
null
;
drop
table
t1
;
CREATE
TABLE
t1
(
f
char
(
10
)
collate
latin1_swedish_ci
primary
key
,
i
int
,
index
i
(
i
,
f
))
engine
=
ibmdb2i
;
exec
system
"DSPFD FILE(
\"
test1
\"
/PRIM0001) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)"
>
/
dev
/
null
;
exec
system
"DSPFD FILE(
\"
test1
\"
/
\"
i___H_t1
\"
) TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)"
>
/
dev
/
null
;
drop
table
t1
;
create
table
fd
(
SQSSEQ
CHAR
(
10
))
engine
=
ibmdb2i
;
system
system
"CPYF FROMFILE(QGPL/FDOUT) TOFILE(
\"
test1
\"
/
\"
fd
\"
) mbropt(*replace) fmtopt(*drop *map)"
>
/
dev
/
null
;
select
*
from
fd
;
drop
table
fd
;
mysql-test/suite/parts/r/partition_auto_increment_memory.result
View file @
03793f4c
...
...
@@ -381,12 +381,12 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=MEMORY AUTO_INCREMENT=2
8
DEFAULT CHARSET=latin1
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
SELECT * FROM t1 ORDER BY c1;
c1
27
1
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
...
...
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
View file @
03793f4c
...
...
@@ -381,12 +381,12 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=2
8
DEFAULT CHARSET=latin1
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
SELECT * FROM t1 ORDER BY c1;
c1
27
1
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
...
...
mysql-test/t/bug46080-master.opt
0 → 100644
View file @
03793f4c
--skip-grant-tables --skip-name-resolve --safemalloc-mem-limit=4000000
mysql-test/t/bug46080.test
0 → 100644
View file @
03793f4c
--
echo
#
--
echo
# Bug #46080: group_concat(... order by) crashes server when
--
echo
# sort_buffer_size cannot allocate
--
echo
#
CREATE
TABLE
t1
(
a
CHAR
(
255
));
INSERT
INTO
t1
VALUES
(
'a'
);
SET
@@
SESSION
.
sort_buffer_size
=
5
*
16
*
1000000
;
SET
@@
SESSION
.
max_heap_table_size
=
5
*
1000000
;
--
echo
# Must not crash.
--
error
5
,
0
SELECT
GROUP_CONCAT
(
a
ORDER
BY
a
)
FROM
t1
GROUP
BY
a
;
DROP
TABLE
t1
;
SET
@@
SESSION
.
sort_buffer_size
=
default
;
SET
@@
SESSION
.
max_heap_table_size
=
default
;
--
echo
End
of
5.0
tests
mysql-test/t/innodb_bug21704.test
0 → 100644
View file @
03793f4c
--
source
include
/
have_innodb
.
inc
--
echo
#
--
echo
# Bug#21704: Renaming column does not update FK definition.
--
echo
#
--
echo
--
echo
# Test that it's not possible to rename columns participating in a
--
echo
# foreign key (either in the referencing or referenced table).
--
echo
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
DROP
TABLE
IF
EXISTS
t2
;
DROP
TABLE
IF
EXISTS
t3
;
--
enable_warnings
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
,
b
INT
)
ROW_FORMAT
=
COMPACT
ENGINE
=
INNODB
;
CREATE
TABLE
t2
(
a
INT
PRIMARY
KEY
,
b
INT
,
CONSTRAINT
fk1
FOREIGN
KEY
(
a
)
REFERENCES
t1
(
a
))
ROW_FORMAT
=
COMPACT
ENGINE
=
INNODB
;
CREATE
TABLE
t3
(
a
INT
PRIMARY
KEY
,
b
INT
,
KEY
(
b
),
C
INT
,
CONSTRAINT
fk2
FOREIGN
KEY
(
b
)
REFERENCES
t3
(
a
))
ROW_FORMAT
=
COMPACT
ENGINE
=
INNODB
;
INSERT
INTO
t1
VALUES
(
1
,
1
),(
2
,
2
),(
3
,
3
);
INSERT
INTO
t2
VALUES
(
1
,
1
),(
2
,
2
),(
3
,
3
);
INSERT
INTO
t3
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
3
,
3
,
3
);
--
echo
--
echo
# Test renaming the column in the referenced table.
--
echo
# mysqltest first does replace_regex, then replace_result
--
replace_regex
/
'[^'
]
*
test
\
/
#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--
replace_result
$MYSQLTEST_VARDIR
.
mysqld
.
1
/
data
/
''
--
error
ER_ERROR_ON_RENAME
ALTER
TABLE
t1
CHANGE
a
c
INT
;
--
echo
# Ensure that online column rename works.
--
enable_info
ALTER
TABLE
t1
CHANGE
b
c
INT
;
--
disable_info
--
echo
--
echo
# Test renaming the column in the referencing table
--
echo
# mysqltest first does replace_regex, then replace_result
--
replace_regex
/
'[^'
]
*
test
\
/
#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--
replace_result
$MYSQLTEST_VARDIR
.
mysqld
.
1
/
data
/
''
--
error
ER_ERROR_ON_RENAME
ALTER
TABLE
t2
CHANGE
a
c
INT
;
--
echo
# Ensure that online column rename works.
--
enable_info
ALTER
TABLE
t2
CHANGE
b
c
INT
;
--
disable_info
--
echo
--
echo
# Test with self-referential constraints
--
echo
# mysqltest first does replace_regex, then replace_result
--
replace_regex
/
'[^'
]
*
test
\
/
#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--
replace_result
$MYSQLTEST_VARDIR
.
mysqld
.
1
/
data
/
''
--
error
ER_ERROR_ON_RENAME
ALTER
TABLE
t3
CHANGE
a
d
INT
;
# mysqltest first does replace_regex, then replace_result
--
replace_regex
/
'[^'
]
*
test
\
/
#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--
replace_result
$MYSQLTEST_VARDIR
.
mysqld
.
1
/
data
/
''
--
error
ER_ERROR_ON_RENAME
ALTER
TABLE
t3
CHANGE
b
d
INT
;
--
echo
# Ensure that online column rename works.
--
enable_info
ALTER
TABLE
t3
CHANGE
c
d
INT
;
--
disable_info
--
echo
--
echo
# Cleanup.
--
echo
DROP
TABLE
t3
;
DROP
TABLE
t2
;
DROP
TABLE
t1
;
mysql-test/t/innodb_bug42101-nonzero.test
View file @
03793f4c
...
...
@@ -12,6 +12,8 @@ set global innodb_commit_concurrency=1;
select
@@
innodb_commit_concurrency
;
set
global
innodb_commit_concurrency
=
42
;
select
@@
innodb_commit_concurrency
;
set
global
innodb_commit_concurrency
=
DEFAULT
;
select
@@
innodb_commit_concurrency
;
--
error
ER_WRONG_ARGUMENTS
set
global
innodb_commit_concurrency
=
0
;
select
@@
innodb_commit_concurrency
;
...
...
mysql-test/t/innodb_bug42101.test
View file @
03793f4c
...
...
@@ -15,3 +15,5 @@ set global innodb_commit_concurrency=42;
select
@@
innodb_commit_concurrency
;
set
global
innodb_commit_concurrency
=
0
;
select
@@
innodb_commit_concurrency
;
set
global
innodb_commit_concurrency
=
DEFAULT
;
select
@@
innodb_commit_concurrency
;
mysql-test/t/innodb_mysql.test
View file @
03793f4c
...
...
@@ -380,4 +380,85 @@ SELECT * FROM t1, t2, t3
DROP TABLE t1, t2, t3;
--echo #
--echo # Bug #45828: Optimizer won'
t
use
partial
primary key if another
--echo # index can prevent filesort
--echo #
# Create the table
CREATE TABLE `t1` (
c1 int NOT NULL,
c2 int NOT NULL,
c3 int NOT NULL,
PRIMARY KEY (c1,c2),
KEY (c3)
) ENGINE=InnoDB
;
# populate with data
INSERT
INTO
t1
VALUES
(
5
,
2
,
1246276747
);
INSERT
INTO
t1
VALUES
(
2
,
1
,
1246281721
);
INSERT
INTO
t1
VALUES
(
7
,
3
,
1246281756
);
INSERT
INTO
t1
VALUES
(
4
,
2
,
1246282139
);
INSERT
INTO
t1
VALUES
(
3
,
1
,
1246282230
);
INSERT
INTO
t1
VALUES
(
1
,
0
,
1246282712
);
INSERT
INTO
t1
VALUES
(
8
,
3
,
1246282765
);
INSERT
INTO
t1
SELECT
c1
+
10
,
c2
+
10
,
c3
+
10
FROM
t1
;
INSERT
INTO
t1
SELECT
c1
+
100
,
c2
+
100
,
c3
+
100
from
t1
;
INSERT
INTO
t1
SELECT
c1
+
1000
,
c2
+
1000
,
c3
+
1000
from
t1
;
INSERT
INTO
t1
SELECT
c1
+
10000
,
c2
+
10000
,
c3
+
10000
from
t1
;
INSERT
INTO
t1
SELECT
c1
+
100000
,
c2
+
100000
,
c3
+
100000
from
t1
;
INSERT
INTO
t1
SELECT
c1
+
1000000
,
c2
+
1000000
,
c3
+
1000000
from
t1
;
# query and no rows will match the c1 condition, whereas all will match c3
SELECT
*
FROM
t1
WHERE
c1
=
99999999
AND
c3
>
1
ORDER
BY
c3
;
# SHOULD use the pk.
# index on c3 will be used instead of primary key
EXPLAIN
SELECT
*
FROM
t1
WHERE
c1
=
99999999
AND
c3
>
1
ORDER
BY
c3
;
# if we force the primary key, we can see the estimate is 1
EXPLAIN
SELECT
*
FROM
t1
FORCE
INDEX
(
PRIMARY
)
WHERE
c1
=
99999999
AND
c3
>
1
ORDER
BY
c3
;
CREATE
TABLE
t2
(
c1
int
NOT
NULL
,
c2
int
NOT
NULL
,
c3
int
NOT
NULL
,
KEY
(
c1
,
c2
),
KEY
(
c3
)
)
ENGINE
=
InnoDB
;
# SHOULD use the pk.
# if we switch it from a primary key to a regular index, it works correctly as well
explain
SELECT
*
FROM
t2
WHERE
c1
=
99999999
AND
c3
>
1
ORDER
BY
c3
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# 36259: Optimizing with ORDER BY
--
echo
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
AUTO_INCREMENT
,
b
INT
NOT
NULL
,
c
INT
NOT
NULL
,
d
VARCHAR
(
5
),
e
INT
NOT
NULL
,
PRIMARY
KEY
(
a
),
KEY
i2
(
b
,
c
,
d
)
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
(
b
,
c
,
d
,
e
)
VALUES
(
1
,
1
,
'a'
,
1
),
(
2
,
2
,
'b'
,
2
);
INSERT
INTO
t1
(
b
,
c
,
d
,
e
)
SELECT
RAND
()
*
10000
,
RAND
()
*
10000
,
d
,
e
FROM
t1
;
INSERT
INTO
t1
(
b
,
c
,
d
,
e
)
SELECT
RAND
()
*
10000
,
RAND
()
*
10000
,
d
,
e
FROM
t1
;
INSERT
INTO
t1
(
b
,
c
,
d
,
e
)
SELECT
RAND
()
*
10000
,
RAND
()
*
10000
,
d
,
e
FROM
t1
;
INSERT
INTO
t1
(
b
,
c
,
d
,
e
)
SELECT
RAND
()
*
10000
,
RAND
()
*
10000
,
d
,
e
FROM
t1
;
INSERT
INTO
t1
(
b
,
c
,
d
,
e
)
SELECT
RAND
()
*
10000
,
RAND
()
*
10000
,
d
,
e
FROM
t1
;
INSERT
INTO
t1
(
b
,
c
,
d
,
e
)
SELECT
RAND
()
*
10000
,
RAND
()
*
10000
,
d
,
e
FROM
t1
;
EXPLAIN
SELECT
*
FROM
t1
WHERE
b
=
1
AND
c
=
1
ORDER
BY
a
;
EXPLAIN
SELECT
*
FROM
t1
FORCE
INDEX
(
i2
)
WHERE
b
=
1
and
c
=
1
ORDER
BY
a
;
EXPLAIN
SELECT
*
FROM
t1
FORCE
INDEX
(
PRIMARY
)
WHERE
b
=
1
AND
c
=
1
ORDER
BY
a
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
sql/ha_partition.cc
View file @
03793f4c
...
...
@@ -3179,6 +3179,7 @@ int ha_partition::delete_row(const uchar *buf)
int
ha_partition
::
delete_all_rows
()
{
int
error
;
bool
truncate
=
FALSE
;
handler
**
file
;
THD
*
thd
=
ha_thd
();
DBUG_ENTER
(
"ha_partition::delete_all_rows"
);
...
...
@@ -3190,12 +3191,16 @@ int ha_partition::delete_all_rows()
ha_data
->
next_auto_inc_val
=
0
;
ha_data
->
auto_inc_initialized
=
FALSE
;
unlock_auto_increment
();
truncate
=
TRUE
;
}
file
=
m_file
;
do
{
if
((
error
=
(
*
file
)
->
ha_delete_all_rows
()))
DBUG_RETURN
(
error
);
/* Ignore the error */
if
(
truncate
)
(
void
)
(
*
file
)
->
ha_reset_auto_increment
(
0
);
}
while
(
*
(
++
file
));
DBUG_RETURN
(
0
);
}
...
...
sql/item_sum.cc
View file @
03793f4c
...
...
@@ -3327,8 +3327,13 @@ bool Item_func_group_concat::add()
TREE_ELEMENT
*
el
=
0
;
// Only for safety
if
(
row_eligible
&&
tree
)
{
el
=
tree_insert
(
tree
,
table
->
record
[
0
]
+
table
->
s
->
null_bytes
,
0
,
tree
->
custom_arg
);
/* check if there was enough memory to insert the row */
if
(
!
el
)
return
1
;
}
/*
If the row is not a duplicate (el->count == 1)
we can dump the row here in case of GROUP_CONCAT(DISTINCT...)
...
...
sql/rpl_rli.cc
View file @
03793f4c
...
...
@@ -947,6 +947,7 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
if
(
count_relay_log_space
(
rli
))
{
*
errmsg
=
"Error counting relay log space"
;
error
=
1
;
goto
err
;
}
if
(
!
just_reset
)
...
...
sql/sql_select.cc
View file @
03793f4c
...
...
@@ -13132,9 +13132,17 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
for
(
nr
=
0
;
nr
<
table
->
s
->
keys
;
nr
++
)
{
int
direction
;
if
(
keys
.
is_set
(
nr
)
&&
(
direction
=
test_if_order_by_key
(
order
,
table
,
nr
,
&
used_key_parts
)))
{
/*
At this point we are sure that ref_key is a non-ordering
key (where "ordering key" is a key that will return rows
in the order required by ORDER BY).
*/
DBUG_ASSERT
(
ref_key
!=
(
int
)
nr
);
bool
is_covering
=
table
->
covering_keys
.
is_set
(
nr
)
||
(
nr
==
table
->
s
->
primary_key
&&
table
->
file
->
primary_key_is_clustered
());
...
...
@@ -13215,7 +13223,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/
index_scan_time
=
select_limit
/
rec_per_key
*
min
(
rec_per_key
,
table
->
file
->
scan_time
());
if
(
is_covering
||
if
(
(
ref_key
<
0
&&
is_covering
)
||
(
ref_key
<
0
&&
(
group
||
table
->
force_index
))
||
index_scan_time
<
read_time
)
{
...
...
storage/heap/ha_heap.cc
View file @
03793f4c
...
...
@@ -419,6 +419,14 @@ int ha_heap::delete_all_rows()
return
0
;
}
int
ha_heap
::
reset_auto_increment
(
ulonglong
value
)
{
file
->
s
->
auto_increment
=
value
;
return
0
;
}
int
ha_heap
::
external_lock
(
THD
*
thd
,
int
lock_type
)
{
return
0
;
// No external locking
...
...
storage/heap/ha_heap.h
View file @
03793f4c
...
...
@@ -98,6 +98,7 @@ public:
int
reset
();
int
external_lock
(
THD
*
thd
,
int
lock_type
);
int
delete_all_rows
(
void
);
int
reset_auto_increment
(
ulonglong
value
);
int
disable_indexes
(
uint
mode
);
int
enable_indexes
(
uint
mode
);
int
indexes_are_disabled
(
void
);
...
...
storage/ibmdb2i/ha_ibmdb2i.cc
View file @
03793f4c
...
...
@@ -2230,34 +2230,19 @@ int ha_ibmdb2i::create(const char *name, TABLE *table_arg,
}
}
bool
primaryHasStringField
=
false
;
String
fieldDefinition
(
128
)
;
if
(
table_arg
->
s
->
primary_key
!=
MAX_KEY
&&
!
isTemporary
)
{
KEY
&
curKey
=
table_arg
->
key_info
[
table_arg
->
s
->
primary_key
];
query
.
append
(
STRING_WITH_LEN
(
", PRIMARY KEY( "
));
for
(
int
j
=
0
;
j
<
curKey
.
key_parts
;
++
j
)
{
if
(
j
!=
0
)
{
query
.
append
(
STRING_WITH_LEN
(
" , "
)
);
}
Field
*
field
=
curKey
.
key_part
[
j
].
field
;
convertMySQLNameToDB2Name
(
field
->
field_name
,
colName
,
sizeof
(
colName
));
query
.
append
(
colName
);
enum_field_types
type
=
field
->
real_type
();
if
(
type
==
MYSQL_TYPE_VARCHAR
||
type
==
MYSQL_TYPE_BLOB
||
type
==
MYSQL_TYPE_STRING
)
{
rc
=
updateAssociatedSortSequence
(
field
->
charset
(),
&
fileSortSequenceType
,
fileSortSequence
,
fileSortSequenceLibrary
);
if
(
rc
)
DBUG_RETURN
(
rc
);
primaryHasStringField
=
true
;
}
}
query
.
append
(
STRING_WITH_LEN
(
" ) "
));
query
.
append
(
STRING_WITH_LEN
(
", PRIMARY KEY "
));
rc
=
buildIndexFieldList
(
fieldDefinition
,
table_arg
->
key_info
[
table_arg
->
s
->
primary_key
],
true
,
&
fileSortSequenceType
,
fileSortSequence
,
fileSortSequenceLibrary
);
if
(
rc
)
DBUG_RETURN
(
rc
);
query
.
append
(
fieldDefinition
);
}
rc
=
buildDB2ConstraintString
(
thd
->
lex
,
...
...
@@ -2283,6 +2268,19 @@ int ha_ibmdb2i::create(const char *name, TABLE *table_arg,
SqlStatementStream
sqlStream
(
query
.
length
());
sqlStream
.
addStatement
(
query
,
fileSortSequence
,
fileSortSequenceLibrary
);
if
(
table_arg
->
s
->
primary_key
!=
MAX_KEY
&&
!
isTemporary
&&
(
THDVAR
(
thd
,
create_index_option
)
==
1
)
&&
(
fileSortSequenceType
!=
'B'
)
&&
(
fileSortSequenceType
!=
' '
))
{
rc
=
generateShadowIndex
(
sqlStream
,
table_arg
->
key_info
[
table_arg
->
s
->
primary_key
],
libName
,
fileName
,
fieldDefinition
);
if
(
rc
)
DBUG_RETURN
(
rc
);
}
for
(
uint
i
=
0
;
i
<
table_arg
->
s
->
keys
;
++
i
)
{
if
(
i
!=
table_arg
->
s
->
primary_key
||
isTemporary
)
...
...
@@ -3012,61 +3010,126 @@ int32 ha_ibmdb2i::buildCreateIndexStatement(SqlStatementStream& sqlStream,
}
String
fieldDefinition
(
128
);
fieldDefinition
.
length
(
0
);
fieldDefinition
.
append
(
STRING_WITH_LEN
(
" ( "
));
rc
=
buildIndexFieldList
(
fieldDefinition
,
key
,
isPrimary
,
&
fileSortSequenceType
,
fileSortSequence
,
fileSortSequenceLibrary
);
if
(
rc
)
DBUG_RETURN
(
rc
);
query
.
append
(
fieldDefinition
);
if
((
THDVAR
(
ha_thd
(),
create_index_option
)
==
1
)
&&
(
fileSortSequenceType
!=
'B'
)
&&
(
fileSortSequenceType
!=
' '
))
{
rc
=
generateShadowIndex
(
sqlStream
,
key
,
db2LibName
,
db2FileName
,
fieldDefinition
);
if
(
rc
)
DBUG_RETURN
(
rc
);
}
DBUG_PRINT
(
"ha_ibmdb2i::buildCreateIndexStatement"
,
(
"Sent to DB2: %s"
,
query
.
c_ptr_safe
()));
sqlStream
.
addStatement
(
query
,
fileSortSequence
,
fileSortSequenceLibrary
);
DBUG_RETURN
(
0
);
}
/**
Generate the SQL syntax for the list of fields to be assigned to the
specified key. The corresponding sort sequence is also calculated.
@param[out] appendHere The string to receive the generated SQL
@param key The key to evaluate
@param isPrimary True if this is being generated on behalf of the primary key
@param[out] fileSortSequenceType The type of the associated sort sequence
@param[out] fileSortSequence The name of the associated sort sequence
@param[out] fileSortSequenceLibrary The library of the associated sort sequence
@return 0 if successful; error value otherwise
*/
int32
ha_ibmdb2i
::
buildIndexFieldList
(
String
&
appendHere
,
const
KEY
&
key
,
bool
isPrimary
,
char
*
fileSortSequenceType
,
char
*
fileSortSequence
,
char
*
fileSortSequenceLibrary
)
{
DBUG_ENTER
(
"ha_ibmdb2i::buildIndexFieldList"
);
appendHere
.
append
(
STRING_WITH_LEN
(
" ( "
));
for
(
int
j
=
0
;
j
<
key
.
key_parts
;
++
j
)
{
char
colName
[
MAX_DB2_COLNAME_LENGTH
+
1
];
if
(
j
!=
0
)
{
fieldDefinition
.
append
(
STRING_WITH_LEN
(
" , "
));
appendHere
.
append
(
STRING_WITH_LEN
(
" , "
));
}
Field
*
field
=
key
.
key_part
[
j
].
field
;
convertMySQLNameToDB2Name
(
field
->
field_name
,
colName
,
sizeof
(
colName
));
fieldDefinition
.
append
(
colName
);
KEY_PART_INFO
&
kpi
=
key
.
key_part
[
j
];
Field
*
field
=
kpi
.
field
;
convertMySQLNameToDB2Name
(
field
->
field_name
,
colName
,
sizeof
(
colName
));
appendHere
.
append
(
colName
);
int32
rc
;
rc
=
updateAssociatedSortSequence
(
field
->
charset
(),
&
fileSortSequenceType
,
fileSortSequenceType
,
fileSortSequence
,
fileSortSequenceLibrary
);
if
(
rc
)
DBUG_RETURN
(
rc
);
}
fieldDefinition
.
append
(
STRING_WITH_LEN
(
" ) "
));
query
.
append
(
fieldDefinition
);
if
((
THDVAR
(
ha_thd
(),
create_index_option
)
==
1
)
&&
(
fileSortSequenceType
!=
'B'
))
{
String
shadowQuery
(
256
);
shadowQuery
.
length
(
0
);
shadowQuery
.
append
(
STRING_WITH_LEN
(
"CREATE INDEX "
));
shadowQuery
.
append
(
db2LibName
);
shadowQuery
.
append
(
'.'
);
if
(
db2i_table
::
appendQualifiedIndexFileName
(
key
.
name
,
db2FileName
,
shadowQuery
,
db2i_table
::
ASCII_SQL
,
typeHex
))
{
getErrTxt
(
DB2I_ERR_INVALID_NAME
,
"index"
,
"*generated*"
);
DBUG_RETURN
(
DB2I_ERR_INVALID_NAME
);
}
shadowQuery
.
append
(
STRING_WITH_LEN
(
" ON "
));
shadowQuery
.
append
(
db2LibName
);
shadowQuery
.
append
(
'.'
);
shadowQuery
.
append
(
db2FileName
);
shadowQuery
.
append
(
fieldDefinition
);
DBUG_PRINT
(
"ha_ibmdb2i::buildCreateIndexStatement"
,
(
"Sent to DB2: %s"
,
shadowQuery
.
c_ptr_safe
()));
sqlStream
.
addStatement
(
shadowQuery
,
"*HEX"
,
"QSYS"
);
}
DBUG_PRINT
(
"ha_ibmdb2i::buildCreateIndexStatement"
,
(
"Sent to DB2: %s"
,
query
.
c_ptr_safe
()));
sqlStream
.
addStatement
(
query
,
fileSortSequence
,
fileSortSequenceLibrary
);
appendHere
.
append
(
STRING_WITH_LEN
(
" ) "
));
DBUG_RETURN
(
0
);
}
/**
Generate an SQL statement that defines a *HEX sorted index to implement
the ibmdb2i_create_index.
@param[out] stream The stream to append the generated statement to
@param key The key to evaluate
@param[out] libName The library containg the table
@param[out] fileName The DB2-compatible name of the table
@param[out] fieldDefinition The list of the fields in the index, in SQL syntax
@return 0 if successful; error value otherwise
*/
int32
ha_ibmdb2i
::
generateShadowIndex
(
SqlStatementStream
&
stream
,
const
KEY
&
key
,
const
char
*
libName
,
const
char
*
fileName
,
const
String
&
fieldDefinition
)
{
String
shadowQuery
(
256
);
shadowQuery
.
length
(
0
);
shadowQuery
.
append
(
STRING_WITH_LEN
(
"CREATE INDEX "
));
shadowQuery
.
append
(
libName
);
shadowQuery
.
append
(
'.'
);
if
(
db2i_table
::
appendQualifiedIndexFileName
(
key
.
name
,
fileName
,
shadowQuery
,
db2i_table
::
ASCII_SQL
,
typeHex
))
{
getErrTxt
(
DB2I_ERR_INVALID_NAME
,
"index"
,
"*generated*"
);
return
DB2I_ERR_INVALID_NAME
;
}
shadowQuery
.
append
(
STRING_WITH_LEN
(
" ON "
));
shadowQuery
.
append
(
libName
);
shadowQuery
.
append
(
'.'
);
shadowQuery
.
append
(
fileName
);
shadowQuery
.
append
(
fieldDefinition
);
DBUG_PRINT
(
"ha_ibmdb2i::generateShadowIndex"
,
(
"Sent to DB2: %s"
,
shadowQuery
.
c_ptr_safe
()));
stream
.
addStatement
(
shadowQuery
,
"*HEX"
,
"QSYS"
);
return
0
;
}
void
ha_ibmdb2i
::
doInitialRead
(
char
orientation
,
uint32
rowsToBuffer
,
ILEMemHandle
key
,
...
...
storage/ibmdb2i/ha_ibmdb2i.h
View file @
03793f4c
...
...
@@ -530,6 +530,13 @@ private:
bool
isPrimary
,
const
char
*
db2LibName
,
const
char
*
db2FileName
);
int32
buildIndexFieldList
(
String
&
appendHere
,
const
KEY
&
key
,
bool
isPrimary
,
char
*
fileSortSequenceType
,
char
*
fileSortSequence
,
char
*
fileSortSequenceLibrary
);
// Specify NULL for data when using the data pointed to by field
int32
convertMySQLtoDB2
(
Field
*
field
,
const
DB2Field
&
db2Field
,
char
*
db2Buf
,
const
uchar
*
data
=
NULL
);
...
...
@@ -806,4 +813,10 @@ private:
query
.
append
(
STRING_WITH_LEN
(
" RCDFMT "
));
query
.
append
(
rcdfmt
);
}
int32
generateShadowIndex
(
SqlStatementStream
&
stream
,
const
KEY
&
key
,
const
char
*
libName
,
const
char
*
fileName
,
const
String
&
fieldDefinition
);
};
storage/innobase/Makefile.am
View file @
03793f4c
...
...
@@ -57,7 +57,7 @@ noinst_HEADERS= include/btr0btr.h include/btr0btr.ic \
include/ha0ha.ic include/hash0hash.h
\
include/hash0hash.ic include/ibuf0ibuf.h
\
include/ibuf0ibuf.ic include/ibuf0types.h
\
include/lock0iter.h
include/fsp0types.h
\
include/lock0iter.h
\
include/lock0lock.h include/lock0lock.ic
\
include/lock0priv.h include/lock0priv.ic
\
include/lock0types.h include/log0log.h
\
...
...
storage/innobase/fil/fil0fil.c
View file @
03793f4c
...
...
@@ -2745,7 +2745,7 @@ fil_open_single_table_tablespace(
"InnoDB: and MySQL removed the .ibd file for this.
\n
"
"InnoDB: Please refer to
\n
"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
"innodb-troubleshooting.html
\n
"
"innodb-troubleshooting
-datadict
.html
\n
"
"InnoDB: for how to resolve the issue.
\n
"
,
stderr
);
mem_free
(
filepath
);
...
...
@@ -2786,7 +2786,7 @@ fil_open_single_table_tablespace(
" IMPORT TABLESPACE?
\n
"
"InnoDB: Please refer to
\n
"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
"innodb-troubleshooting.html
\n
"
"innodb-troubleshooting
-datadict
.html
\n
"
"InnoDB: for how to resolve the issue.
\n
"
,
(
ulong
)
space_id
,
(
ulong
)
id
);
...
...
@@ -3477,7 +3477,7 @@ fil_space_for_table_exists_in_mem(
error_exit:
fputs
(
"InnoDB: Please refer to
\n
"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
"innodb-troubleshooting.html
\n
"
"innodb-troubleshooting
-datadict
.html
\n
"
"InnoDB: for how to resolve the issue.
\n
"
,
stderr
);
mem_free
(
path
);
...
...
storage/innobase/handler/ha_innodb.cc
View file @
03793f4c
...
...
@@ -166,6 +166,20 @@ static handler *innobase_create_handler(handlerton *hton,
static
const
char
innobase_hton_name
[]
=
"InnoDB"
;
/** @brief Initialize the default value of innodb_commit_concurrency.
Once InnoDB is running, the innodb_commit_concurrency must not change
from zero to nonzero. (Bug #42101)
The initial default value is 0, and without this extra initialization,
SET GLOBAL innodb_commit_concurrency=DEFAULT would set the parameter
to 0, even if it was initially set to nonzero at the command line
or configuration file. */
static
void
innobase_commit_concurrency_init_default
(
void
);
/*==========================================*/
/*****************************************************************
Check for a valid value of innobase_commit_concurrency. */
static
...
...
@@ -1775,6 +1789,8 @@ innobase_init(
(
char
*
)
"latin1_swedish_ci"
));
memcpy
(
srv_latin1_ordering
,
my_charset_latin1
.
sort_order
,
256
);
innobase_commit_concurrency_init_default
();
/* Since we in this module access directly the fields of a trx
struct, and due to different headers and flags it might happen that
mutex_t has a different size in this module and in InnoDB
...
...
@@ -8161,6 +8177,97 @@ innobase_set_cursor_view(
}
/***********************************************************************
Check whether any of the given columns is being renamed in the table. */
static
bool
column_is_being_renamed
(
/*====================*/
/* out: true if any of col_names is
being renamed in table */
TABLE
*
table
,
/* in: MySQL table */
uint
n_cols
,
/* in: number of columns */
const
char
**
col_names
)
/* in: names of the columns */
{
uint
j
;
uint
k
;
Field
*
field
;
const
char
*
col_name
;
for
(
j
=
0
;
j
<
n_cols
;
j
++
)
{
col_name
=
col_names
[
j
];
for
(
k
=
0
;
k
<
table
->
s
->
fields
;
k
++
)
{
field
=
table
->
field
[
k
];
if
((
field
->
flags
&
FIELD_IS_RENAMED
)
&&
innobase_strcasecmp
(
field
->
field_name
,
col_name
)
==
0
)
{
return
(
true
);
}
}
}
return
(
false
);
}
/***********************************************************************
Check whether a column in table "table" is being renamed and if this column
is part of a foreign key, either part of another table, referencing this
table or part of this table, referencing another table. */
static
bool
foreign_key_column_is_being_renamed
(
/*================================*/
/* out: true if a column that
participates in a foreign key definition
is being renamed */
row_prebuilt_t
*
prebuilt
,
/* in: InnoDB prebuilt struct */
TABLE
*
table
)
/* in: MySQL table */
{
dict_foreign_t
*
foreign
;
/* check whether there are foreign keys at all */
if
(
UT_LIST_GET_LEN
(
prebuilt
->
table
->
foreign_list
)
==
0
&&
UT_LIST_GET_LEN
(
prebuilt
->
table
->
referenced_list
)
==
0
)
{
/* no foreign keys involved with prebuilt->table */
return
(
false
);
}
row_mysql_lock_data_dictionary
(
prebuilt
->
trx
);
/* Check whether any column in the foreign key constraints which refer
to this table is being renamed. */
for
(
foreign
=
UT_LIST_GET_FIRST
(
prebuilt
->
table
->
referenced_list
);
foreign
!=
NULL
;
foreign
=
UT_LIST_GET_NEXT
(
referenced_list
,
foreign
))
{
if
(
column_is_being_renamed
(
table
,
foreign
->
n_fields
,
foreign
->
referenced_col_names
))
{
row_mysql_unlock_data_dictionary
(
prebuilt
->
trx
);
return
(
true
);
}
}
/* Check whether any column in the foreign key constraints in the
table is being renamed. */
for
(
foreign
=
UT_LIST_GET_FIRST
(
prebuilt
->
table
->
foreign_list
);
foreign
!=
NULL
;
foreign
=
UT_LIST_GET_NEXT
(
foreign_list
,
foreign
))
{
if
(
column_is_being_renamed
(
table
,
foreign
->
n_fields
,
foreign
->
foreign_col_names
))
{
row_mysql_unlock_data_dictionary
(
prebuilt
->
trx
);
return
(
true
);
}
}
row_mysql_unlock_data_dictionary
(
prebuilt
->
trx
);
return
(
false
);
}
bool
ha_innobase
::
check_if_incompatible_data
(
HA_CREATE_INFO
*
info
,
uint
table_changes
)
...
...
@@ -8177,6 +8284,13 @@ bool ha_innobase::check_if_incompatible_data(
return
COMPATIBLE_DATA_NO
;
}
/* Check if a column participating in a foreign key is being renamed.
There is no mechanism for updating InnoDB foreign key definitions. */
if
(
foreign_key_column_is_being_renamed
(
prebuilt
,
table
))
{
return
COMPATIBLE_DATA_NO
;
}
/* Check that row format didn't change */
if
((
info
->
used_fields
&
HA_CREATE_USED_ROW_FORMAT
)
&&
get_row_type
()
!=
info
->
row_type
)
{
...
...
@@ -8464,3 +8578,21 @@ mysql_declare_plugin(innobase)
NULL
/* reserved */
}
mysql_declare_plugin_end
;
/** @brief Initialize the default value of innodb_commit_concurrency.
Once InnoDB is running, the innodb_commit_concurrency must not change
from zero to nonzero. (Bug #42101)
The initial default value is 0, and without this extra initialization,
SET GLOBAL innodb_commit_concurrency=DEFAULT would set the parameter
to 0, even if it was initially set to nonzero at the command line
or configuration file. */
static
void
innobase_commit_concurrency_init_default
(
void
)
/*==========================================*/
{
MYSQL_SYSVAR_NAME
(
commit_concurrency
).
def_val
=
innobase_commit_concurrency
;
}
storage/innobase/include/trx0sys.ic
View file @
03793f4c
...
...
@@ -9,6 +9,7 @@ Created 3/26/1996 Heikki Tuuri
#include "srv0srv.h"
#include "trx0trx.h"
#include "data0type.h"
#include "mtr0log.h"
/* The typedef for rseg slot in the file copy */
typedef byte trx_sysf_rseg_t;
...
...
storage/innobase/trx/trx0purge.c
View file @
03793f4c
...
...
@@ -14,6 +14,7 @@ Created 3/26/1996 Heikki Tuuri
#include "fsp0fsp.h"
#include "mach0data.h"
#include "mtr0log.h"
#include "trx0rseg.h"
#include "trx0trx.h"
#include "trx0roll.h"
...
...
storage/innobase/trx/trx0sys.c
View file @
03793f4c
...
...
@@ -13,7 +13,7 @@ Created 3/26/1996 Heikki Tuuri
#endif
#include "fsp0fsp.h"
#include "mtr0
mtr
.h"
#include "mtr0
log
.h"
#include "trx0trx.h"
#include "trx0rseg.h"
#include "trx0undo.h"
...
...
storage/innobase/trx/trx0undo.c
View file @
03793f4c
...
...
@@ -14,6 +14,7 @@ Created 3/26/1996 Heikki Tuuri
#include "fsp0fsp.h"
#include "mach0data.h"
#include "mtr0log.h"
#include "trx0rseg.h"
#include "trx0trx.h"
#include "srv0srv.h"
...
...
storage/myisam/ha_myisam.cc
View file @
03793f4c
...
...
@@ -1870,6 +1870,12 @@ int ha_myisam::delete_all_rows()
return
mi_delete_all_rows
(
file
);
}
int
ha_myisam
::
reset_auto_increment
(
ulonglong
value
)
{
file
->
s
->
state
.
auto_increment
=
value
;
return
0
;
}
int
ha_myisam
::
delete_table
(
const
char
*
name
)
{
return
mi_delete_table
(
name
);
...
...
storage/myisam/ha_myisam.h
View file @
03793f4c
...
...
@@ -101,6 +101,7 @@ class ha_myisam: public handler
int
reset
(
void
);
int
external_lock
(
THD
*
thd
,
int
lock_type
);
int
delete_all_rows
(
void
);
int
reset_auto_increment
(
ulonglong
value
);
int
disable_indexes
(
uint
mode
);
int
enable_indexes
(
uint
mode
);
int
indexes_are_disabled
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment