How to read/poll disk_log wrap-logs?

Martin Bjorklund <>
Tue Dec 12 15:48:13 CET 2000


"Adam Aquilon" <> wrote:
> Hi all!
> 
> I'm feeling pretty stupid right now and I would appreciate anyone
> helping me out.
> 
> I've been trying to setup a small reader for a log created as
> a 'disk_log' internal format wrap log (more than one wrap file).
> 
> The behaviour I'm after is a reader that will can run in a separate VM
> from the process(es) writing to the wrap log. In other words, I don't
> want any other communication between the reader and the writers than
> the log files themselves. 
> 
> The reader should open the wrap log in 'read_only' mode and start
> doing sequential reads of the log data from the top. When it hits the
> end of the (circular) log, it should start polling for new data.
> 
> I've tried to create this behaviour using both the disk_log:chunk/2,3
> functions as well as the separate 'wrap_log_reader' module, but none
> of those mechanisms seem to work. When these read functions return
> eof, there seems to be now way of making them follow the "write
> pointer" used by the writing VM, back to the first log file (or in
> some cases even to the next file in the log).

Actually, this looks like a bug.  It looks like it works fine as long
as the new items gets written to the same file, but when wrapping to a
new file, the reader doesn't follow.  It shouldn't be too hard to fix
in disk_log_1.erl.

I don't have time to look into this right now... somebody else??


/martin



More information about the erlang-questions mailing list