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

Jørgen Løland updated DERBY-2939:
---------------------------------

    Attachment: derby-2939-3.diff

Thanks for reviewing the patch, Øystein. Patch 3 addresses your comments:

Re 1: Very good point. This is modified in the current patch. Instead of 
letting writeChecksumLogRecord assume that it should write the checksum to the 
currentBuffer, the byte[] it should be written to is now sent as a parameter. 

Re 4: This code is copied from the old method, but with modified variable names 
and a simple call to a private method. It should therefore be well tested. That 
aside, an assert is still a good
idea, so I added one.

Re 5: I understand your concerns about making mistakes in the logging 
subsystem. I have therefore executed all the junit tests on the patch, but with 
a modified buffer size of only 70
bytes (normally 32kB). Subtracting 37 bytes for the checksum log record, this 
means that almost all log records are too big to fit in a buffer. I have also 
played around with ij with this setting and not found any problems during 
recovery of a database stopped with C-c. Feel free to suggest other ways to 
test this ...

I am currently running derbyall and all suites with normal buffer size. I'll 
report back with the results.

> 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
>         Attachments: derby-2939-1.diff, derby-2939-1.stat, derby-2939-2.diff, 
> derby-2939-2.stat, derby-2939-3.diff
>
>
> 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.

Reply via email to