Two formats of the log files are supported, the internal format and the external format. The internal format supports automatic repair of log files that have not been properly closed, and makes it possible to efficiently read logged items in chunks using a set of functions defined in this module. In fact, this is the only way to read internally formatted logs. The external format leaves it up to the user to read the logged deep byte lists. The disk log module cannot repair externally formatted logs. An item logged to an internally formatted log must not occupy more than 4 GB of disk space (the size must fit in 4 bytes).
For each open disk log there is one process that handles requests
made to the disk log; the disk log process is created when
Items can be logged synchronously by using the functions
When using the internal format for logs, the functions
A collection of open disk logs with the same name running on
different nodes is said to be a a distributed disk log
if requests made to any one of the logs are automatically made to
the other logs as well. The members of such a collection will be
called individual distributed disk logs, or just distributed
disk logs if there is no risk of confusion. There is no order
between the members of such a collection. For instance, logged
terms are not necessarily written onto the node where the
request was made before written onto the other nodes. One could
note here that there are a few functions that do not make
requests to all members of distributed disk logs, namely
It is not guaranteed that all log files of a distributed disk log
contain the same log items; there is no attempt made to synchronize
the contents of the files. However, as long as at least one of
the involved nodes is alive at each time, all items will be logged.
When logging items to a distributed log, or otherwise trying to
change the log, the replies from individual logs are
ignored. If all nodes are down, the disk log functions
reply with a
In some applications it may not be acceptable that replies from individual logs are ignored. An alternative in such situations is to use several local disk logs instead of one distributed disk log, and implement the distribution without use of the disk log module.
Errors are reported differently for asynchronous log attempts
and other uses of the disk log module. When used synchronously
the disk log module replies with an error message, but when called
asynchronously, the disk log module does not know where to send
the error message. Instead owners subscribing to notifications will
receive an
The disk log module itself does not report errors to the
The error message
If an attempt to reopen or truncate a log fails (see
Chunk continuation returned by
The
The
The owners that subscribe to notifications will receive the
message
The
The owners that subscribe to notifications will receive the
message
With a call to
Any process can probe a blocked log with
The
The
The
For a wrap log it is always possible to increase both the size and number of files, as long as the number of files does not exceed 65000. If the maximum number of files is decreased, the change will not be valid until the current file is full and the log wraps to the next file. The redundant files will be removed next time the log wraps around, i.e. starts to log to file number 1.
As an example, assume that the old maximum number of files is 10 and that the new maximum number of files is 6. If the current file number is not greater than the new maximum number of files, the files 7 to 10 will be removed when file number 6 is full and the log starts to write to file number 1 again. Otherwise the files greater than the current file will be removed when the current file is full (e.g. if the current file is 8, the files 9 and 10); the files between new maximum number of files and the current file (i.e. files 7 and 8) will be removed next time file number 6 is full.
If the size of the files is decreased the change will immediately affect the current log. It will not of course change the size of log files already full until next time they are used.
If the log size is decreased for instance to save space,
the function
The
The first time
When
The
The
When
The
The function
If the atom
If the wrap log is not full because all files have not been
used yet,
The disk log process in not terminated as long as there are
owners or users of the log. It should be stressed that each
and every owner must close the log, possibly by terminating,
and that any other process - not only the processes that have
opened the log anonymously - can decrement the
If the log is blocked by the closing process, the log is also unblocked.
Given the error returned by any function in this module,
the function
The
The owners that subscribe to notifications will normally
receive a
The
The following pairs are returned for all logs:
The following pairs are returned for all logs opened in
The following pair is returned for halt logs opened in
The following pairs are returned for wrap logs opened in
Note that the
The function
If there is no log with the given name
on the specified node,
The
The
The owners that subscribe to notifications will be notified
of an error with an
The
The
The owners that subscribe to notifications will be notified
of an error with an
The
The
When a disk log is opened in read-write mode, any existing
log file is checked for. If there is none a new empty
log is created, otherwise the existing file is opened at the
position after the last logged item, and the logging of items
will commence from there. If the format is
The
If a log with a given name is local on some node,
and one tries to open the log distributed on the same node,
then the tuple
It is possible to open a log file more than once by giving
different values to the option
If an attempt to open a log file for the first time fails,
the disk log process terminates with the EXIT message
The
This function is meant to be used for debugging only.
The
The
The owners that subscribe to notifications will receive
a
Upon failure to reopen the log, the disk log process terminates
with the EXIT message
The
The
The
The owners that subscribe to notifications will receive
a
If the attempt to truncate the log fails, the disk log process
terminates with the EXIT message
The