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
594c39bc
Commit
594c39bc
authored
Jun 05, 2007
by
istruewing@chilla.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into chilla.local:/home/mydev/mysql-5.0-axmrg
parents
d9fcc304
bb437f82
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
8 deletions
+68
-8
include/keycache.h
include/keycache.h
+0
-1
mysql-test/r/key_cache.result
mysql-test/r/key_cache.result
+27
-0
mysql-test/t/key_cache.test
mysql-test/t/key_cache.test
+27
-0
mysys/mf_keycache.c
mysys/mf_keycache.c
+5
-6
mysys/my_seek.c
mysys/my_seek.c
+1
-0
sql/lock.cc
sql/lock.cc
+7
-0
sql/mysqld.cc
sql/mysqld.cc
+1
-1
No files found.
include/keycache.h
View file @
594c39bc
...
...
@@ -46,7 +46,6 @@ typedef struct st_key_cache
my_bool
key_cache_inited
;
my_bool
resize_in_flush
;
/* true during flush of resize operation */
my_bool
can_be_used
;
/* usage of cache for read/write is allowed */
uint
key_cache_shift
;
ulong
key_cache_mem_size
;
/* specified size of the cache memory */
uint
key_cache_block_size
;
/* size of the page buffer of a cache block */
ulong
min_warm_blocks
;
/* min number of warm blocks; */
...
...
mysql-test/r/key_cache.result
View file @
594c39bc
...
...
@@ -341,3 +341,30 @@ Warning 1438 Cannot drop default keycache
select @@global.key_buffer_size;
@@global.key_buffer_size
2097152
SET @bug28478_key_cache_block_size= @@global.key_cache_block_size;
SET GLOBAL key_cache_block_size= 1536;
CREATE TABLE t1 (
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c1 CHAR(150),
c2 CHAR(150),
c3 CHAR(150),
KEY(c1, c2, c3)
) ENGINE= MyISAM;
INSERT INTO t1 (c1, c2, c3) VALUES
('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e'), ('d', 'e', 'f'),
('e', 'f', 'g'), ('f', 'g', 'h'), ('g', 'h', 'i'), ('h', 'i', 'j'),
('i', 'j', 'k'), ('j', 'k', 'l'), ('k', 'l', 'm'), ('l', 'm', 'n'),
('m', 'n', 'o'), ('n', 'o', 'p'), ('o', 'p', 'q'), ('p', 'q', 'r'),
('q', 'r', 's'), ('r', 's', 't'), ('s', 't', 'u'), ('t', 'u', 'v'),
('u', 'v', 'w'), ('v', 'w', 'x'), ('w', 'x', 'y'), ('x', 'y', 'z');
INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SHOW VARIABLES LIKE 'key_cache_block_size';
Variable_name Value
key_cache_block_size 1536
SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
DROP TABLE t1;
mysql-test/t/key_cache.test
View file @
594c39bc
...
...
@@ -219,4 +219,31 @@ set global key_cache_block_size= @my_key_cache_block_size;
set
@@
global
.
key_buffer_size
=
0
;
select
@@
global
.
key_buffer_size
;
#
# Bug#28478 - Improper key_cache_block_size corrupts MyISAM tables
#
SET
@
bug28478_key_cache_block_size
=
@@
global
.
key_cache_block_size
;
SET
GLOBAL
key_cache_block_size
=
1536
;
CREATE
TABLE
t1
(
id
BIGINT
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
c1
CHAR
(
150
),
c2
CHAR
(
150
),
c3
CHAR
(
150
),
KEY
(
c1
,
c2
,
c3
)
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
(
c1
,
c2
,
c3
)
VALUES
(
'a'
,
'b'
,
'c'
),
(
'b'
,
'c'
,
'd'
),
(
'c'
,
'd'
,
'e'
),
(
'd'
,
'e'
,
'f'
),
(
'e'
,
'f'
,
'g'
),
(
'f'
,
'g'
,
'h'
),
(
'g'
,
'h'
,
'i'
),
(
'h'
,
'i'
,
'j'
),
(
'i'
,
'j'
,
'k'
),
(
'j'
,
'k'
,
'l'
),
(
'k'
,
'l'
,
'm'
),
(
'l'
,
'm'
,
'n'
),
(
'm'
,
'n'
,
'o'
),
(
'n'
,
'o'
,
'p'
),
(
'o'
,
'p'
,
'q'
),
(
'p'
,
'q'
,
'r'
),
(
'q'
,
'r'
,
's'
),
(
'r'
,
's'
,
't'
),
(
's'
,
't'
,
'u'
),
(
't'
,
'u'
,
'v'
),
(
'u'
,
'v'
,
'w'
),
(
'v'
,
'w'
,
'x'
),
(
'w'
,
'x'
,
'y'
),
(
'x'
,
'y'
,
'z'
);
INSERT
INTO
t1
(
c1
,
c2
,
c3
)
SELECT
c1
,
c2
,
c3
from
t1
;
INSERT
INTO
t1
(
c1
,
c2
,
c3
)
SELECT
c1
,
c2
,
c3
from
t1
;
INSERT
INTO
t1
(
c1
,
c2
,
c3
)
SELECT
c1
,
c2
,
c3
from
t1
;
CHECK
TABLE
t1
;
SHOW
VARIABLES
LIKE
'key_cache_block_size'
;
SET
GLOBAL
key_cache_block_size
=
@
bug28478_key_cache_block_size
;
DROP
TABLE
t1
;
# End of 4.1 tests
mysys/mf_keycache.c
View file @
594c39bc
...
...
@@ -173,7 +173,7 @@ static void test_key_cache(KEY_CACHE *keycache,
#endif
#define KEYCACHE_HASH(f, pos) \
(((ulong) ((pos)
>> keycache->key_cache_shift)+
\
(((ulong) ((pos)
/ keycache->key_cache_block_size) +
\
(ulong) (f)) & (keycache->hash_entries-1))
#define FILE_HASH(f) ((uint) (f) & (CHANGED_BLOCKS_HASH-1))
...
...
@@ -329,7 +329,6 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
keycache
->
key_cache_mem_size
=
use_mem
;
keycache
->
key_cache_block_size
=
key_cache_block_size
;
keycache
->
key_cache_shift
=
my_bit_log2
(
key_cache_block_size
);
DBUG_PRINT
(
"info"
,
(
"key_cache_block_size: %u"
,
key_cache_block_size
));
...
...
@@ -352,7 +351,7 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
ALIGN_SIZE
(
hash_links
*
sizeof
(
HASH_LINK
))
+
ALIGN_SIZE
(
sizeof
(
HASH_LINK
*
)
*
keycache
->
hash_entries
)))
+
((
ulong
)
blocks
<<
keycache
->
key_cache_shift
)
>
use_mem
)
((
ulong
)
blocks
*
keycache
->
key_cache_block_size
)
>
use_mem
)
blocks
--
;
/* Allocate memory for cache page buffers */
if
((
keycache
->
block_mem
=
...
...
@@ -1807,7 +1806,7 @@ byte *key_cache_read(KEY_CACHE *keycache,
uint
status
;
int
page_st
;
offset
=
(
uint
)
(
filepos
&
(
keycache
->
key_cache_block_size
-
1
)
);
offset
=
(
uint
)
(
filepos
%
keycache
->
key_cache_block_size
);
/* Read data in key_cache_block_size increments */
do
{
...
...
@@ -1946,7 +1945,7 @@ int key_cache_insert(KEY_CACHE *keycache,
int
error
;
uint
offset
;
offset
=
(
uint
)
(
filepos
&
(
keycache
->
key_cache_block_size
-
1
)
);
offset
=
(
uint
)
(
filepos
%
keycache
->
key_cache_block_size
);
do
{
keycache_pthread_mutex_lock
(
&
keycache
->
cache_lock
);
...
...
@@ -2081,7 +2080,7 @@ int key_cache_write(KEY_CACHE *keycache,
int
page_st
;
uint
offset
;
offset
=
(
uint
)
(
filepos
&
(
keycache
->
key_cache_block_size
-
1
)
);
offset
=
(
uint
)
(
filepos
%
keycache
->
key_cache_block_size
);
do
{
keycache_pthread_mutex_lock
(
&
keycache
->
cache_lock
);
...
...
mysys/my_seek.c
View file @
594c39bc
...
...
@@ -88,6 +88,7 @@ my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
os_off_t
pos
;
DBUG_ENTER
(
"my_tell"
);
DBUG_PRINT
(
"my"
,(
"Fd: %d MyFlags: %d"
,
fd
,
MyFlags
));
DBUG_ASSERT
(
fd
>=
0
);
#ifdef HAVE_TELL
pos
=
tell
(
fd
);
#else
...
...
sql/lock.cc
View file @
594c39bc
...
...
@@ -178,6 +178,13 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
}
else
if
(
rc
==
1
)
/* aborted */
{
/*
reset_lock_data is required here. If thr_multi_lock fails it
resets lock type for tables, which were locked before (and
including) one that caused error. Lock type for other tables
preserved.
*/
reset_lock_data
(
sql_lock
);
thd
->
some_tables_deleted
=
1
;
// Try again
sql_lock
->
lock_count
=
0
;
// Locks are already freed
}
...
...
sql/mysqld.cc
View file @
594c39bc
...
...
@@ -5819,7 +5819,7 @@ log and this option does nothing anymore.",
(
gptr
*
)
&
dflt_key_cache_var
.
param_block_size
,
(
gptr
*
)
0
,
0
,
(
GET_ULONG
|
GET_ASK_ADDR
),
REQUIRED_ARG
,
KEY_CACHE_BLOCK_SIZE
,
512
,
1024
*
16
,
MALLOC_OVERHEAD
,
512
,
0
},
KEY_CACHE_BLOCK_SIZE
,
512
,
1024
*
16
,
0
,
512
,
0
},
{
"key_cache_division_limit"
,
OPT_KEY_CACHE_DIVISION_LIMIT
,
"The minimum percentage of warm blocks in key cache"
,
(
gptr
*
)
&
dflt_key_cache_var
.
param_division_limit
,
...
...
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