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
96ebe381
Commit
96ebe381
authored
Sep 19, 2002
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new function for innodb
windows case insensitive tables name work around
parent
c44c70fc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
20 deletions
+56
-20
sql/sql_cache.cc
sql/sql_cache.cc
+34
-6
sql/sql_cache.h
sql/sql_cache.h
+2
-0
sql/sql_class.cc
sql/sql_class.cc
+18
-13
sql/sql_class.h
sql/sql_class.h
+2
-1
No files found.
sql/sql_cache.cc
View file @
96ebe381
...
...
@@ -708,11 +708,11 @@ Query_cache::Query_cache(ulong query_cache_limit,
def_table_hash_size
(
ALIGN_SIZE
(
def_table_hash_size
)),
initialized
(
0
)
{
ulong
min_needed
=
(
ALIGN_SIZE
(
sizeof
(
Query_cache_block
))
+
ALIGN_SIZE
(
sizeof
(
Query_cache_block_table
))
+
ALIGN_SIZE
(
sizeof
(
Query_cache_query
))
+
3
);
ulong
min_needed
=
(
ALIGN_SIZE
(
sizeof
(
Query_cache_block
))
+
ALIGN_SIZE
(
sizeof
(
Query_cache_block_table
))
+
ALIGN_SIZE
(
sizeof
(
Query_cache_query
))
+
3
);
set_if_bigger
(
min_allocation_unit
,
min_needed
);
this
->
min_allocation_unit
=
ALIGN_SIZE
(
min_allocation_unit
);
this
->
min_allocation_unit
=
ALIGN_SIZE
(
min_allocation_unit
);
set_if_bigger
(
this
->
min_result_data_size
,
min_allocation_unit
);
}
...
...
@@ -723,7 +723,7 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
DBUG_PRINT
(
"qcache"
,
(
"from %lu to %lu"
,
query_cache_size
,
query_cache_size_arg
));
free_cache
(
0
);
query_cache_size
=
query_cache_size_arg
;
query_cache_size
=
query_cache_size_arg
;
DBUG_RETURN
(
init_cache
());
}
...
...
@@ -1104,6 +1104,28 @@ void Query_cache::invalidate(THD *thd, TABLE *table,
DBUG_VOID_RETURN
;
}
void
Query_cache
::
invalidate
(
THD
*
thd
,
const
char
*
key
,
uint32
key_length
,
my_bool
using_transactions
)
{
DBUG_ENTER
(
"Query_cache::invalidate (key)"
);
if
(
query_cache_size
>
0
)
{
using_transactions
=
using_transactions
&&
(
thd
->
options
&
(
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
));
if
(
using_transactions
)
// used for innodb => has_transactions() is TRUE
thd
->
add_changed_table
(
key
,
key_length
);
else
{
STRUCT_LOCK
(
&
structure_guard_mutex
);
if
(
query_cache_size
>
0
)
invalidate_table
((
byte
*
)
key
,
key_length
);
STRUCT_UNLOCK
(
&
structure_guard_mutex
);
}
}
DBUG_VOID_RETURN
;
}
/*
Remove all cached queries that uses the given database
*/
...
...
@@ -1356,8 +1378,15 @@ ulong Query_cache::init_cache()
VOID
(
hash_init
(
&
queries
,
def_query_hash_size
,
0
,
0
,
query_cache_query_get_key
,
0
,
0
));
#ifndef __WIN__
VOID
(
hash_init
(
&
tables
,
def_table_hash_size
,
0
,
0
,
query_cache_table_get_key
,
0
,
0
));
#else
// windows case insensitive file names work around
VOID
(
hash_init
(
&
tables
,
def_table_hash_size
,
0
,
0
,
query_cache_table_get_key
,
0
,
(
lower_case_table_names
?
0
:
HASH_CASE_INSENSITIVE
)));
#endif
queries_in_cache
=
0
;
queries_blocks
=
0
;
...
...
@@ -2828,7 +2857,6 @@ uint Query_cache::filename_2_table_key (char *key, const char *path,
filename
)
-
key
)
+
1
);
}
/****************************************************************************
Functions to be used when debugging
****************************************************************************/
...
...
sql/sql_cache.h
View file @
96ebe381
...
...
@@ -361,6 +361,8 @@ protected:
my_bool
using_transactions
);
void
invalidate
(
CHANGED_TABLE_LIST
*
tables_used
);
void
invalidate
(
THD
*
thd
,
TABLE
*
table
,
my_bool
using_transactions
);
void
invalidate
(
THD
*
thd
,
const
char
*
key
,
uint32
key_length
,
my_bool
using_transactions
);
/* Remove all queries that uses any of the tables in following database */
void
invalidate
(
char
*
db
);
...
...
sql/sql_class.cc
View file @
96ebe381
...
...
@@ -301,28 +301,33 @@ void THD::add_changed_table(TABLE *table)
DBUG_ASSERT
((
options
&
(
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
&&
table
->
file
->
has_transactions
());
DBUG_RETURN
(
add_changed_table
(
table
->
table_cache_key
,
table
->
key_length
));
}
void
THD
::
add_changed_table
(
const
char
*
key
,
long
key_length
)
{
DBUG_ENTER
(
"THD::add_changed_table(key)"
);
CHANGED_TABLE_LIST
**
prev
=
&
transaction
.
changed_tables
;
CHANGED_TABLE_LIST
*
curr
=
transaction
.
changed_tables
;
for
(;
curr
;
prev
=
&
(
curr
->
next
),
curr
=
curr
->
next
)
{
int
cmp
=
(
long
)
curr
->
key_length
-
(
long
)
table
->
key_length
;
int
cmp
=
(
long
)
curr
->
key_length
-
(
long
)
key_length
;
if
(
cmp
<
0
)
{
list_include
(
prev
,
curr
,
changed_table_dup
(
table
));
list_include
(
prev
,
curr
,
changed_table_dup
(
key
,
key_length
));
DBUG_PRINT
(
"info"
,
(
"key_length %u %u"
,
table
->
key_length
,
(
*
prev
)
->
key_length
));
(
"key_length %u %u"
,
key_length
,
(
*
prev
)
->
key_length
));
DBUG_VOID_RETURN
;
}
else
if
(
cmp
==
0
)
{
cmp
=
memcmp
(
curr
->
key
,
table
->
table_cache_
key
,
curr
->
key_length
);
cmp
=
memcmp
(
curr
->
key
,
key
,
curr
->
key_length
);
if
(
cmp
<
0
)
{
list_include
(
prev
,
curr
,
changed_table_dup
(
table
));
list_include
(
prev
,
curr
,
changed_table_dup
(
key
,
key_length
));
DBUG_PRINT
(
"info"
,
(
"key_length %u %u"
,
table
->
key_length
,
(
"key_length %u %u"
,
key_length
,
(
*
prev
)
->
key_length
));
DBUG_VOID_RETURN
;
}
...
...
@@ -333,22 +338,22 @@ void THD::add_changed_table(TABLE *table)
}
}
}
*
prev
=
changed_table_dup
(
table
);
DBUG_PRINT
(
"info"
,
(
"key_length %u %u"
,
table
->
key_length
,
*
prev
=
changed_table_dup
(
key
,
key_length
);
DBUG_PRINT
(
"info"
,
(
"key_length %u %u"
,
key_length
,
(
*
prev
)
->
key_length
));
DBUG_VOID_RETURN
;
}
CHANGED_TABLE_LIST
*
THD
::
changed_table_dup
(
TABLE
*
table
)
CHANGED_TABLE_LIST
*
THD
::
changed_table_dup
(
const
char
*
key
,
long
key_length
)
{
CHANGED_TABLE_LIST
*
new_table
=
(
CHANGED_TABLE_LIST
*
)
trans_alloc
(
ALIGN_SIZE
(
sizeof
(
CHANGED_TABLE_LIST
))
+
table
->
key_length
+
1
);
key_length
+
1
);
if
(
!
new_table
)
{
my_error
(
EE_OUTOFMEMORY
,
MYF
(
ME_BELL
),
ALIGN_SIZE
(
sizeof
(
TABLE_LIST
))
+
table
->
key_length
+
1
);
ALIGN_SIZE
(
sizeof
(
TABLE_LIST
))
+
key_length
+
1
);
killed
=
1
;
return
0
;
}
...
...
@@ -356,8 +361,8 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(TABLE *table)
new_table
->
key
=
(
char
*
)
(((
byte
*
)
new_table
)
+
ALIGN_SIZE
(
sizeof
(
CHANGED_TABLE_LIST
)));
new_table
->
next
=
0
;
new_table
->
key_length
=
table
->
key_length
;
::
memcpy
(
new_table
->
key
,
table
->
table_cache_key
,
table
->
key_length
);
new_table
->
key_length
=
key_length
;
::
memcpy
(
new_table
->
key
,
key
,
key_length
);
return
new_table
;
}
...
...
sql/sql_class.h
View file @
96ebe381
...
...
@@ -550,7 +550,8 @@ public:
return
alloc_root
(
&
transaction
.
mem_root
,
size
);
}
void
add_changed_table
(
TABLE
*
table
);
CHANGED_TABLE_LIST
*
changed_table_dup
(
TABLE
*
table
);
void
add_changed_table
(
const
char
*
key
,
long
key_length
);
CHANGED_TABLE_LIST
*
changed_table_dup
(
const
char
*
key
,
long
key_length
);
};
/*
...
...
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