db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Øystein Grøvlen (JIRA) <j...@apache.org>
Subject [jira] Commented: (DERBY-2939) Log file is flushed every time a log buffer gets full
Date Mon, 24 Sep 2007 10:11:50 GMT

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

Øystein Grøvlen commented on DERBY-2939:

Thanks for the patch, Jørgen.  The approach of the patch looks good,
and I have the following review comments:

1. I am wondering whether the code would be simpler if you wrote the
   checksum for the big log record to the big buffer instead of to the
   current buffer.  That is, the big log record will have its separate
   check-sum.  I would think that would make it possible to avoid any
   special handling of this case in switchLogBuffers. 

2. I did not follow why you need to update the checksum of
   currentBuffer in the long-log-record case.  As far as I can tell,
   nothing new has been written to that buffer.

3. The comment says that "The log record is therefore written directly
   to log file instead of to buffer.", but this is not correct anymore
   since now large log records are also written to a buffer.

4. With this code:
       currentBuffer.position = newpos;
       currentBuffer.bytes_free -=total_log_record_length;
   different values are used to update two dependent variables.  I
   think you should consider an assert that checks that
   position+bytes_free equals the size of the buffer.  (Minor nit: A
   missing space after '=' on the second code line shown above)

5. Have you verified that the tests that you have run have ever
   executed the code for large log records?  I am a bit sceptical to
   checking in code that has not been tested.

> 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:,
>            Reporter: Jørgen Løland
>            Assignee: Jørgen Løland
>         Attachments: derby-2939-1.diff, derby-2939-1.stat, derby-2939-2.diff, derby-2939-2.stat
> 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.

View raw message