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
cc9ab7d0
Commit
cc9ab7d0
authored
Oct 02, 2006
by
dlenev@mockturtle.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into mockturtle.local:/home/dlenev/src/mysql-5.1-rt-merge
parents
08686291
9ace1cc4
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
449 additions
and
54 deletions
+449
-54
mysql-test/r/delayed.result
mysql-test/r/delayed.result
+174
-0
mysql-test/r/merge.result
mysql-test/r/merge.result
+19
-4
mysql-test/t/delayed.test
mysql-test/t/delayed.test
+142
-6
mysql-test/t/merge.test
mysql-test/t/merge.test
+26
-0
mysys/queues.c
mysys/queues.c
+19
-29
sql/share/errmsg.txt
sql/share/errmsg.txt
+1
-1
sql/sql_insert.cc
sql/sql_insert.cc
+46
-1
sql/sql_plugin.cc
sql/sql_plugin.cc
+10
-8
storage/myisam/mi_delete.c
storage/myisam/mi_delete.c
+1
-1
storage/myisam/myisam_ftdump.c
storage/myisam/myisam_ftdump.c
+1
-2
storage/myisammrg/myrg_open.c
storage/myisammrg/myrg_open.c
+8
-2
storage/myisammrg/myrg_queue.c
storage/myisammrg/myrg_queue.c
+2
-0
No files found.
mysql-test/r/delayed.result
View file @
cc9ab7d0
...
...
@@ -7,6 +7,7 @@ insert delayed into t1 set a = 4;
insert delayed into t1 set a = 5, tmsp = 19711006010203;
insert delayed into t1 (a, tmsp) values (6, 19711006010203);
insert delayed into t1 (a, tmsp) values (7, NULL);
FLUSH TABLE t1;
insert into t1 set a = 8,tmsp=19711006010203;
select * from t1 where tmsp=0;
a tmsp
...
...
@@ -22,6 +23,7 @@ insert delayed into t1 values (null,"c");
insert delayed into t1 values (3,"d"),(null,"e");
insert delayed into t1 values (3,"this will give an","error");
ERROR 21S01: Column count doesn't match value count at row 1
FLUSH TABLE t1;
show status like 'not_flushed_delayed_rows';
Variable_name Value
Not_flushed_delayed_rows 0
...
...
@@ -54,6 +56,7 @@ insert delayed into t1 values(null);
insert delayed into t1 values(null);
insert delayed into t1 values(null);
insert delayed into t1 values(null);
FLUSH TABLE t1;
select * from t1 order by a;
a
1
...
...
@@ -69,3 +72,174 @@ a
12
13
DROP TABLE t1;
SET @bug20627_old_auto_increment_offset=
@@auto_increment_offset= 2;
SET @bug20627_old_auto_increment_increment=
@@auto_increment_increment= 3;
SET @bug20627_old_session_auto_increment_offset=
@@session.auto_increment_offset= 4;
SET @bug20627_old_session_auto_increment_increment=
@@session.auto_increment_increment= 5;
SET @@auto_increment_offset= 2;
SET @@auto_increment_increment= 3;
SET @@session.auto_increment_offset= 4;
SET @@session.auto_increment_increment= 5;
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (c1)
);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
SELECT * FROM t1;
c1
4
9
14
DROP TABLE t1;
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (c1)
);
INSERT DELAYED INTO t1 VALUES (NULL),(NULL),(NULL);
FLUSH TABLE t1;
SELECT * FROM t1;
c1
4
9
14
DROP TABLE t1;
SET @@auto_increment_offset=
@bug20627_old_auto_increment_offset;
SET @@auto_increment_increment=
@bug20627_old_auto_increment_increment;
SET @@session.auto_increment_offset=
@bug20627_old_session_auto_increment_offset;
SET @@session.auto_increment_increment=
@bug20627_old_session_auto_increment_increment;
SET @bug20830_old_auto_increment_offset=
@@auto_increment_offset= 2;
SET @bug20830_old_auto_increment_increment=
@@auto_increment_increment= 3;
SET @bug20830_old_session_auto_increment_offset=
@@session.auto_increment_offset= 4;
SET @bug20830_old_session_auto_increment_increment=
@@session.auto_increment_increment= 5;
SET @@auto_increment_offset= 2;
SET @@auto_increment_increment= 3;
SET @@session.auto_increment_offset= 4;
SET @@session.auto_increment_increment= 5;
CREATE TABLE t1 (
c1 INT(11) NOT NULL AUTO_INCREMENT,
c2 INT(11) DEFAULT NULL,
PRIMARY KEY (c1)
);
SET insert_id= 14;
INSERT INTO t1 VALUES(NULL, 11), (NULL, 12), (NULL, 13);
INSERT INTO t1 VALUES(NULL, 21), (NULL, 22), (NULL, 23);
INSERT INTO t1 VALUES( 69, 31), (NULL, 32), (NULL, 33);
INSERT INTO t1 VALUES(NULL, 41), (NULL, 42), (NULL, 43);
SET insert_id= 114;
INSERT INTO t1 VALUES(NULL, 51), (NULL, 52), (NULL, 53);
INSERT INTO t1 VALUES(NULL, 61), (NULL, 62), (NULL, 63);
INSERT INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
INSERT INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
SET insert_id= 114;
INSERT INTO t1 VALUES(NULL, 91);
ERROR 23000: Duplicate entry '114' for key 'PRIMARY'
INSERT INTO t1 VALUES (NULL, 92), (NULL, 93);
SELECT * FROM t1;
c1 c2
14 11
19 12
24 13
29 21
34 22
39 23
69 31
74 32
79 33
84 41
89 42
94 43
114 51
119 52
124 53
129 61
134 62
139 63
49 71
144 72
149 73
154 81
159 82
164 83
169 92
174 93
SELECT COUNT(*) FROM t1;
COUNT(*)
26
SELECT SUM(c1) FROM t1;
SUM(c1)
2569
DROP TABLE t1;
CREATE TABLE t1 (
c1 INT(11) NOT NULL AUTO_INCREMENT,
c2 INT(11) DEFAULT NULL,
PRIMARY KEY (c1)
);
SET insert_id= 14;
INSERT DELAYED INTO t1 VALUES(NULL, 11), (NULL, 12), (NULL, 13);
INSERT DELAYED INTO t1 VALUES(NULL, 21), (NULL, 22), (NULL, 23);
INSERT DELAYED INTO t1 VALUES( 69, 31), (NULL, 32), (NULL, 33);
INSERT DELAYED INTO t1 VALUES(NULL, 41), (NULL, 42), (NULL, 43);
SET insert_id= 114;
INSERT DELAYED INTO t1 VALUES(NULL, 51), (NULL, 52), (NULL, 53);
INSERT DELAYED INTO t1 VALUES(NULL, 61), (NULL, 62), (NULL, 63);
INSERT DELAYED INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
INSERT DELAYED INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
SET insert_id= 114;
INSERT DELAYED INTO t1 VALUES(NULL, 91);
INSERT DELAYED INTO t1 VALUES (NULL, 92), (NULL, 93);
FLUSH TABLE t1;
SELECT * FROM t1;
c1 c2
14 11
19 12
24 13
29 21
34 22
39 23
69 31
74 32
79 33
84 41
89 42
94 43
114 51
119 52
124 53
129 61
134 62
139 63
49 71
144 72
149 73
154 81
159 82
164 83
169 92
174 93
SELECT COUNT(*) FROM t1;
COUNT(*)
26
SELECT SUM(c1) FROM t1;
SUM(c1)
2569
DROP TABLE t1;
SET @@auto_increment_offset=
@bug20830_old_auto_increment_offset;
SET @@auto_increment_increment=
@bug20830_old_auto_increment_increment;
SET @@session.auto_increment_offset=
@bug20830_old_session_auto_increment_offset;
SET @@session.auto_increment_increment=
@bug20830_old_session_auto_increment_increment;
mysql-test/r/merge.result
View file @
cc9ab7d0
...
...
@@ -178,12 +178,12 @@ t3 CREATE TABLE `t3` (
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2);
select * from t4;
ERROR HY000:
All tables in the MERGE table are not identically defined
ERROR HY000:
Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists
alter table t4 add column c int;
ERROR HY000:
All tables in the MERGE table are not identically defined
ERROR HY000:
Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists
flush tables;
select * from t4;
ERROR HY000:
All tables in the MERGE table are not identically defined
ERROR HY000:
Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists
create database mysqltest;
create table mysqltest.t6 (a int not null primary key auto_increment, message char(20));
create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,mysqltest.t6);
...
...
@@ -277,7 +277,7 @@ t3 CREATE TABLE `t3` (
drop table t3,t2,t1;
create table t1 (a int not null, key(a)) engine=merge;
select * from t1;
a
ERROR HY000: Got error 124 from storage engine
drop table t1;
create table t1 (a int not null, b int not null, key(a,b));
create table t2 (a int not null, b int not null, key(a,b));
...
...
@@ -771,6 +771,21 @@ Table Op Msg_type Msg_text
test.t1 check status OK
test.t2 check status OK
drop table t1, t2, t3;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(2),(1);
CREATE TABLE t2(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM t2 WHERE a=2;
ERROR HY000: Got error 124 from storage engine
DROP TABLE t1, t2;
CREATE TABLE t1(a INT) ENGINE=MEMORY;
CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM t2;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists
DROP TABLE t1, t2;
CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
SELECT * FROM t2;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists
DROP TABLE t2;
create table t1 (b bit(1));
create table t2 (b bit(1));
create table tm (b bit(1)) engine = merge union = (t1,t2);
...
...
mysql-test/t/delayed.test
View file @
cc9ab7d0
...
...
@@ -17,7 +17,8 @@ insert delayed into t1 set a = 4;
insert
delayed
into
t1
set
a
=
5
,
tmsp
=
19711006010203
;
insert
delayed
into
t1
(
a
,
tmsp
)
values
(
6
,
19711006010203
);
insert
delayed
into
t1
(
a
,
tmsp
)
values
(
7
,
NULL
);
--
sleep
2
# Wait until the rows are flushed to the table files.
FLUSH
TABLE
t1
;
insert
into
t1
set
a
=
8
,
tmsp
=
19711006010203
;
select
*
from
t1
where
tmsp
=
0
;
select
*
from
t1
where
tmsp
=
19711006010203
;
...
...
@@ -34,8 +35,8 @@ insert delayed into t1 values (null,"c");
insert
delayed
into
t1
values
(
3
,
"d"
),(
null
,
"e"
);
--
error
1136
insert
delayed
into
t1
values
(
3
,
"this will give an"
,
"error"
);
#
2 was not enough for --ps-protocol
--
sleep
4
#
Wait until the rows are flushed to the table files.
FLUSH
TABLE
t1
;
show
status
like
'not_flushed_delayed_rows'
;
select
*
from
t1
;
drop
table
t1
;
...
...
@@ -92,10 +93,145 @@ insert delayed into t1 values(null);
# Works, since the delayed-counter is 8, which is unused
insert
delayed
into
t1
values
(
null
);
# Wait until the rows are flushed to the table files.
FLUSH
TABLE
t1
;
# Check what we have now
# must wait so that the delayed thread finishes
# Note: this must be increased if the test fails
--
sleep
1
select
*
from
t1
order
by
a
;
DROP
TABLE
t1
;
#
# Bug#20627 - INSERT DELAYED does not honour auto_increment_* variables
#
SET
@
bug20627_old_auto_increment_offset
=
@@
auto_increment_offset
=
2
;
SET
@
bug20627_old_auto_increment_increment
=
@@
auto_increment_increment
=
3
;
SET
@
bug20627_old_session_auto_increment_offset
=
@@
session
.
auto_increment_offset
=
4
;
SET
@
bug20627_old_session_auto_increment_increment
=
@@
session
.
auto_increment_increment
=
5
;
SET
@@
auto_increment_offset
=
2
;
SET
@@
auto_increment_increment
=
3
;
SET
@@
session
.
auto_increment_offset
=
4
;
SET
@@
session
.
auto_increment_increment
=
5
;
#
# Normal insert as reference.
CREATE
TABLE
t1
(
c1
INT
NOT
NULL
AUTO_INCREMENT
,
PRIMARY
KEY
(
c1
)
);
INSERT
INTO
t1
VALUES
(
NULL
),(
NULL
),(
NULL
);
# Check what we have now
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
#
# Delayed insert.
CREATE
TABLE
t1
(
c1
INT
NOT
NULL
AUTO_INCREMENT
,
PRIMARY
KEY
(
c1
)
);
INSERT
DELAYED
INTO
t1
VALUES
(
NULL
),(
NULL
),(
NULL
);
# Wait until the rows are flushed to the table files.
FLUSH
TABLE
t1
;
# Check what we have now
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
#
# Cleanup
SET
@@
auto_increment_offset
=
@
bug20627_old_auto_increment_offset
;
SET
@@
auto_increment_increment
=
@
bug20627_old_auto_increment_increment
;
SET
@@
session
.
auto_increment_offset
=
@
bug20627_old_session_auto_increment_offset
;
SET
@@
session
.
auto_increment_increment
=
@
bug20627_old_session_auto_increment_increment
;
#
# Bug#20830 - INSERT DELAYED does not honour SET INSERT_ID
#
SET
@
bug20830_old_auto_increment_offset
=
@@
auto_increment_offset
=
2
;
SET
@
bug20830_old_auto_increment_increment
=
@@
auto_increment_increment
=
3
;
SET
@
bug20830_old_session_auto_increment_offset
=
@@
session
.
auto_increment_offset
=
4
;
SET
@
bug20830_old_session_auto_increment_increment
=
@@
session
.
auto_increment_increment
=
5
;
SET
@@
auto_increment_offset
=
2
;
SET
@@
auto_increment_increment
=
3
;
SET
@@
session
.
auto_increment_offset
=
4
;
SET
@@
session
.
auto_increment_increment
=
5
;
#
# Normal insert as reference.
CREATE
TABLE
t1
(
c1
INT
(
11
)
NOT
NULL
AUTO_INCREMENT
,
c2
INT
(
11
)
DEFAULT
NULL
,
PRIMARY
KEY
(
c1
)
);
SET
insert_id
=
14
;
INSERT
INTO
t1
VALUES
(
NULL
,
11
),
(
NULL
,
12
),
(
NULL
,
13
);
INSERT
INTO
t1
VALUES
(
NULL
,
21
),
(
NULL
,
22
),
(
NULL
,
23
);
# Restart sequence at a different value.
INSERT
INTO
t1
VALUES
(
69
,
31
),
(
NULL
,
32
),
(
NULL
,
33
);
INSERT
INTO
t1
VALUES
(
NULL
,
41
),
(
NULL
,
42
),
(
NULL
,
43
);
# Restart sequence at a different value.
SET
insert_id
=
114
;
INSERT
INTO
t1
VALUES
(
NULL
,
51
),
(
NULL
,
52
),
(
NULL
,
53
);
INSERT
INTO
t1
VALUES
(
NULL
,
61
),
(
NULL
,
62
),
(
NULL
,
63
);
# Set one value below the maximum value.
INSERT
INTO
t1
VALUES
(
49
,
71
),
(
NULL
,
72
),
(
NULL
,
73
);
INSERT
INTO
t1
VALUES
(
NULL
,
81
),
(
NULL
,
82
),
(
NULL
,
83
);
# Create a duplicate value.
SET
insert_id
=
114
;
--
error
1062
INSERT
INTO
t1
VALUES
(
NULL
,
91
);
INSERT
INTO
t1
VALUES
(
NULL
,
92
),
(
NULL
,
93
);
# Check what we have now
SELECT
*
FROM
t1
;
SELECT
COUNT
(
*
)
FROM
t1
;
SELECT
SUM
(
c1
)
FROM
t1
;
DROP
TABLE
t1
;
#
# Delayed insert.
CREATE
TABLE
t1
(
c1
INT
(
11
)
NOT
NULL
AUTO_INCREMENT
,
c2
INT
(
11
)
DEFAULT
NULL
,
PRIMARY
KEY
(
c1
)
);
SET
insert_id
=
14
;
INSERT
DELAYED
INTO
t1
VALUES
(
NULL
,
11
),
(
NULL
,
12
),
(
NULL
,
13
);
INSERT
DELAYED
INTO
t1
VALUES
(
NULL
,
21
),
(
NULL
,
22
),
(
NULL
,
23
);
# Restart sequence at a different value.
INSERT
DELAYED
INTO
t1
VALUES
(
69
,
31
),
(
NULL
,
32
),
(
NULL
,
33
);
INSERT
DELAYED
INTO
t1
VALUES
(
NULL
,
41
),
(
NULL
,
42
),
(
NULL
,
43
);
# Restart sequence at a different value.
SET
insert_id
=
114
;
INSERT
DELAYED
INTO
t1
VALUES
(
NULL
,
51
),
(
NULL
,
52
),
(
NULL
,
53
);
INSERT
DELAYED
INTO
t1
VALUES
(
NULL
,
61
),
(
NULL
,
62
),
(
NULL
,
63
);
# Set one value below the maximum value.
INSERT
DELAYED
INTO
t1
VALUES
(
49
,
71
),
(
NULL
,
72
),
(
NULL
,
73
);
INSERT
DELAYED
INTO
t1
VALUES
(
NULL
,
81
),
(
NULL
,
82
),
(
NULL
,
83
);
# Create a duplicate value.
SET
insert_id
=
114
;
INSERT
DELAYED
INTO
t1
VALUES
(
NULL
,
91
);
INSERT
DELAYED
INTO
t1
VALUES
(
NULL
,
92
),
(
NULL
,
93
);
# Wait until the rows are flushed to the table files.
FLUSH
TABLE
t1
;
# Check what we have now
SELECT
*
FROM
t1
;
SELECT
COUNT
(
*
)
FROM
t1
;
SELECT
SUM
(
c1
)
FROM
t1
;
DROP
TABLE
t1
;
#
# Cleanup
SET
@@
auto_increment_offset
=
@
bug20830_old_auto_increment_offset
;
SET
@@
auto_increment_increment
=
@
bug20830_old_auto_increment_increment
;
SET
@@
session
.
auto_increment_offset
=
@
bug20830_old_session_auto_increment_offset
;
SET
@@
session
.
auto_increment_increment
=
@
bug20830_old_session_auto_increment_increment
;
mysql-test/t/merge.test
View file @
cc9ab7d0
...
...
@@ -124,6 +124,7 @@ drop table t3,t2,t1;
# Test table without unions
#
create
table
t1
(
a
int
not
null
,
key
(
a
))
engine
=
merge
;
--
error
1030
select
*
from
t1
;
drop
table
t1
;
...
...
@@ -381,6 +382,31 @@ select * from t3;
check
table
t1
,
t2
;
drop
table
t1
,
t2
,
t3
;
#
# BUG#21617 - crash when selecting from merge table with inconsistent
# indexes
#
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
2
),(
1
);
CREATE
TABLE
t2
(
a
INT
,
KEY
(
a
))
ENGINE
=
MERGE
UNION
=
(
t1
);
--
error
1030
SELECT
*
FROM
t2
WHERE
a
=
2
;
DROP
TABLE
t1
,
t2
;
#
# BUG#10974 - No error message if merge table based on union of innodb,
# memory
#
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
MEMORY
;
CREATE
TABLE
t2
(
a
INT
)
ENGINE
=
MERGE
UNION
=
(
t1
);
--
error
1168
SELECT
*
FROM
t2
;
DROP
TABLE
t1
,
t2
;
CREATE
TABLE
t2
(
a
INT
)
ENGINE
=
MERGE
UNION
=
(
t3
);
--
error
1168
SELECT
*
FROM
t2
;
DROP
TABLE
t2
;
# End of 4.1 tests
#
...
...
mysys/queues.c
View file @
cc9ab7d0
...
...
@@ -208,28 +208,22 @@ void delete_queue(QUEUE *queue)
void
queue_insert
(
register
QUEUE
*
queue
,
byte
*
element
)
{
reg2
uint
idx
,
next
;
reg2
uint
idx
,
next
;
int
cmp
;
#ifndef DBUG_OFF
if
(
queue
->
elements
<
queue
->
max_elements
)
#endif
DBUG_ASSERT
(
queue
->
elements
<
queue
->
max_elements
);
queue
->
root
[
0
]
=
element
;
idx
=
++
queue
->
elements
;
/* max_at_top swaps the comparison if we want to order by desc */
while
((
cmp
=
queue
->
compare
(
queue
->
first_cmp_arg
,
element
+
queue
->
offset_to_key
,
queue
->
root
[(
next
=
idx
>>
1
)]
+
queue
->
offset_to_key
))
&&
(
cmp
^
queue
->
max_at_top
)
<
0
)
{
queue
->
root
[
0
]
=
element
;
idx
=
++
queue
->
elements
;
/* max_at_top swaps the comparison if we want to order by desc */
while
((
cmp
=
queue
->
compare
(
queue
->
first_cmp_arg
,
element
+
queue
->
offset_to_key
,
queue
->
root
[(
next
=
idx
>>
1
)]
+
queue
->
offset_to_key
))
&&
(
cmp
^
queue
->
max_at_top
)
<
0
)
{
queue
->
root
[
idx
]
=
queue
->
root
[
next
];
idx
=
next
;
}
queue
->
root
[
idx
]
=
element
;
queue
->
root
[
idx
]
=
queue
->
root
[
next
];
idx
=
next
;
}
queue
->
root
[
idx
]
=
element
;
}
/*
...
...
@@ -262,16 +256,12 @@ int queue_insert_safe(register QUEUE *queue, byte *element)
byte
*
queue_remove
(
register
QUEUE
*
queue
,
uint
idx
)
{
#ifndef DBUG_OFF
if
(
idx
>=
queue
->
max_elements
)
return
0
;
#endif
{
byte
*
element
=
queue
->
root
[
++
idx
];
/* Intern index starts from 1 */
queue
->
root
[
idx
]
=
queue
->
root
[
queue
->
elements
--
];
_downheap
(
queue
,
idx
);
return
element
;
}
byte
*
element
;
DBUG_ASSERT
(
idx
<
queue
->
max_elements
);
element
=
queue
->
root
[
++
idx
];
/* Intern index starts from 1 */
queue
->
root
[
idx
]
=
queue
->
root
[
queue
->
elements
--
];
_downheap
(
queue
,
idx
);
return
element
;
}
/* Fix when element on top has been replaced */
...
...
sql/share/errmsg.txt
View file @
cc9ab7d0
...
...
@@ -3791,7 +3791,7 @@ ER_WRONG_MRG_TABLE
cze "V-Bechny tabulky v MERGE tabulce nejsou definovny stejn"
dan "Tabellerne i MERGE er ikke defineret ens"
nla "Niet alle tabellen in de MERGE tabel hebben identieke gedefinities"
eng "
All tables in the MERGE table are not identically defined
"
eng "
Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists
"
est "Kik tabelid MERGE tabeli mratluses ei ole identsed"
fre "Toutes les tables de la table de type MERGE n'ont pas la mme dfinition"
ger "Nicht alle Tabellen in der MERGE-Tabelle sind gleich definiert"
...
...
sql/sql_insert.cc
View file @
cc9ab7d0
...
...
@@ -1334,13 +1334,16 @@ public:
bool
query_start_used
,
ignore
,
log_query
;
bool
stmt_depends_on_first_successful_insert_id_in_prev_stmt
;
ulonglong
first_successful_insert_id_in_prev_stmt
;
ulonglong
forced_insert_id
;
ulong
auto_increment_increment
;
ulong
auto_increment_offset
;
timestamp_auto_set_type
timestamp_field_type
;
LEX_STRING
query
;
delayed_row
(
LEX_STRING
const
query_arg
,
enum_duplicates
dup_arg
,
bool
ignore_arg
,
bool
log_query_arg
)
:
record
(
0
),
dup
(
dup_arg
),
ignore
(
ignore_arg
),
log_query
(
log_query_arg
),
query
(
query_arg
)
forced_insert_id
(
0
),
query
(
query_arg
)
{}
~
delayed_row
()
{
...
...
@@ -1698,6 +1701,7 @@ write_delayed(THD *thd,TABLE *table, enum_duplicates duplic,
{
delayed_row
*
row
;
delayed_insert
*
di
=
thd
->
di
;
const
Discrete_interval
*
forced_auto_inc
;
DBUG_ENTER
(
"write_delayed"
);
DBUG_PRINT
(
"enter"
,
(
"query = '%s' length %u"
,
query
.
str
,
query
.
length
));
...
...
@@ -1747,6 +1751,17 @@ write_delayed(THD *thd,TABLE *table, enum_duplicates duplic,
thd
->
first_successful_insert_id_in_prev_stmt
;
row
->
timestamp_field_type
=
table
->
timestamp_field_type
;
/* Copy session variables. */
row
->
auto_increment_increment
=
thd
->
variables
.
auto_increment_increment
;
row
->
auto_increment_offset
=
thd
->
variables
.
auto_increment_offset
;
/* Copy the next forced auto increment value, if any. */
if
((
forced_auto_inc
=
thd
->
auto_inc_intervals_forced
.
get_next
()))
{
row
->
forced_insert_id
=
forced_auto_inc
->
minimum
();
DBUG_PRINT
(
"delayed"
,
(
"transmitting auto_inc: %lu"
,
(
ulong
)
row
->
forced_insert_id
));
}
di
->
rows
.
push_back
(
row
);
di
->
stacked_inserts
++
;
di
->
status
=
1
;
...
...
@@ -1998,6 +2013,10 @@ pthread_handler_t handle_delayed_insert(void *arg)
MYSQL_LOCK
*
lock
=
thd
->
lock
;
thd
->
lock
=
0
;
pthread_mutex_unlock
(
&
di
->
mutex
);
/*
We need to release next_insert_id before unlocking. This is
enforced by handler::ha_external_lock().
*/
di
->
table
->
file
->
ha_release_auto_increment
();
mysql_unlock_tables
(
thd
,
lock
);
di
->
group_count
=
0
;
...
...
@@ -2123,8 +2142,18 @@ bool delayed_insert::handle_inserts(void)
use values from the previous interval (of the previous rows).
*/
bool
log_query
=
(
row
->
log_query
&&
row
->
query
.
str
!=
NULL
);
DBUG_PRINT
(
"delayed"
,
(
"query: '%s' length: %u"
,
row
->
query
.
str
?
row
->
query
.
str
:
"[NULL]"
,
row
->
query
.
length
));
if
(
log_query
)
{
/*
This is the first value of an INSERT statement.
It is the right place to clear a forced insert_id.
This is usually done after the last value of an INSERT statement,
but we won't know this in the insert delayed thread. But before
the first value is sufficiently equivalent to after the last
value of the previous statement.
*/
table
->
file
->
ha_release_auto_increment
();
thd
.
auto_inc_intervals_in_cur_stmt_for_binlog
.
empty
();
}
...
...
@@ -2134,6 +2163,17 @@ bool delayed_insert::handle_inserts(void)
row
->
stmt_depends_on_first_successful_insert_id_in_prev_stmt
;
table
->
timestamp_field_type
=
row
->
timestamp_field_type
;
/* Copy the session variables. */
thd
.
variables
.
auto_increment_increment
=
row
->
auto_increment_increment
;
thd
.
variables
.
auto_increment_offset
=
row
->
auto_increment_offset
;
/* Copy a forced insert_id, if any. */
if
(
row
->
forced_insert_id
)
{
DBUG_PRINT
(
"delayed"
,
(
"received auto_inc: %lu"
,
(
ulong
)
row
->
forced_insert_id
));
thd
.
force_one_auto_inc_interval
(
row
->
forced_insert_id
);
}
info
.
ignore
=
row
->
ignore
;
info
.
handle_duplicates
=
row
->
dup
;
if
(
info
.
ignore
||
...
...
@@ -2211,6 +2251,7 @@ bool delayed_insert::handle_inserts(void)
/* This should never happen */
table
->
file
->
print_error
(
error
,
MYF
(
0
));
sql_print_error
(
"%s"
,
thd
.
net
.
last_error
);
DBUG_PRINT
(
"error"
,
(
"HA_EXTRA_NO_CACHE failed in loop"
));
goto
err
;
}
query_cache_invalidate3
(
&
thd
,
table
,
1
);
...
...
@@ -2253,6 +2294,7 @@ bool delayed_insert::handle_inserts(void)
{
// This shouldn't happen
table
->
file
->
print_error
(
error
,
MYF
(
0
));
sql_print_error
(
"%s"
,
thd
.
net
.
last_error
);
DBUG_PRINT
(
"error"
,
(
"HA_EXTRA_NO_CACHE failed after loop"
));
goto
err
;
}
query_cache_invalidate3
(
&
thd
,
table
,
1
);
...
...
@@ -2260,13 +2302,16 @@ bool delayed_insert::handle_inserts(void)
DBUG_RETURN
(
0
);
err:
DBUG_EXECUTE
(
"error"
,
max_rows
=
0
;);
/* Remove all not used rows */
while
((
row
=
rows
.
get
()))
{
delete
row
;
thread_safe_increment
(
delayed_insert_errors
,
&
LOCK_delayed_status
);
stacked_inserts
--
;
DBUG_EXECUTE
(
"error"
,
max_rows
++
;);
}
DBUG_PRINT
(
"error"
,
(
"dropped %lu rows after an error"
,
max_rows
));
thread_safe_increment
(
delayed_insert_errors
,
&
LOCK_delayed_status
);
pthread_mutex_lock
(
&
mutex
);
DBUG_RETURN
(
1
);
...
...
sql/sql_plugin.cc
View file @
cc9ab7d0
...
...
@@ -759,14 +759,16 @@ void plugin_load(void)
while
(
!
(
error
=
read_record_info
.
read_record
(
&
read_record_info
)))
{
DBUG_PRINT
(
"info"
,
(
"init plugin record"
));
LEX_STRING
name
,
dl
;
name
.
str
=
get_field
(
&
mem
,
table
->
field
[
0
]);
name
.
length
=
strlen
(
name
.
str
);
dl
.
str
=
get_field
(
&
mem
,
table
->
field
[
1
]);
dl
.
length
=
strlen
(
dl
.
str
);
String
str_name
,
str_dl
;
get_field
(
&
mem
,
table
->
field
[
0
],
&
str_name
);
get_field
(
&
mem
,
table
->
field
[
1
],
&
str_dl
);
LEX_STRING
name
=
{(
char
*
)
str_name
.
ptr
(),
str_name
.
length
()};
LEX_STRING
dl
=
{(
char
*
)
str_dl
.
ptr
(),
str_dl
.
length
()};
if
(
plugin_add
(
&
name
,
&
dl
,
REPORT_TO_LOG
))
DBUG_PRINT
(
"warning"
,
(
"Couldn't load plugin named '%s' with soname '%s'."
,
name
.
str
,
dl
.
str
));
sql_print_warning
(
"Couldn't load plugin named '%s' with soname '%s'."
,
str_name
.
c_ptr
(),
str_dl
.
c_ptr
(
));
}
if
(
error
>
0
)
sql_print_error
(
ER
(
ER_GET_ERRNO
),
my_errno
);
...
...
@@ -862,8 +864,8 @@ my_bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING
DBUG_RETURN
(
FALSE
);
deinit:
plugin_deinitialize
(
tmp
);
err:
plugin_del
(
tmp
);
err:
rw_unlock
(
&
THR_LOCK_plugin
);
DBUG_RETURN
(
TRUE
);
}
...
...
storage/myisam/mi_delete.c
View file @
cc9ab7d0
...
...
@@ -446,7 +446,7 @@ static int del(register MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *key,
else
{
DBUG_PRINT
(
"test"
,(
"Inserting of key when deleting"
));
if
(
_mi_get_last_key
(
info
,
keyinfo
,
leaf_buff
,
keybuff
,
endpos
,
if
(
!
_mi_get_last_key
(
info
,
keyinfo
,
leaf_buff
,
keybuff
,
endpos
,
&
tmp
))
goto
err
;
ret_value
=
_mi_insert
(
info
,
keyinfo
,
key
,
leaf_buff
,
endpos
,
keybuff
,
...
...
storage/myisam/myisam_ftdump.c
View file @
cc9ab7d0
...
...
@@ -127,7 +127,6 @@ int main(int argc,char *argv[])
if
(
count
||
stats
)
{
doc_cnt
++
;
if
(
strcmp
(
buf
,
buf2
))
{
if
(
*
buf2
)
...
...
@@ -152,6 +151,7 @@ int main(int argc,char *argv[])
keylen2
=
keylen
;
doc_cnt
=
0
;
}
doc_cnt
+=
(
subkeys
>=
0
?
1
:
-
subkeys
);
}
if
(
dump
)
{
...
...
@@ -167,7 +167,6 @@ int main(int argc,char *argv[])
if
(
count
||
stats
)
{
doc_cnt
++
;
if
(
*
buf2
)
{
uniq
++
;
...
...
storage/myisammrg/myrg_open.c
View file @
cc9ab7d0
...
...
@@ -33,7 +33,7 @@
MYRG_INFO
*
myrg_open
(
const
char
*
name
,
int
mode
,
int
handle_locking
)
{
int
save_errno
,
errpos
=
0
;
uint
files
=
0
,
i
,
dir_length
,
length
,
key_parts
;
uint
files
=
0
,
i
,
dir_length
,
length
,
key_parts
,
min_keys
=
0
;
ulonglong
file_offset
=
0
;
char
name_buff
[
FN_REFLEN
*
2
],
buff
[
FN_REFLEN
],
*
end
;
MYRG_INFO
*
m_info
=
0
;
...
...
@@ -90,7 +90,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
else
fn_format
(
buff
,
buff
,
""
,
""
,
0
);
if
(
!
(
isam
=
mi_open
(
buff
,
mode
,(
handle_locking
?
HA_OPEN_WAIT_IF_LOCKED
:
0
))))
{
my_errno
=
HA_ERR_WRONG_MRG_TABLE_DEF
;
goto
err
;
}
if
(
!
m_info
)
/* First file */
{
key_parts
=
isam
->
s
->
base
.
key_parts
;
...
...
@@ -107,6 +110,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
files
=
0
;
}
m_info
->
reclength
=
isam
->
s
->
base
.
reclength
;
min_keys
=
isam
->
s
->
base
.
keys
;
errpos
=
3
;
}
m_info
->
open_tables
[
files
].
table
=
isam
;
...
...
@@ -122,6 +126,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
m_info
->
records
+=
isam
->
state
->
records
;
m_info
->
del
+=
isam
->
state
->
del
;
m_info
->
data_file_length
+=
isam
->
state
->
data_file_length
;
if
(
min_keys
>
isam
->
s
->
base
.
keys
)
min_keys
=
isam
->
s
->
base
.
keys
;
for
(
i
=
0
;
i
<
key_parts
;
i
++
)
m_info
->
rec_per_key_part
[
i
]
+=
(
isam
->
s
->
state
.
rec_per_key_part
[
i
]
/
m_info
->
tables
);
...
...
@@ -139,7 +145,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
my_errno
=
HA_ERR_RECORD_FILE_FULL
;
goto
err
;
}
m_info
->
keys
=
files
?
isam
->
s
->
base
.
keys
:
0
;
m_info
->
keys
=
min_keys
;
bzero
((
char
*
)
&
m_info
->
by_key
,
sizeof
(
m_info
->
by_key
));
/* this works ok if the table list is empty */
...
...
storage/myisammrg/myrg_queue.c
View file @
cc9ab7d0
...
...
@@ -65,6 +65,8 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag)
error
=
my_errno
;
}
}
else
my_errno
=
error
=
HA_ERR_WRONG_INDEX
;
return
error
;
}
...
...
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