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
6ea27b10
Commit
6ea27b10
authored
Apr 25, 2006
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Manually merged
parents
5eb07ec7
806564d7
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
420 additions
and
60 deletions
+420
-60
mysql-test/extra/rpl_tests/rpl_deadlock.test
mysql-test/extra/rpl_tests/rpl_deadlock.test
+7
-1
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+3
-1
mysql-test/r/func_gconcat.result
mysql-test/r/func_gconcat.result
+10
-0
mysql-test/r/key_cache.result
mysql-test/r/key_cache.result
+42
-0
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+32
-0
mysql-test/r/rpl_deadlock_innodb.result
mysql-test/r/rpl_deadlock_innodb.result
+99
-6
mysql-test/t/func_gconcat.test
mysql-test/t/func_gconcat.test
+11
-0
mysql-test/t/key_cache.test
mysql-test/t/key_cache.test
+40
-1
mysql-test/t/order_by.test
mysql-test/t/order_by.test
+14
-0
mysys/mf_keycache.c
mysys/mf_keycache.c
+7
-5
sql/item_sum.cc
sql/item_sum.cc
+1
-1
sql/item_sum.h
sql/item_sum.h
+1
-1
sql/lock.cc
sql/lock.cc
+54
-2
sql/sql_lex.h
sql/sql_lex.h
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+67
-36
sql/sql_select.cc
sql/sql_select.cc
+1
-1
sql/sql_union.cc
sql/sql_union.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+21
-3
storage/ndb/src/kernel/SimBlockList.cpp
storage/ndb/src/kernel/SimBlockList.cpp
+4
-0
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp
+4
-1
No files found.
mysql-test/extra/rpl_tests/rpl_deadlock.test
View file @
6ea27b10
...
...
@@ -66,7 +66,9 @@ select * from t2;
# check that no error is reported
--
replace_column
1
# 7 # 8 # 9 # 16 # 22 # 23 # 33 #
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
vertical_results
show
slave
status
;
--
horizontal_results
# 2) Test lock wait timeout
...
...
@@ -81,9 +83,11 @@ sync_with_master;
select
*
from
t1
;
# check that slave succeeded finally
select
*
from
t2
;
# check that no error is reported
--
replace_column
1
# 7 # 8 # 9 # 16 # 22 # 23 # 33 #
--
replace_column
1
# 7 # 8 # 9 # 1
1 # 1
6 # 22 # 23 # 33 #
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
vertical_results
show
slave
status
;
--
horizontal_results
# Now we repeat 2), but with BEGIN in the same relay log as
# COMMIT (to see if seeking into hot log is ok).
...
...
@@ -103,7 +107,9 @@ select * from t1;
select
*
from
t2
;
--
replace_column
1
# 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 #
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
vertical_results
show
slave
status
;
--
horizontal_results
connection
master
;
drop
table
t1
,
t2
,
t3
,
t4
;
...
...
mysql-test/mysql-test-run.sh
View file @
6ea27b10
...
...
@@ -669,7 +669,9 @@ fi
[
-d
$MYSQL_TEST_DIR
/var/tmp
]
||
mkdir
$MYSQL_TEST_DIR
/var/tmp
[
-d
$MYSQL_TEST_DIR
/var/run
]
||
mkdir
$MYSQL_TEST_DIR
/var/run
[
-d
$MYSQL_TEST_DIR
/var/log
]
||
mkdir
$MYSQL_TEST_DIR
/var/log
if
!
test
-L
$MYSQL_TEST_DIR
/var/std_data_ln
;
then
# Use 'test', not '[' as the shell builtin might not have '-L
if
test
!
-L
"
$MYSQL_TEST_DIR
/var/std_data_ln"
;
then
ln
-s
$MYSQL_TEST_DIR
/std_data/
$MYSQL_TEST_DIR
/var/std_data_ln
fi
...
...
mysql-test/r/func_gconcat.result
View file @
6ea27b10
...
...
@@ -611,6 +611,16 @@ count(distinct (f1+1))
1
3
drop table t1;
create table t1 (f1 int unsigned, f2 varchar(255));
insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
select f2,group_concat(f1) from t1 group by f2;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 f2 f2 253 255 255 Y 0 0 8
def group_concat(f1) 253 400 1 Y 128 0 63
f2 group_concat(f1)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2
drop table t1;
set names latin1;
create table t1 (a char, b char);
insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b');
...
...
mysql-test/r/key_cache.result
View file @
6ea27b10
...
...
@@ -289,6 +289,48 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY);
SET GLOBAL key_cache_block_size=1536;
INSERT INTO t1 VALUES (1);
SELECT @@key_cache_block_size;
@@key_cache_block_size
1536
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
SET GLOBAL key_cache_block_size=1536;
INSERT INTO t1 VALUES (1,0);
INSERT INTO t2(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t2;
INSERT INTO t2(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t2;
INSERT INTO t2(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t2;
INSERT INTO t2(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t2;
INSERT INTO t2(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t2;
INSERT INTO t2(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t2;
INSERT INTO t2(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t2;
INSERT INTO t2(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t2;
INSERT INTO t2(b) SELECT b FROM t1;
INSERT INTO t1(b) SELECT b FROM t2;
SELECT COUNT(*) FROM t1;
COUNT(*)
4181
SELECT @@key_cache_block_size;
@@key_cache_block_size
1536
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1,t2;
set @@global.key_buffer_size=0;
Warnings:
Warning 1438 Cannot drop default keycache
...
...
mysql-test/r/order_by.result
View file @
6ea27b10
...
...
@@ -820,3 +820,35 @@ a
2
2
DROP TABLE t1;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,30), (2,20), (1,10), (2,30), (1,20), (2,10);
(SELECT b,a FROM t1 ORDER BY a,b) ORDER BY b,a;
b a
10 1
10 2
20 1
20 2
30 1
30 2
(SELECT b FROM t1 ORDER BY b DESC) ORDER BY b ASC;
b
10
10
20
20
30
30
(SELECT b,a FROM t1 ORDER BY b,a) ORDER BY a,b;
b a
10 1
20 1
30 1
10 2
20 2
30 2
(SELECT b,a FROM t1 ORDER by b,a LIMIT 3) ORDER by a,b;
b a
10 1
20 1
10 2
DROP TABLE t1;
mysql-test/r/rpl_deadlock_innodb.result
View file @
6ea27b10
...
...
@@ -44,8 +44,39 @@ select * from t2;
a
22
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 Yes Yes # 0 0 # # None 0 No #
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 18911
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 18911
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
stop slave;
change master to master_log_pos=536;
begin;
...
...
@@ -62,8 +93,39 @@ select * from t2;
a
22
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 Yes Yes # 0 0 # # None 0 No #
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 18911
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running #
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 18911
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
set global max_relay_log_size=0;
stop slave;
change master to master_log_pos=536;
...
...
@@ -82,6 +144,37 @@ select * from t2;
a
22
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 # Yes # 0 0 # # None 0 No #
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 18911
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running #
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 18911
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
drop table t1,t2,t3,t4;
mysql-test/t/func_gconcat.test
View file @
6ea27b10
...
...
@@ -397,6 +397,17 @@ insert into t1 values(1),(2),(3);
select
f1
,
group_concat
(
f1
+
1
)
from
t1
group
by
f1
with
rollup
;
select
count
(
distinct
(
f1
+
1
))
from
t1
group
by
f1
with
rollup
;
drop
table
t1
;
#
# Bug#14169 type of group_concat() result changed to blob if tmp_table was used
#
create
table
t1
(
f1
int
unsigned
,
f2
varchar
(
255
));
insert
into
t1
values
(
1
,
repeat
(
'a'
,
255
)),(
2
,
repeat
(
'b'
,
255
));
--
enable_metadata
select
f2
,
group_concat
(
f1
)
from
t1
group
by
f2
;
--
disable_metadata
drop
table
t1
;
# End of 4.1 tests
#
...
...
mysql-test/t/key_cache.test
View file @
6ea27b10
...
...
@@ -149,6 +149,7 @@ show status like 'key_blocks_used';
--
replace_result
1812
KEY_BLOCKS_UNUSED
1793
KEY_BLOCKS_UNUSED
1674
KEY_BLOCKS_UNUSED
1818
KEY_BLOCKS_UNUSED
1824
KEY_BLOCKS_UNUSED
show
status
like
'key_blocks_unused'
;
# Cleanup
# We don't reset keycache2 as we want to ensure that mysqld will reset it
set
global
keycache2
.
key_buffer_size
=
0
;
...
...
@@ -157,7 +158,7 @@ set global keycache2.key_buffer_size=0;
set
global
keycache3
.
key_buffer_size
=
100
;
set
global
keycache3
.
key_buffer_size
=
0
;
# Test case for bu
f
6447
# Test case for bu
g
6447
create
table
t1
(
mytext
text
,
FULLTEXT
(
mytext
));
insert
t1
values
(
'aaabbb'
);
...
...
@@ -168,6 +169,44 @@ check table t1;
drop
table
t1
;
#
# Bug #19079: corrupted index when key_cache_block_size is not multiple of
# myisam_block_size
CREATE
TABLE
t1
(
a
int
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
);
SET
GLOBAL
key_cache_block_size
=
1536
;
INSERT
INTO
t1
VALUES
(
1
);
SELECT
@@
key_cache_block_size
;
CHECK
TABLE
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
a
int
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
b
int
);
CREATE
TABLE
t2
(
a
int
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
b
int
);
SET
GLOBAL
key_cache_block_size
=
1536
;
INSERT
INTO
t1
VALUES
(
1
,
0
);
INSERT
INTO
t2
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t2
;
INSERT
INTO
t2
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t2
;
INSERT
INTO
t2
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t2
;
INSERT
INTO
t2
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t2
;
INSERT
INTO
t2
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t2
;
INSERT
INTO
t2
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t2
;
INSERT
INTO
t2
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t2
;
INSERT
INTO
t2
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t2
;
INSERT
INTO
t2
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t2
;
SELECT
COUNT
(
*
)
FROM
t1
;
SELECT
@@
key_cache_block_size
;
CHECK
TABLE
t1
;
DROP
TABLE
t1
,
t2
;
#
# Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO
# (One cannot drop the default key cache.)
...
...
mysql-test/t/order_by.test
View file @
6ea27b10
...
...
@@ -563,4 +563,18 @@ SELECT a FROM t1 ORDER BY a;
(
SELECT
a
FROM
t1
)
ORDER
BY
a
;
DROP
TABLE
t1
;
#
# Bug #18767: global ORDER BY applied to a SELECT with ORDER BY either was
# ignored or 'concatened' to the latter.
CREATE
TABLE
t1
(
a
int
,
b
int
);
INSERT
INTO
t1
VALUES
(
1
,
30
),
(
2
,
20
),
(
1
,
10
),
(
2
,
30
),
(
1
,
20
),
(
2
,
10
);
(
SELECT
b
,
a
FROM
t1
ORDER
BY
a
,
b
)
ORDER
BY
b
,
a
;
(
SELECT
b
FROM
t1
ORDER
BY
b
DESC
)
ORDER
BY
b
ASC
;
(
SELECT
b
,
a
FROM
t1
ORDER
BY
b
,
a
)
ORDER
BY
a
,
b
;
(
SELECT
b
,
a
FROM
t1
ORDER
by
b
,
a
LIMIT
3
)
ORDER
by
a
,
b
;
DROP
TABLE
t1
;
# End of 4.1 tests
mysys/mf_keycache.c
View file @
6ea27b10
...
...
@@ -1805,6 +1805,7 @@ byte *key_cache_read(KEY_CACHE *keycache,
uint
status
;
int
page_st
;
offset
=
(
uint
)
(
filepos
&
(
keycache
->
key_cache_block_size
-
1
));
/* Read data in key_cache_block_size increments */
do
{
...
...
@@ -1814,7 +1815,6 @@ byte *key_cache_read(KEY_CACHE *keycache,
keycache_pthread_mutex_unlock
(
&
keycache
->
cache_lock
);
goto
no_key_cache
;
}
offset
=
(
uint
)
(
filepos
&
(
keycache
->
key_cache_block_size
-
1
));
filepos
-=
offset
;
read_length
=
length
;
set_if_smaller
(
read_length
,
keycache
->
key_cache_block_size
-
offset
);
...
...
@@ -1890,6 +1890,7 @@ byte *key_cache_read(KEY_CACHE *keycache,
#endif
buff
+=
read_length
;
filepos
+=
read_length
+
offset
;
offset
=
0
;
}
while
((
length
-=
read_length
));
DBUG_RETURN
(
start
);
...
...
@@ -1941,17 +1942,17 @@ int key_cache_insert(KEY_CACHE *keycache,
uint
read_length
;
int
page_st
;
int
error
;
uint
offset
;
offset
=
(
uint
)
(
filepos
&
(
keycache
->
key_cache_block_size
-
1
));
do
{
uint
offset
;
keycache_pthread_mutex_lock
(
&
keycache
->
cache_lock
);
if
(
!
keycache
->
can_be_used
)
{
keycache_pthread_mutex_unlock
(
&
keycache
->
cache_lock
);
DBUG_RETURN
(
0
);
}
offset
=
(
uint
)
(
filepos
&
(
keycache
->
key_cache_block_size
-
1
));
/* Read data into key cache from buff in key_cache_block_size incr. */
filepos
-=
offset
;
read_length
=
length
;
...
...
@@ -2009,6 +2010,7 @@ int key_cache_insert(KEY_CACHE *keycache,
buff
+=
read_length
;
filepos
+=
read_length
+
offset
;
offset
=
0
;
}
while
((
length
-=
read_length
));
}
...
...
@@ -2075,17 +2077,17 @@ int key_cache_write(KEY_CACHE *keycache,
/* Key cache is used */
uint
read_length
;
int
page_st
;
uint
offset
;
offset
=
(
uint
)
(
filepos
&
(
keycache
->
key_cache_block_size
-
1
));
do
{
uint
offset
;
keycache_pthread_mutex_lock
(
&
keycache
->
cache_lock
);
if
(
!
keycache
->
can_be_used
)
{
keycache_pthread_mutex_unlock
(
&
keycache
->
cache_lock
);
goto
no_key_cache
;
}
offset
=
(
uint
)
(
filepos
&
(
keycache
->
key_cache_block_size
-
1
));
/* Write data in key_cache_block_size increments */
filepos
-=
offset
;
read_length
=
length
;
...
...
sql/item_sum.cc
View file @
6ea27b10
...
...
@@ -380,7 +380,7 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table,
field
=
new
Field_longlong
(
max_length
,
maybe_null
,
name
,
unsigned_flag
);
break
;
case
STRING_RESULT
:
if
(
max_length
<=
255
||
!
convert_blob_length
)
if
(
max_length
/
collation
.
collation
->
mbmaxlen
<=
255
||
!
convert_blob_length
)
return
make_string_field
(
table
);
field
=
new
Field_varstring
(
convert_blob_length
,
maybe_null
,
name
,
table
->
s
,
collation
.
collation
);
...
...
sql/item_sum.h
View file @
6ea27b10
...
...
@@ -1121,7 +1121,7 @@ public:
virtual
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
enum_field_types
field_type
()
const
{
if
(
max_length
/
collation
.
collation
->
mbmaxlen
>
CONVERT_IF_BIGGER_TO_BLOB
)
if
(
max_length
/
collation
.
collation
->
mbmaxlen
>
CONVERT_IF_BIGGER_TO_BLOB
)
return
FIELD_TYPE_BLOB
;
else
return
MYSQL_TYPE_VARCHAR
;
...
...
sql/lock.cc
View file @
6ea27b10
...
...
@@ -78,6 +78,7 @@ extern HASH open_cache;
static
MYSQL_LOCK
*
get_lock_data
(
THD
*
thd
,
TABLE
**
table
,
uint
count
,
uint
flags
,
TABLE
**
write_locked
);
static
void
reset_lock_data
(
MYSQL_LOCK
*
sql_lock
);
static
int
lock_external
(
THD
*
thd
,
TABLE
**
table
,
uint
count
);
static
int
unlock_external
(
THD
*
thd
,
TABLE
**
table
,
uint
count
);
static
void
print_lock_error
(
int
error
,
const
char
*
);
...
...
@@ -135,12 +136,16 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
*/
if
(
wait_if_global_read_lock
(
thd
,
1
,
1
))
{
/* Clear the lock type of all lock data to avoid reusage. */
reset_lock_data
(
sql_lock
);
my_free
((
gptr
)
sql_lock
,
MYF
(
0
));
sql_lock
=
0
;
break
;
}
if
(
thd
->
version
!=
refresh_version
)
{
/* Clear the lock type of all lock data to avoid reusage. */
reset_lock_data
(
sql_lock
);
my_free
((
gptr
)
sql_lock
,
MYF
(
0
));
goto
retry
;
}
...
...
@@ -150,6 +155,8 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
DBUG_PRINT
(
"info"
,
(
"thd->proc_info %s"
,
thd
->
proc_info
));
if
(
lock_external
(
thd
,
tables
,
count
))
{
/* Clear the lock type of all lock data to avoid reusage. */
reset_lock_data
(
sql_lock
);
my_free
((
gptr
)
sql_lock
,
MYF
(
0
));
sql_lock
=
0
;
break
;
...
...
@@ -720,7 +727,10 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
*
write_lock_used
=
table
;
if
(
table
->
db_stat
&
HA_READ_ONLY
)
{
my_error
(
ER_OPEN_AS_READONLY
,
MYF
(
0
),
table
->
alias
);
my_error
(
ER_OPEN_AS_READONLY
,
MYF
(
0
),
table
->
alias
);
/* Clear the lock type of the lock data that are stored already. */
sql_lock
->
lock_count
=
locks
-
sql_lock
->
locks
;
reset_lock_data
(
sql_lock
);
my_free
((
gptr
)
sql_lock
,
MYF
(
0
));
DBUG_RETURN
(
0
);
}
...
...
@@ -745,6 +755,48 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
}
/*
Reset lock type in lock data.
SYNOPSIS
reset_lock_data()
sql_lock The MySQL lock.
DESCRIPTION
After a locking error we want to quit the locking of the table(s).
The test case in the bug report for Bug #18544 has the following
cases: 1. Locking error in lock_external() due to InnoDB timeout.
2. Locking error in get_lock_data() due to missing write permission.
3. Locking error in wait_if_global_read_lock() due to lock conflict.
In all these cases we have already set the lock type into the lock
data of the open table(s). If the table(s) are in the open table
cache, they could be reused with the non-zero lock type set. This
could lead to ignoring a different lock type with the next lock.
Clear the lock type of all lock data. This ensures that the next
lock request will set its lock type properly.
RETURN
void
*/
static
void
reset_lock_data
(
MYSQL_LOCK
*
sql_lock
)
{
THR_LOCK_DATA
**
ldata
;
THR_LOCK_DATA
**
ldata_end
;
for
(
ldata
=
sql_lock
->
locks
,
ldata_end
=
ldata
+
sql_lock
->
lock_count
;
ldata
<
ldata_end
;
ldata
++
)
{
/* Reset lock type. */
(
*
ldata
)
->
type
=
TL_UNLOCK
;
}
}
/*****************************************************************************
Lock table based on the name.
This is used when we need total access to a closed, not open table
...
...
sql/sql_lex.h
View file @
6ea27b10
...
...
@@ -479,6 +479,7 @@ public:
void
print
(
String
*
str
);
bool
add_fake_select_lex
(
THD
*
thd
);
void
init_prepare_fake_select_lex
(
THD
*
thd
);
inline
bool
is_prepared
()
{
return
prepared
;
}
bool
change_result
(
select_subselect
*
result
,
select_subselect
*
old_result
);
...
...
sql/sql_parse.cc
View file @
6ea27b10
...
...
@@ -5723,48 +5723,17 @@ mysql_new_select(LEX *lex, bool move_down)
}
else
{
Name_resolution_context
*
outer_context
;
if
(
lex
->
current_select
->
order_list
.
first
&&
!
lex
->
current_select
->
braces
)
{
my_error
(
ER_WRONG_USAGE
,
MYF
(
0
),
"UNION"
,
"ORDER BY"
);
DBUG_RETURN
(
1
);
}
select_lex
->
include_neighbour
(
lex
->
current_select
);
/*
we are not sure that we have one level of SELECTs above, so we take
outer_context address from first select of unit
*/
outer_context
=
select_lex
->
master_unit
()
->
first_select
()
->
context
.
outer_context
;
SELECT_LEX_UNIT
*
unit
=
select_lex
->
master_unit
();
SELECT_LEX
*
fake
=
unit
->
fake_select_lex
;
if
(
!
fake
)
{
/*
as far as we included SELECT_LEX for UNION unit should have
fake SELECT_LEX for UNION processing
*/
if
(
!
(
fake
=
unit
->
fake_select_lex
=
new
(
thd
->
mem_root
)
SELECT_LEX
()))
if
(
!
unit
->
fake_select_lex
&&
unit
->
add_fake_select_lex
(
lex
->
thd
))
DBUG_RETURN
(
1
);
fake
->
include_standalone
(
unit
,
(
SELECT_LEX_NODE
**
)
&
unit
->
fake_select_lex
);
fake
->
select_number
=
INT_MAX
;
fake
->
parent_lex
=
lex
;
/* Used in init_query. */
fake
->
make_empty_select
();
fake
->
linkage
=
GLOBAL_OPTIONS_TYPE
;
fake
->
select_limit
=
0
;
fake
->
context
.
outer_context
=
outer_context
;
/* allow item list resolving in fake select for ORDER BY */
fake
->
context
.
resolve_in_select_list
=
TRUE
;
fake
->
context
.
select_lex
=
fake
;
/*
Remove the name resolution context of the fake select from the
context stack.
*/
lex
->
pop_context
();
}
select_lex
->
context
.
outer_context
=
outer_context
;
select_lex
->
context
.
outer_context
=
unit
->
first_select
()
->
context
.
outer_context
;
}
select_lex
->
master_unit
()
->
global_parameters
=
select_lex
;
...
...
@@ -6548,6 +6517,68 @@ void st_select_lex::set_lock_for_tables(thr_lock_type lock_type)
}
/*
Create a fake SELECT_LEX for a unit
SYNOPSIS:
add_fake_select_lex()
thd thread handle
DESCRIPTION
The method create a fake SELECT_LEX object for a unit.
This object is created for any union construct containing a union
operation and also for any single select union construct of the form
(SELECT ... ORDER BY order_list [LIMIT n]) ORDER BY ...
or of the form
(SELECT ... ORDER BY LIMIT n) ORDER BY ...
NOTES
The object is used to retrieve rows from the temporary table
where the result on the union is obtained.
RETURN VALUES
1 on failure to create the object
0 on success
*/
bool
st_select_lex_unit
::
add_fake_select_lex
(
THD
*
thd
)
{
SELECT_LEX
*
first_sl
=
first_select
();
DBUG_ENTER
(
"add_fake_select_lex"
);
DBUG_ASSERT
(
!
fake_select_lex
);
if
(
!
(
fake_select_lex
=
new
(
thd
->
mem_root
)
SELECT_LEX
()))
DBUG_RETURN
(
1
);
fake_select_lex
->
include_standalone
(
this
,
(
SELECT_LEX_NODE
**
)
&
fake_select_lex
);
fake_select_lex
->
select_number
=
INT_MAX
;
fake_select_lex
->
parent_lex
=
thd
->
lex
;
/* Used in init_query. */
fake_select_lex
->
make_empty_select
();
fake_select_lex
->
linkage
=
GLOBAL_OPTIONS_TYPE
;
fake_select_lex
->
select_limit
=
0
;
fake_select_lex
->
context
.
outer_context
=
first_sl
->
context
.
outer_context
;
/* allow item list resolving in fake select for ORDER BY */
fake_select_lex
->
context
.
resolve_in_select_list
=
TRUE
;
fake_select_lex
->
context
.
select_lex
=
fake_select_lex
;
if
(
!
first_sl
->
next_select
())
{
/*
This works only for
(SELECT ... ORDER BY list [LIMIT n]) ORDER BY order_list [LIMIT m],
(SELECT ... LIMIT n) ORDER BY order_list [LIMIT m]
just before the parser starts processing order_list
*/
global_parameters
=
fake_select_lex
;
fake_select_lex
->
no_table_names_allowed
=
1
;
thd
->
lex
->
current_select
=
fake_select_lex
;
}
thd
->
lex
->
pop_context
();
DBUG_RETURN
(
0
);
}
/*
Push a new name resolution context for a JOIN ... ON clause to the
context stack of a query block.
...
...
sql/sql_select.cc
View file @
6ea27b10
...
...
@@ -224,7 +224,7 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
register
SELECT_LEX
*
select_lex
=
&
lex
->
select_lex
;
DBUG_ENTER
(
"handle_select"
);
if
(
select_lex
->
next_select
())
if
(
select_lex
->
next_select
()
||
select_lex
->
master_unit
()
->
fake_select_lex
)
res
=
mysql_union
(
thd
,
lex
,
result
,
&
lex
->
unit
,
setup_tables_done_option
);
else
{
...
...
sql/sql_union.cc
View file @
6ea27b10
...
...
@@ -202,7 +202,7 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
thd_arg
->
lex
->
current_select
=
sl
=
first_sl
;
found_rows_for_union
=
first_sl
->
options
&
OPTION_FOUND_ROWS
;
is_union
=
test
(
first_sl
->
next_select
())
;
is_union
=
first_sl
->
next_select
()
||
fake_select_lex
;
/* Global option */
...
...
sql/sql_yacc.yy
View file @
6ea27b10
...
...
@@ -7363,14 +7363,32 @@ order_clause:
ORDER_SYM BY
{
LEX *lex=Lex;
if (lex->current_select->linkage != GLOBAL_OPTIONS_TYPE &&
lex->current_select->olap !=
UNSPECIFIED_OLAP_TYPE)
SELECT_LEX *sel= lex->current_select;
SELECT_LEX_UNIT *unit= sel-> master_unit();
if (sel->linkage != GLOBAL_OPTIONS_TYPE &&
sel->olap != UNSPECIFIED_OLAP_TYPE)
{
my_error(ER_WRONG_USAGE, MYF(0),
"CUBE/ROLLUP", "ORDER BY");
YYABORT;
}
if (lex->sql_command != SQLCOM_ALTER_TABLE && !unit->fake_select_lex)
{
/*
A query of the of the form (SELECT ...) ORDER BY order_list is
executed in the same way as the query
SELECT ... ORDER BY order_list
unless the SELECT construct contains ORDER BY or LIMIT clauses.
Otherwise we create a fake SELECT_LEX if it has not been created
yet.
*/
SELECT_LEX *first_sl= unit->first_select();
if (!first_sl->next_select() &&
(first_sl->order_list.elements ||
first_sl->select_limit) &&
unit->add_fake_select_lex(lex->thd))
YYABORT;
}
} order_list;
order_list:
...
...
storage/ndb/src/kernel/SimBlockList.cpp
View file @
6ea27b10
...
...
@@ -120,8 +120,12 @@ SimBlockList::unload(){
if
(
theList
!=
0
){
for
(
int
i
=
0
;
i
<
noOfBlocks
;
i
++
){
if
(
theList
[
i
]
!=
0
){
#ifdef VM_TRACE
theList
[
i
]
->~
SimulatedBlock
();
free
(
theList
[
i
]);
#else
delete
(
theList
[
i
]);
#endif
theList
[
i
]
=
0
;
}
}
...
...
storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrInit.cpp
View file @
6ea27b10
...
...
@@ -25,7 +25,10 @@
void
Ndbcntr
::
initData
()
{
c_start
.
reset
();
cmasterNodeId
=
0
;
cnoStartNodes
=
0
;
cnoWaitrep
=
0
;
// Records with constant sizes
ndbBlocksRec
=
new
NdbBlocksRec
[
ZSIZE_NDB_BLOCKS_REC
];
}
//Ndbcntr::initData()
...
...
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