[Prev: LOCKFILE] | [Next: LOCKTRIES] |
M2H_LOCKMETHOD=
method
<LOCKMETHOD>
method
</LOCKMETHOD>
-lockmethod
method
LOCKMETHOD determines how MHonArc should lock archives to protect multiple MHonArc processes modifying an archive at the same time. If after reading this page you still are unsure on what method to use, or do not understand some of the material, then just stick with the default value.
The following is a list of possible values for LOCKMETHOD:
MHonArc uses a directory file in the archive directory to lock an archive. When MHonArc is to access/modify an archive, it will first try to create a directory in the archive directory with a name determined by the LOCKFILE resource. MHonArc will try LOCKTRIES times to create the directory (obtains the lock) before timing out.
MHonArc will use Perl's flock() operator. LOCKFILE will be created in the archive directory if does not already exist. Then MHonArc will try to LOCKTRIES times to obtain an exclusive lock on the file via flock() before timing out.
WARNING | Each locking method is incompatible with each other. Therefore, make sure the same method is specified for all MHonArc processes that will be accessing a given archive. If you want to change the default lock method so it will affect all MHonArc processes, you can set it via the default resource file or through mhasiteinit.pl. See Post Installation Configuration for more information. |
The following sub-sections give more information of each lock method, including the pros and cons of each, and assumes you have some knowledge about file systems.
The directory file method is the default method used by MHonArc, and is the method used by past version of MHonArc. If you are familiar with locking methods used by other software, you may find it strange that a directory (which is just a special kind of file) is used instead of a plain file. The reason a directory is used is that it has unique properties over regular files on the various operating systems MHonArc runs on. The property that MHonArc takes advantage of is that you cannot create a new directory over an existing directory of the same name. This property is not guaranteed for plain files, or at least Perl cannot give a common interface for plain files to work on all platforms. It may be possible to use a plain file with Perl's sysopen() operator with the proper options, but the needed sysopen() options are not guaranteed to be available for all ports of Perl.
Appears to work for all known platforms.
If MHonArc/Perl abnormally terminates, MHonArc may not have the chance to delete the directory, failing to release the lock on the archive (a stale lock). This will cause other MHonArc processes to fail out with "Unable to lock ..." messages. To correct, manual deletion of the directory is required (or FORCE must be used).
Using flock() is a common method for locking files under Unix-type operating systems. In order to use flock() method, the Symbol and Fcntl Perl modules must be available. If not available, and this method is specified, MHonArc will fallback to the directory file method.
Unlike the directory method, it is okay if LOCKFILE stays around, and actually, it should never be manual deleted.
Lock is automatically released if MHonArc/Perl abnormally terminates, eliminating the stale lock problem.
Not availabe on all platforms.
May not work over NFS reliably. Read the documentation for flock() in the Perl documentation for more information.
directory
NOTE | The use of <LOCKMETHOD> within an RCFILE will take affect ONLY if used in the DEFRCFILE. |
WARNING | Each locking method is incompatible with each other. Therefore, make sure the same method is specified for all MHonArc processes that will be accessing a given archive. If you want to change the default lock method so it will affect all MHonArc processes, you can set it via the default resource file or through mhasiteinit.pl. See Post Installation Configuration for more information. |
N/A
None.
2.4.0
FORCE, LOCK, LOCKDELAY, LOCKFILE, LOCKTRIES
[Prev: LOCKFILE] | [Next: LOCKTRIES] |