db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jørgen Løland (JIRA) <j...@apache.org>
Subject [jira] Commented: (DERBY-2939) Log file is flushed every time a log buffer gets full
Date Thu, 20 Sep 2007 12:48:31 GMT

    [ https://issues.apache.org/jira/browse/DERBY-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12529097
] 

Jørgen Løland commented on DERBY-2939:
--------------------------------------

Seems that this is an issue of poor documentation rather than a bug. The assumption that the
log record is too big to fit in any LogAccessFileBuffer is correct because the method LogAccessFile.reserveSpaceForChecksum
is always called from LogToFile#appendLogRecord before LogAccessFile.writeLogRecord is called.
reserveSpace... allocates a fresh LogAccessFileBuffer if the LogRecord is too big to fit in
the current one. 

However, there are two remaining issues with LogAccessFile#writeLogRecord that I would like
to address:

1. Document the not too obvious behavior described above.
2. Change what happens when a log record is too big to fit into any of the allocated LogAccessFileBuffers
the following way:
 
* Current strategy: 
------------------------
flushDirtyBuffers (1 disk write for every dirty buffer)
4x disk writes to put the very big log record to disk

* New strategy
-----------------------
flushDirtyBuffers (as above)
allocate a big enough buffer
put the log record into the new buffer
1x disk write to put the giant log record to disk
remove the newly created buffer

Hence, I want to swap 3 disk write operations with main memory operations, which should be
much faster. Note that the writeLogRecord method is called from a synchronized context in
LogToFile. Thus, the 4 current disk writes are blocking all other transactions that try to
append log.

> Log file is flushed every time a log buffer gets full
> -----------------------------------------------------
>
>                 Key: DERBY-2939
>                 URL: https://issues.apache.org/jira/browse/DERBY-2939
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>
> LogAccessFile consists of a number of log buffers: LinkedList<LogAccessFileBuffer>
freeBuffers and dirtyBuffers, and LogAccessFileBuffer currentBuffer.
> When a log record is written to log, writeLogRecord wrongly assumes that the log record
is too big to fit in any log buffer if there is not enough free space in the current log buffer.
The code:
> if (total_log_record_length <= currentBuffer.bytes_free) {
> <append log record to current buffer>
> ...
> } else {
> <log record too big to fit in any buffer>
> ...
> }
> should be modified to:
> if (total_log_record_length <= currentBuffer.bytes_free) {
> <append log record to current buffer>
> ...
> } else if (total_log_record_length <= currentBuffer.length) {
> <swap log buffer>
> <append log record to new current buffer>
> ...
> } else {
> <log record too big to fit in any buffer>
> ...
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message