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
51495a54
Commit
51495a54
authored
Sep 26, 2013
by
Zardosht Kasheff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stuff
parent
fbadc9f8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
ft/cachetable-internal.h
ft/cachetable-internal.h
+3
-1
ft/cachetable.cc
ft/cachetable.cc
+17
-6
No files found.
ft/cachetable-internal.h
View file @
51495a54
...
@@ -380,7 +380,9 @@ public:
...
@@ -380,7 +380,9 @@ public:
toku_pthread_rwlock_t
m_pending_lock_cheap
;
toku_pthread_rwlock_t
m_pending_lock_cheap
;
void
init
();
void
init
();
void
destroy
();
void
destroy
();
void
evict
(
PAIR
pair
);
void
evict_completely
(
PAIR
pair
);
void
evict_from_cachetable
(
PAIR
pair
);
void
evict_from_cachefile
(
PAIR
pair
);
void
put
(
PAIR
pair
);
void
put
(
PAIR
pair
);
PAIR
find_pair
(
CACHEFILE
file
,
CACHEKEY
key
,
uint32_t
hash
);
PAIR
find_pair
(
CACHEFILE
file
,
CACHEKEY
key
,
uint32_t
hash
);
void
pending_pairs_remove
(
PAIR
p
);
void
pending_pairs_remove
(
PAIR
p
);
...
...
ft/cachetable.cc
View file @
51495a54
...
@@ -534,12 +534,12 @@ static void pair_touch (PAIR p) {
...
@@ -534,12 +534,12 @@ static void pair_touch (PAIR p) {
p
->
count
=
(
p
->
count
<
CLOCK_SATURATION
)
?
p
->
count
+
1
:
CLOCK_SATURATION
;
p
->
count
=
(
p
->
count
<
CLOCK_SATURATION
)
?
p
->
count
+
1
:
CLOCK_SATURATION
;
}
}
// Remove a pair from the cachetable
// Remove a pair from the cachetable
, requires write list lock to be held and p->mutex to be held
// Effects: the pair is removed from the LRU list and from the cachetable's hash table.
// Effects: the pair is removed from the LRU list and from the cachetable's hash table.
// The size of the objects in the cachetable is adjusted by the size of the pair being
// The size of the objects in the cachetable is adjusted by the size of the pair being
// removed.
// removed.
static
void
cachetable_remove_pair
(
pair_list
*
list
,
evictor
*
ev
,
PAIR
p
)
{
static
void
cachetable_remove_pair
(
pair_list
*
list
,
evictor
*
ev
,
PAIR
p
)
{
list
->
evict
(
p
);
list
->
evict
_completely
(
p
);
ev
->
remove_pair_attr
(
p
->
attr
);
ev
->
remove_pair_attr
(
p
->
attr
);
}
}
...
@@ -3250,20 +3250,31 @@ void pair_list::put(PAIR p) {
...
@@ -3250,20 +3250,31 @@ void pair_list::put(PAIR p) {
m_n_in_table
++
;
m_n_in_table
++
;
}
}
// This removes the given pair from the pair list.
// This removes the given pair from
completely from
the pair list.
//
//
// requires caller to have grabbed write lock on list
.
// requires caller to have grabbed write lock on list
, and p->mutex held
//
//
void
pair_list
::
evict
(
PAIR
p
)
{
void
pair_list
::
evict_completely
(
PAIR
p
)
{
this
->
evict_from_cachetable
(
p
);
this
->
evict_from_cachefile
(
p
);
}
// Removes the PAIR from the cachetable's lists,
// but does NOT impact the list maintained by the cachefile
void
pair_list
::
evict_from_cachetable
(
PAIR
p
)
{
this
->
pair_remove
(
p
);
this
->
pair_remove
(
p
);
this
->
pending_pairs_remove
(
p
);
this
->
pending_pairs_remove
(
p
);
this
->
cf_pairs_remove
(
p
);
this
->
remove_from_hash_chain
(
p
);
this
->
remove_from_hash_chain
(
p
);
assert
(
m_n_in_table
>
0
);
assert
(
m_n_in_table
>
0
);
m_n_in_table
--
;
m_n_in_table
--
;
}
}
// Removes the PAIR from the cachefile's list of PAIRs
void
pair_list
::
evict_from_cachefile
(
PAIR
p
)
{
this
->
cf_pairs_remove
(
p
);
}
//
//
// Remove pair from linked list for cleaner/clock
// Remove pair from linked list for cleaner/clock
//
//
...
...
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