The attached patch is a proto type implementation of Automated backups or
Implicit Log rotation in quickfix. Putting up for feedback and comments.
The basic idea is pretty simple and conventional;
LogRotater thread:
===========
As you might have expected, there is a thread called LogRotater which runs
at the application level scope i.e one for each quickfix engine instance.
And its job is to check the sizes of the log files for each Session. When
the file size reaches a certain limit, it initiates a request for backup.
The LogRotater thread contains a pool of FileLog pointers, which it
sequentially scans in a round robin fashion.
Registration:
========
Sessions are responsible for registering their respective FileLog objects
(if any) to the LogRotater. Registeration is done via the LogRotater::add()
routine. When terminating the Session has to unregister itself via the
LogRotater::remove() routine.
Backup
=====
The backup is performed by simply invoking the FileLog::backup() function,
recently implemented by Oren.
Issues
====
Although both the unit and acceptance tests produce zero (0) failures,
however this is just a proof of concept implementation which may contain
bugs, design flaws and performance bottlenecks. Besides ordinary code
quality, there are alot of things which I have ignored for now, for example
I have not employed the CallStack API. Also at some places instead of
issuing a blocking call to acquire mutex, it would have been more efficient
to use non-blocking attempts to acquire mutexes.
All these issues, plus the additional gotchas which will be uncovered by the
group's feedback would be taken care of in the following version(s) of this
patch.
While reviewing you can ignore anything that comes under #ifdef INS. These
are just debug messages which I was using for my own testing.
ANY types of Comments are graciously welcomed!
thanks,
-- Sibte
|