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
35068eef
Commit
35068eef
authored
Jun 06, 2002
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
probably fix of alignment error in query cache
parent
da0c70f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
sql/sql_cache.cc
sql/sql_cache.cc
+25
-8
No files found.
sql/sql_cache.cc
View file @
35068eef
...
@@ -704,17 +704,17 @@ Query_cache::Query_cache(ulong query_cache_limit,
...
@@ -704,17 +704,17 @@ Query_cache::Query_cache(ulong query_cache_limit,
query_cache_limit
(
query_cache_limit
),
query_cache_limit
(
query_cache_limit
),
queries_in_cache
(
0
),
hits
(
0
),
inserts
(
0
),
refused
(
0
),
queries_in_cache
(
0
),
hits
(
0
),
inserts
(
0
),
refused
(
0
),
total_blocks
(
0
),
total_blocks
(
0
),
min_allocation_unit
(
min_allocation_unit
),
min_allocation_unit
(
ALIGN_SIZE
(
min_allocation_unit
)
),
min_result_data_size
(
min_result_data_size
),
min_result_data_size
(
ALIGN_SIZE
(
min_result_data_size
)
),
def_query_hash_size
(
def_query_hash_size
),
def_query_hash_size
(
ALIGN_SIZE
(
def_query_hash_size
)
),
def_table_hash_size
(
def_table_hash_size
),
def_table_hash_size
(
ALIGN_SIZE
(
def_table_hash_size
)
),
initialized
(
0
)
initialized
(
0
)
{
{
ulong
min_needed
=
(
ALIGN_SIZE
(
sizeof
(
Query_cache_block
))
+
ulong
min_needed
=
(
ALIGN_SIZE
(
sizeof
(
Query_cache_block
))
+
ALIGN_SIZE
(
sizeof
(
Query_cache_block_table
))
+
ALIGN_SIZE
(
sizeof
(
Query_cache_block_table
))
+
ALIGN_SIZE
(
sizeof
(
Query_cache_query
))
+
3
);
ALIGN_SIZE
(
sizeof
(
Query_cache_query
))
+
3
);
set_if_bigger
(
min_allocation_unit
,
min_needed
);
set_if_bigger
(
min_allocation_unit
,
min_needed
);
this
->
min_allocation_unit
=
min_allocation_unit
;
this
->
min_allocation_unit
=
ALIGN_SIZE
(
min_allocation_unit
)
;
set_if_bigger
(
this
->
min_result_data_size
,
min_allocation_unit
);
set_if_bigger
(
this
->
min_result_data_size
,
min_allocation_unit
);
}
}
...
@@ -1229,6 +1229,12 @@ ulong Query_cache::init_cache()
...
@@ -1229,6 +1229,12 @@ ulong Query_cache::init_cache()
goto
err
;
goto
err
;
query_cache_size
-=
approx_additional_data_size
;
query_cache_size
-=
approx_additional_data_size
;
int
align
=
query_cache_size
%
ALIGN_SIZE
(
1
);
if
(
align
)
{
query_cache_size
-=
align
;
approx_additional_data_size
+=
align
;
}
/*
/*
Count memory bins number.
Count memory bins number.
...
@@ -1542,10 +1548,12 @@ Query_cache::write_block_data(ulong data_len, gptr data,
...
@@ -1542,10 +1548,12 @@ Query_cache::write_block_data(ulong data_len, gptr data,
ALIGN_SIZE
(
ntab
*
sizeof
(
Query_cache_block_table
))
+
ALIGN_SIZE
(
ntab
*
sizeof
(
Query_cache_block_table
))
+
header_len
);
header_len
);
ulong
len
=
data_len
+
all_headers_len
;
ulong
len
=
data_len
+
all_headers_len
;
ulong
align_len
=
ALIGN_SIZE
(
len
);
DBUG_ENTER
(
"Query_cache::write_block_data"
);
DBUG_ENTER
(
"Query_cache::write_block_data"
);
DBUG_PRINT
(
"qcache"
,
(
"data: %ld, header: %ld, all header: %ld"
,
DBUG_PRINT
(
"qcache"
,
(
"data: %ld, header: %ld, all header: %ld"
,
data_len
,
header_len
,
all_headers_len
));
data_len
,
header_len
,
all_headers_len
));
Query_cache_block
*
block
=
allocate_block
(
max
(
len
,
min_allocation_unit
),
Query_cache_block
*
block
=
allocate_block
(
max
(
align_len
,
min_allocation_unit
),
1
,
0
,
under_guard
);
1
,
0
,
under_guard
);
if
(
block
!=
0
)
if
(
block
!=
0
)
{
{
...
@@ -1740,7 +1748,8 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
...
@@ -1740,7 +1748,8 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
{
{
ulong
all_headers_len
=
(
ALIGN_SIZE
(
sizeof
(
Query_cache_block
))
+
ulong
all_headers_len
=
(
ALIGN_SIZE
(
sizeof
(
Query_cache_block
))
+
ALIGN_SIZE
(
sizeof
(
Query_cache_result
)));
ALIGN_SIZE
(
sizeof
(
Query_cache_result
)));
ulong
len
=
data_len
+
all_headers_len
;
ulong
len
=
data_len
+
all_headers_len
;
ulong
align_len
=
ALIGN_SIZE
(
len
);
DBUG_ENTER
(
"Query_cache::allocate_data_chain"
);
DBUG_ENTER
(
"Query_cache::allocate_data_chain"
);
DBUG_PRINT
(
"qcache"
,
(
"data_len %lu, all_headers_len %lu"
,
DBUG_PRINT
(
"qcache"
,
(
"data_len %lu, all_headers_len %lu"
,
data_len
,
all_headers_len
));
data_len
,
all_headers_len
));
...
@@ -1748,7 +1757,7 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
...
@@ -1748,7 +1757,7 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
ulong
min_size
=
(
first_block
?
ulong
min_size
=
(
first_block
?
get_min_first_result_data_size
()
:
get_min_first_result_data_size
()
:
get_min_append_result_data_size
());
get_min_append_result_data_size
());
*
result_block
=
allocate_block
(
max
(
min_size
,
len
),
*
result_block
=
allocate_block
(
max
(
min_size
,
align_
len
),
min_result_data_size
==
0
,
min_result_data_size
==
0
,
all_headers_len
+
min_result_data_size
,
all_headers_len
+
min_result_data_size
,
1
);
1
);
...
@@ -3046,6 +3055,14 @@ my_bool Query_cache::check_integrity(bool not_locked)
...
@@ -3046,6 +3055,14 @@ my_bool Query_cache::check_integrity(bool not_locked)
{
{
DBUG_PRINT
(
"qcache"
,
(
"block 0x%lx, type %u..."
,
DBUG_PRINT
(
"qcache"
,
(
"block 0x%lx, type %u..."
,
(
ulong
)
block
,
(
uint
)
block
->
type
));
(
ulong
)
block
,
(
uint
)
block
->
type
));
// Check allignment
if
((
ulonglong
)
block
%
ALIGN_SIZE
(
1
))
{
DBUG_PRINT
(
"error"
,
(
"block 0x%lx do not aligned by %d"
,
(
ulong
)
block
,
ALIGN_SIZE
(
1
)));
result
=
1
;
}
// Check memory allocation
// Check memory allocation
if
(
block
->
pnext
==
first_block
)
// Is it last block?
if
(
block
->
pnext
==
first_block
)
// Is it last block?
{
{
...
...
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