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
499645d4
Commit
499645d4
authored
Oct 06, 2013
by
Zardosht Kasheff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs #84, remove some shared variables from logger
parent
8793bdfa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
30 deletions
+0
-30
ft/log-internal.h
ft/log-internal.h
+0
-3
ft/logger.cc
ft/logger.cc
+0
-24
ft/logger.h
ft/logger.h
+0
-3
No files found.
ft/log-internal.h
View file @
499645d4
...
@@ -174,9 +174,6 @@ struct tokulogger {
...
@@ -174,9 +174,6 @@ struct tokulogger {
uint32_t
write_block_size
;
// How big should the blocks be written to various logs?
uint32_t
write_block_size
;
// How big should the blocks be written to various logs?
uint64_t
input_lock_ctr
;
// how many times has input_lock been taken and released
uint64_t
output_condition_lock_ctr
;
// how many times has output_condition_lock been taken and released
uint64_t
swap_ctr
;
// how many times have input/output log buffers been swapped
uint64_t
num_writes_to_disk
;
// how many times did we write to disk?
uint64_t
num_writes_to_disk
;
// how many times did we write to disk?
uint64_t
bytes_written_to_disk
;
// how many bytes have been written to disk?
uint64_t
bytes_written_to_disk
;
// how many bytes have been written to disk?
tokutime_t
time_spent_writing_to_disk
;
// how much tokutime did we spend writing to disk?
tokutime_t
time_spent_writing_to_disk
;
// how much tokutime did we spend writing to disk?
...
...
ft/logger.cc
View file @
499645d4
...
@@ -193,9 +193,6 @@ int toku_logger_create (TOKULOGGER *resultp) {
...
@@ -193,9 +193,6 @@ int toku_logger_create (TOKULOGGER *resultp) {
ml_init
(
&
result
->
input_lock
);
ml_init
(
&
result
->
input_lock
);
toku_mutex_init
(
&
result
->
output_condition_lock
,
NULL
);
toku_mutex_init
(
&
result
->
output_condition_lock
,
NULL
);
toku_cond_init
(
&
result
->
output_condition
,
NULL
);
toku_cond_init
(
&
result
->
output_condition
,
NULL
);
result
->
input_lock_ctr
=
0
;
result
->
output_condition_lock_ctr
=
0
;
result
->
swap_ctr
=
0
;
result
->
rollback_cachefile
=
NULL
;
result
->
rollback_cachefile
=
NULL
;
result
->
output_is_available
=
true
;
result
->
output_is_available
=
true
;
toku_txn_manager_init
(
&
result
->
txn_manager
);
toku_txn_manager_init
(
&
result
->
txn_manager
);
...
@@ -351,7 +348,6 @@ int toku_logger_close(TOKULOGGER *loggerp) {
...
@@ -351,7 +348,6 @@ int toku_logger_close(TOKULOGGER *loggerp) {
goto
is_closed
;
goto
is_closed
;
}
}
ml_lock
(
&
logger
->
input_lock
);
ml_lock
(
&
logger
->
input_lock
);
logger
->
input_lock_ctr
++
;
LSN
fsynced_lsn
;
LSN
fsynced_lsn
;
grab_output
(
logger
,
&
fsynced_lsn
);
grab_output
(
logger
,
&
fsynced_lsn
);
logger_write_buffer
(
logger
,
&
fsynced_lsn
);
logger_write_buffer
(
logger
,
&
fsynced_lsn
);
...
@@ -438,13 +434,11 @@ grab_output(TOKULOGGER logger, LSN *fsynced_lsn)
...
@@ -438,13 +434,11 @@ grab_output(TOKULOGGER logger, LSN *fsynced_lsn)
// Exit: Hold permission to modify output (but none of the locks).
// Exit: Hold permission to modify output (but none of the locks).
{
{
toku_mutex_lock
(
&
logger
->
output_condition_lock
);
toku_mutex_lock
(
&
logger
->
output_condition_lock
);
logger
->
output_condition_lock_ctr
++
;
wait_till_output_available
(
logger
);
wait_till_output_available
(
logger
);
logger
->
output_is_available
=
false
;
logger
->
output_is_available
=
false
;
if
(
fsynced_lsn
)
{
if
(
fsynced_lsn
)
{
*
fsynced_lsn
=
logger
->
fsynced_lsn
;
*
fsynced_lsn
=
logger
->
fsynced_lsn
;
}
}
logger
->
output_condition_lock_ctr
++
;
toku_mutex_unlock
(
&
logger
->
output_condition_lock
);
toku_mutex_unlock
(
&
logger
->
output_condition_lock
);
}
}
...
@@ -459,7 +453,6 @@ wait_till_output_already_written_or_output_buffer_available (TOKULOGGER logger,
...
@@ -459,7 +453,6 @@ wait_till_output_already_written_or_output_buffer_available (TOKULOGGER logger,
{
{
bool
result
;
bool
result
;
toku_mutex_lock
(
&
logger
->
output_condition_lock
);
toku_mutex_lock
(
&
logger
->
output_condition_lock
);
logger
->
output_condition_lock_ctr
++
;
while
(
1
)
{
while
(
1
)
{
if
(
logger
->
fsynced_lsn
.
lsn
>=
lsn
.
lsn
)
{
// we can look at the fsynced lsn since we have the lock.
if
(
logger
->
fsynced_lsn
.
lsn
>=
lsn
.
lsn
)
{
// we can look at the fsynced lsn since we have the lock.
result
=
true
;
result
=
true
;
...
@@ -474,7 +467,6 @@ wait_till_output_already_written_or_output_buffer_available (TOKULOGGER logger,
...
@@ -474,7 +467,6 @@ wait_till_output_already_written_or_output_buffer_available (TOKULOGGER logger,
toku_cond_wait
(
&
logger
->
output_condition
,
&
logger
->
output_condition_lock
);
toku_cond_wait
(
&
logger
->
output_condition
,
&
logger
->
output_condition_lock
);
}
}
*
fsynced_lsn
=
logger
->
fsynced_lsn
;
*
fsynced_lsn
=
logger
->
fsynced_lsn
;
logger
->
output_condition_lock_ctr
++
;
toku_mutex_unlock
(
&
logger
->
output_condition_lock
);
toku_mutex_unlock
(
&
logger
->
output_condition_lock
);
return
result
;
return
result
;
}
}
...
@@ -486,13 +478,11 @@ release_output (TOKULOGGER logger, LSN fsynced_lsn)
...
@@ -486,13 +478,11 @@ release_output (TOKULOGGER logger, LSN fsynced_lsn)
// Exit: Holds neither locks nor output permission.
// Exit: Holds neither locks nor output permission.
{
{
toku_mutex_lock
(
&
logger
->
output_condition_lock
);
toku_mutex_lock
(
&
logger
->
output_condition_lock
);
logger
->
output_condition_lock_ctr
++
;
logger
->
output_is_available
=
true
;
logger
->
output_is_available
=
true
;
if
(
logger
->
fsynced_lsn
.
lsn
<
fsynced_lsn
.
lsn
)
{
if
(
logger
->
fsynced_lsn
.
lsn
<
fsynced_lsn
.
lsn
)
{
logger
->
fsynced_lsn
=
fsynced_lsn
;
logger
->
fsynced_lsn
=
fsynced_lsn
;
}
}
toku_cond_broadcast
(
&
logger
->
output_condition
);
toku_cond_broadcast
(
&
logger
->
output_condition
);
logger
->
output_condition_lock_ctr
++
;
toku_mutex_unlock
(
&
logger
->
output_condition_lock
);
toku_mutex_unlock
(
&
logger
->
output_condition_lock
);
}
}
...
@@ -505,7 +495,6 @@ swap_inbuf_outbuf (TOKULOGGER logger)
...
@@ -505,7 +495,6 @@ swap_inbuf_outbuf (TOKULOGGER logger)
logger
->
inbuf
=
logger
->
outbuf
;
logger
->
inbuf
=
logger
->
outbuf
;
logger
->
outbuf
=
tmp
;
logger
->
outbuf
=
tmp
;
assert
(
logger
->
inbuf
.
n_in_buf
==
0
);
assert
(
logger
->
inbuf
.
n_in_buf
==
0
);
logger
->
swap_ctr
++
;
}
}
static
void
static
void
...
@@ -550,13 +539,11 @@ toku_logger_make_space_in_inbuf (TOKULOGGER logger, int n_bytes_needed)
...
@@ -550,13 +539,11 @@ toku_logger_make_space_in_inbuf (TOKULOGGER logger, int n_bytes_needed)
if
(
logger
->
inbuf
.
n_in_buf
+
n_bytes_needed
<=
LOGGER_MIN_BUF_SIZE
)
{
if
(
logger
->
inbuf
.
n_in_buf
+
n_bytes_needed
<=
LOGGER_MIN_BUF_SIZE
)
{
return
;
return
;
}
}
logger
->
input_lock_ctr
++
;
ml_unlock
(
&
logger
->
input_lock
);
ml_unlock
(
&
logger
->
input_lock
);
LSN
fsynced_lsn
;
LSN
fsynced_lsn
;
grab_output
(
logger
,
&
fsynced_lsn
);
grab_output
(
logger
,
&
fsynced_lsn
);
ml_lock
(
&
logger
->
input_lock
);
ml_lock
(
&
logger
->
input_lock
);
logger
->
input_lock_ctr
++
;
// Some other thread may have written the log out while we didn't have the lock. If we have space now, then be happy.
// Some other thread may have written the log out while we didn't have the lock. If we have space now, then be happy.
if
(
logger
->
inbuf
.
n_in_buf
+
n_bytes_needed
<=
LOGGER_MIN_BUF_SIZE
)
{
if
(
logger
->
inbuf
.
n_in_buf
+
n_bytes_needed
<=
LOGGER_MIN_BUF_SIZE
)
{
release_output
(
logger
,
fsynced_lsn
);
release_output
(
logger
,
fsynced_lsn
);
...
@@ -824,7 +811,6 @@ void toku_logger_maybe_fsync(TOKULOGGER logger, LSN lsn, int do_fsync, bool hold
...
@@ -824,7 +811,6 @@ void toku_logger_maybe_fsync(TOKULOGGER logger, LSN lsn, int do_fsync, bool hold
// The input lock may be released and then reacquired. Thus this function does not run atomically with respect to other threads.
// The input lock may be released and then reacquired. Thus this function does not run atomically with respect to other threads.
{
{
if
(
holds_input_lock
)
{
if
(
holds_input_lock
)
{
logger
->
input_lock_ctr
++
;
ml_unlock
(
&
logger
->
input_lock
);
ml_unlock
(
&
logger
->
input_lock
);
}
}
if
(
do_fsync
)
{
if
(
do_fsync
)
{
...
@@ -838,11 +824,9 @@ void toku_logger_maybe_fsync(TOKULOGGER logger, LSN lsn, int do_fsync, bool hold
...
@@ -838,11 +824,9 @@ void toku_logger_maybe_fsync(TOKULOGGER logger, LSN lsn, int do_fsync, bool hold
// otherwise we now own the output permission, and our lsn isn't outputed.
// otherwise we now own the output permission, and our lsn isn't outputed.
ml_lock
(
&
logger
->
input_lock
);
ml_lock
(
&
logger
->
input_lock
);
logger
->
input_lock_ctr
++
;
swap_inbuf_outbuf
(
logger
);
swap_inbuf_outbuf
(
logger
);
logger
->
input_lock_ctr
++
;
ml_unlock
(
&
logger
->
input_lock
);
// release the input lock now, so other threads can fill the inbuf. (Thus enabling group commit.)
ml_unlock
(
&
logger
->
input_lock
);
// release the input lock now, so other threads can fill the inbuf. (Thus enabling group commit.)
write_outbuf_to_logfile
(
logger
,
&
fsynced_lsn
);
write_outbuf_to_logfile
(
logger
,
&
fsynced_lsn
);
...
@@ -868,7 +852,6 @@ logger_write_buffer(TOKULOGGER logger, LSN *fsynced_lsn)
...
@@ -868,7 +852,6 @@ logger_write_buffer(TOKULOGGER logger, LSN *fsynced_lsn)
// Note: Only called during single-threaded activity from toku_logger_restart, so locks aren't really needed.
// Note: Only called during single-threaded activity from toku_logger_restart, so locks aren't really needed.
{
{
swap_inbuf_outbuf
(
logger
);
swap_inbuf_outbuf
(
logger
);
logger
->
input_lock_ctr
++
;
ml_unlock
(
&
logger
->
input_lock
);
ml_unlock
(
&
logger
->
input_lock
);
write_outbuf_to_logfile
(
logger
,
fsynced_lsn
);
write_outbuf_to_logfile
(
logger
,
fsynced_lsn
);
if
(
logger
->
write_log_files
)
{
if
(
logger
->
write_log_files
)
{
...
@@ -886,7 +869,6 @@ int toku_logger_restart(TOKULOGGER logger, LSN lastlsn)
...
@@ -886,7 +869,6 @@ int toku_logger_restart(TOKULOGGER logger, LSN lastlsn)
LSN
fsynced_lsn
;
LSN
fsynced_lsn
;
grab_output
(
logger
,
&
fsynced_lsn
);
grab_output
(
logger
,
&
fsynced_lsn
);
ml_lock
(
&
logger
->
input_lock
);
ml_lock
(
&
logger
->
input_lock
);
logger
->
input_lock_ctr
++
;
logger_write_buffer
(
logger
,
&
fsynced_lsn
);
logger_write_buffer
(
logger
,
&
fsynced_lsn
);
// close the log file
// close the log file
...
@@ -1411,9 +1393,6 @@ status_init(void) {
...
@@ -1411,9 +1393,6 @@ status_init(void) {
// Note, this function initializes the keyname, type, and legend fields.
// Note, this function initializes the keyname, type, and legend fields.
// Value fields are initialized to zero by compiler.
// Value fields are initialized to zero by compiler.
STATUS_INIT
(
LOGGER_NEXT_LSN
,
nullptr
,
UINT64
,
"next LSN"
,
TOKU_ENGINE_STATUS
);
STATUS_INIT
(
LOGGER_NEXT_LSN
,
nullptr
,
UINT64
,
"next LSN"
,
TOKU_ENGINE_STATUS
);
STATUS_INIT
(
LOGGER_ILOCK_CTR
,
nullptr
,
UINT64
,
"ilock count"
,
TOKU_ENGINE_STATUS
);
STATUS_INIT
(
LOGGER_OLOCK_CTR
,
nullptr
,
UINT64
,
"olock count"
,
TOKU_ENGINE_STATUS
);
STATUS_INIT
(
LOGGER_SWAP_CTR
,
nullptr
,
UINT64
,
"swap count"
,
TOKU_ENGINE_STATUS
);
STATUS_INIT
(
LOGGER_NUM_WRITES
,
LOGGER_WRITES
,
UINT64
,
"writes"
,
TOKU_ENGINE_STATUS
|
TOKU_GLOBAL_STATUS
);
STATUS_INIT
(
LOGGER_NUM_WRITES
,
LOGGER_WRITES
,
UINT64
,
"writes"
,
TOKU_ENGINE_STATUS
|
TOKU_GLOBAL_STATUS
);
STATUS_INIT
(
LOGGER_BYTES_WRITTEN
,
LOGGER_WRITES_BYTES
,
UINT64
,
"writes (bytes)"
,
TOKU_ENGINE_STATUS
|
TOKU_GLOBAL_STATUS
);
STATUS_INIT
(
LOGGER_BYTES_WRITTEN
,
LOGGER_WRITES_BYTES
,
UINT64
,
"writes (bytes)"
,
TOKU_ENGINE_STATUS
|
TOKU_GLOBAL_STATUS
);
STATUS_INIT
(
LOGGER_UNCOMPRESSED_BYTES_WRITTEN
,
LOGGER_WRITES_UNCOMPRESSED_BYTES
,
UINT64
,
"writes (uncompressed bytes)"
,
TOKU_ENGINE_STATUS
|
TOKU_GLOBAL_STATUS
);
STATUS_INIT
(
LOGGER_UNCOMPRESSED_BYTES_WRITTEN
,
LOGGER_WRITES_UNCOMPRESSED_BYTES
,
UINT64
,
"writes (uncompressed bytes)"
,
TOKU_ENGINE_STATUS
|
TOKU_GLOBAL_STATUS
);
...
@@ -1430,9 +1409,6 @@ toku_logger_get_status(TOKULOGGER logger, LOGGER_STATUS statp) {
...
@@ -1430,9 +1409,6 @@ toku_logger_get_status(TOKULOGGER logger, LOGGER_STATUS statp) {
status_init
();
status_init
();
if
(
logger
)
{
if
(
logger
)
{
STATUS_VALUE
(
LOGGER_NEXT_LSN
)
=
logger
->
lsn
.
lsn
;
STATUS_VALUE
(
LOGGER_NEXT_LSN
)
=
logger
->
lsn
.
lsn
;
STATUS_VALUE
(
LOGGER_ILOCK_CTR
)
=
logger
->
input_lock_ctr
;
STATUS_VALUE
(
LOGGER_OLOCK_CTR
)
=
logger
->
output_condition_lock_ctr
;
STATUS_VALUE
(
LOGGER_SWAP_CTR
)
=
logger
->
swap_ctr
;
STATUS_VALUE
(
LOGGER_NUM_WRITES
)
=
logger
->
num_writes_to_disk
;
STATUS_VALUE
(
LOGGER_NUM_WRITES
)
=
logger
->
num_writes_to_disk
;
STATUS_VALUE
(
LOGGER_BYTES_WRITTEN
)
=
logger
->
bytes_written_to_disk
;
STATUS_VALUE
(
LOGGER_BYTES_WRITTEN
)
=
logger
->
bytes_written_to_disk
;
// No compression on logfiles so the uncompressed size is just number of bytes written
// No compression on logfiles so the uncompressed size is just number of bytes written
...
...
ft/logger.h
View file @
499645d4
...
@@ -240,9 +240,6 @@ void toku_logger_maybe_fsync (TOKULOGGER logger, LSN lsn, int do_fsync, bool hol
...
@@ -240,9 +240,6 @@ void toku_logger_maybe_fsync (TOKULOGGER logger, LSN lsn, int do_fsync, bool hol
typedef
enum
{
typedef
enum
{
LOGGER_NEXT_LSN
=
0
,
LOGGER_NEXT_LSN
=
0
,
LOGGER_ILOCK_CTR
,
LOGGER_OLOCK_CTR
,
LOGGER_SWAP_CTR
,
LOGGER_NUM_WRITES
,
LOGGER_NUM_WRITES
,
LOGGER_BYTES_WRITTEN
,
LOGGER_BYTES_WRITTEN
,
LOGGER_UNCOMPRESSED_BYTES_WRITTEN
,
LOGGER_UNCOMPRESSED_BYTES_WRITTEN
,
...
...
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