Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Lock Protocol Modification Prevents Spurious FPUTFGET Corruption Errors

Lock protocols used in the FairCom DB FPUTFGET operational model were modified to properly protect all data and index header updates correcting various file corruption errors, typically error 527 (BIDX_ERR) or 69 (BNOD_ERR). In particular, on Unix systems the default locking strategy has been changed from ctLOCK_DIRECT to ctLOCK_EXTENDED (see Data Record Lock Implementations for details).

Additionally, I/O locks were added to Unix library builds as already used by Windows FPUTFGET libraries. This logic can be disabled and existing Unix applications can revert to ctLOCK_DIRECT with NO_ctBEHAV_FPGIOLOK defined in ctopt2.h.

In V11, an extensive FPUTFGET Unix lock protocol review led to important changes. Several existing lockf() system calls were replaced with standard POSIX fcntl() calls allowing direct Unix read locks and avoiding overhead of then required fseek() system calls.

Note: It is strongly recommended to thoroughly test existing Unix FPUTFGET applications with this new library and confirm no unexpected lock compatibility issues have been introduced.

Prior Library Compatibility

To prevent errors and file corruption, it is important to not allow an old FPUTFGET library to operate on files that were created or opened with the new locking strategy.

The FPUTFGET library now turns on a bit in the header of data and index files that it creates on opens. This bit prevents an FPUTFGET library that uses the previous Unix locking strategy from accessing files that use the new strategy. The open of the file will fail with error 744 and the following message will be logged to CTSTATUS.FCS:

Thu Aug 20 16:01:27 2015

FREL_ERR(744) unsupported DEF_MASK bits: 08000000x for file...

Thu Aug 20 16:01:27 2015


Note: A file that has this bit turned on (as a result of the file being created or opened by a new FPUTFGET library) will also cause single-user and client/server operational models prior to this revision to fail to open the file with error 744. The solution for those models is to update them to a version of the code that has this revision applied.

The cttest utility has been modified to show which lock options are in effect. When linked with an FPUTFGET library on Unix that uses the new Unix FPUTFGET locking, cttest shows these options:

ctLOCK_EXTENDED: Using extended offset locking mode.

ctBEHAV_FPGIOLOK: Using new Unix FPUTFGET locking strategy.

When linked with an FPUTFGET library on Unix that does not use the new Unix FPUTFGET locking, cttest shows this option:

ctLOCK_DIRECT: Using direct offset locking mode.