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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e59ed34a
Commit
e59ed34a
authored
May 27, 2014
by
John Esmet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FT-197 Store cachefiles in OMTs only, remove linked list pointers
parent
a8cacc54
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
188 deletions
+150
-188
ft/cachetable-internal.h
ft/cachetable-internal.h
+1
-5
ft/cachetable.cc
ft/cachetable.cc
+129
-163
ft/tests/cachetable-checkpointer-class.cc
ft/tests/cachetable-checkpointer-class.cc
+20
-20
No files found.
ft/cachetable-internal.h
View file @
e59ed34a
...
...
@@ -178,8 +178,6 @@ class pair_list;
// Maps to a file on disk.
//
struct
cachefile
{
CACHEFILE
next
;
CACHEFILE
prev
;
// these next two fields are protected by cachetable's list lock
// they are managed whenever we add or remove a pair from
// the cachetable. As of Riddler, this linked list is only used to
...
...
@@ -439,14 +437,12 @@ class cachefile_list {
bool
evict_some_stale_pair
(
evictor
*
ev
);
void
free_stale_data
(
evictor
*
ev
);
// access to these fields are protected by the lock
CACHEFILE
m_active_head
;
// head of CACHEFILEs that are active
CACHEFILE
m_stale_head
;
// head of CACHEFILEs that are stale
CACHEFILE
m_stale_tail
;
// tail of CACHEFILEs that are stale
FILENUM
m_next_filenum_to_use
;
uint32_t
m_next_hash_id_to_use
;
toku_pthread_rwlock_t
m_lock
;
// this field is publoc so we are still POD
toku
::
omt
<
CACHEFILE
>
m_active_filenum
;
toku
::
omt
<
CACHEFILE
>
m_active_fileid
;
toku
::
omt
<
CACHEFILE
>
m_stale_fileid
;
private:
CACHEFILE
find_cachefile_in_list_unlocked
(
CACHEFILE
start
,
struct
fileid
*
fileid
);
};
...
...
ft/cachetable.cc
View file @
e59ed34a
This diff is collapsed.
Click to expand it.
ft/tests/cachetable-checkpointer-class.cc
View file @
e59ed34a
...
...
@@ -112,6 +112,14 @@ struct checkpointer_test {
uint32_t
k
);
};
static
void
init_cachefile
(
CACHEFILE
cf
,
int
which_cf
,
bool
for_checkpoint
)
{
memset
(
cf
,
0
,
sizeof
(
*
cf
));
create_dummy_functions
(
cf
);
cf
->
fileid
=
{
0
,
(
unsigned
)
which_cf
};
cf
->
filenum
=
{
(
unsigned
)
which_cf
};
cf
->
for_checkpoint
=
for_checkpoint
;
}
//------------------------------------------------------------------------------
// test_begin_checkpoint() -
//
...
...
@@ -135,33 +143,28 @@ void checkpointer_test::test_begin_checkpoint() {
// 2. Call checkpoint with ONE cachefile.
//cachefile cf;
struct
cachefile
cf
;
cf
.
next
=
NULL
;
cf
.
for_checkpoint
=
false
;
m_cp
.
m_cf_list
->
m_active_head
=
&
cf
;
create_dummy_functions
(
&
cf
);
init_cachefile
(
&
cf
,
0
,
false
);
m_cp
.
m_cf_list
->
add_cf_unlocked
(
&
cf
);
m_cp
.
begin_checkpoint
();
assert
(
m_cp
.
m_checkpoint_num_files
==
1
);
assert
(
cf
.
for_checkpoint
==
true
);
m_cp
.
m_cf_list
->
remove_cf
(
&
cf
);
// 3. Call checkpoint with MANY cachefiles.
const
uint32_t
count
=
3
;
struct
cachefile
cfs
[
count
];
m_cp
.
m_cf_list
->
m_active_head
=
&
cfs
[
0
];
for
(
uint32_t
i
=
0
;
i
<
count
;
++
i
)
{
cfs
[
i
].
for_checkpoint
=
false
;
init_cachefile
(
&
cfs
[
i
],
i
,
false
)
;
create_dummy_functions
(
&
cfs
[
i
]);
if
(
i
==
count
-
1
)
{
cfs
[
i
].
next
=
NULL
;
}
else
{
cfs
[
i
].
next
=
&
cfs
[
i
+
1
];
}
m_cp
.
m_cf_list
->
add_cf_unlocked
(
&
cfs
[
i
]);
}
m_cp
.
begin_checkpoint
();
assert
(
m_cp
.
m_checkpoint_num_files
==
count
);
for
(
uint32_t
i
=
0
;
i
<
count
;
++
i
)
{
assert
(
cfs
[
i
].
for_checkpoint
==
true
);
cfl
.
remove_cf
(
&
cfs
[
i
]);
}
ctbl
.
list
.
destroy
();
m_cp
.
destroy
();
...
...
@@ -195,10 +198,8 @@ void checkpointer_test::test_pending_bits() {
//
struct
cachefile
cf
;
cf
.
cachetable
=
&
ctbl
;
memset
(
&
cf
,
0
,
sizeof
(
cf
));
cf
.
next
=
NULL
;
cf
.
for_checkpoint
=
true
;
m_cp
.
m_cf_list
->
m_active_head
=
&
cf
;
init_cachefile
(
&
cf
,
0
,
true
);
m_cp
.
m_cf_list
->
add_cf_unlocked
(
&
cf
);
create_dummy_functions
(
&
cf
);
CACHEKEY
k
;
...
...
@@ -258,6 +259,7 @@ void checkpointer_test::test_pending_bits() {
ctbl
.
list
.
destroy
();
m_cp
.
destroy
();
cfl
.
remove_cf
(
&
cf
);
cfl
.
destroy
();
}
...
...
@@ -337,14 +339,11 @@ void checkpointer_test::test_end_checkpoint() {
cfl
.
init
();
struct
cachefile
cf
;
memset
(
&
cf
,
0
,
sizeof
(
cf
));
cf
.
next
=
NULL
;
cf
.
for_checkpoint
=
true
;
create_dummy_functions
(
&
cf
);
init_cachefile
(
&
cf
,
0
,
true
);
ZERO_STRUCT
(
m_cp
);
m_cp
.
init
(
&
ctbl
.
list
,
NULL
,
&
ctbl
.
ev
,
&
cfl
);
m_cp
.
m_cf_list
->
m_active_head
=
&
cf
;
m_cp
.
m_cf_list
->
add_cf_unlocked
(
&
cf
)
;
// 2. Add data before running checkpoint.
const
uint32_t
count
=
6
;
...
...
@@ -394,6 +393,7 @@ void checkpointer_test::test_end_checkpoint() {
assert
(
pp
);
m_cp
.
m_list
->
evict_completely
(
pp
);
}
cfl
.
remove_cf
(
&
cf
);
m_cp
.
destroy
();
ctbl
.
list
.
destroy
();
cfl
.
destroy
();
...
...
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