You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Emmanuel Lecharny <el...@gmail.com> on 2011/10/26 18:01:30 UTC

[Txns] Log implementation issues

Hi,

it seems there is an issue in the way he Log is dealing with data 
spanning over multiple files : if the lat buffer is nt written to the 
disk, for instance if we don't flush every time we log, then the inner 
buffer is never written to disk. Scanning the entries will then never 
read the last logs we injected into the logger.

I have added a LogTest test to demonstrate the problem (the test will 
pass, because I have added a assertEquals that won't dail at the end).

We should add a sync() method to the Log interface, allowing a user to 
flush the inner buffer to disk. Currently, the only option is to flush 
when we do a log(), which is not very convenient when writing small 
pieces of data.

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com


Re: [Txns] Log implementation issues

Posted by Selcuk AYA <ay...@gmail.com>.
On Wed, Oct 26, 2011 at 7:01 PM, Emmanuel Lecharny <el...@gmail.com> wrote:
> Hi,
>
> it seems there is an issue in the way he Log is dealing with data spanning
> over multiple files : if the lat buffer is nt written to the disk, for
> instance if we don't flush every time we log, then the inner buffer is never
> written to disk. Scanning the entries will then never read the last logs we
> injected into the logger.

There is no issue. What you say is expected and is not related to
records spanning multiple log files. When you log data and you do not
sync it, that data will stay in the internal in memory buffer until
somebody else syncs the data or the internal buffer fills up.
Currently scanner reads only from the on disk log files. See below.

>
> I have added a LogTest test to demonstrate the problem (the test will pass,
> because I have added a assertEquals that won't dail at the end).
>
> We should add a sync() method to the Log interface, allowing a user to flush
> the inner buffer to disk. Currently, the only option is to flush when we do
> a log(), which is not very convenient when writing small pieces of data.

Currently what you would do in such a case is:

log(small data, false); log(small data, false);.....log(final small data, true);

instead of :

log(small data); log(small data);.....log(final small data), sync().

maybe the second interface is more convenient and I was also thinking
of adding a similar interface but I dont see an issue.
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>