Product Documentation

V11.5 Update Guide

Previous Topic

Next Topic

Enable ctCHECKLOCK for specified data files at runtime

The FairCom Server now provides the ability to turn on the ctCHECKLOCK file mode at runtime, without having to change the application to specify this option when creating or opening files. A configuration file option and runtime API call can be used to turn ctCHECKLOCK on or off for the specified files.

Configuration Option

CHECKLOCK_FILE

Enables or disables ctCHECKLOCK mode for specified data files. This file mode can be invoked a number of ways. A file can be created with this set or it can be opened with this set. In V11.5 and later, you can use this server keyword to enable it dynamically.

When enabled, the server will block all updates to the file without a write lock, returning an error 57. This allows you to debug situations where two processes might attempt to update the same record in an overlapping manner. This is primarily used in non-transaction files as transaction-controlled files always require a write lock for updates. You can use the wildcard character "*" to specify multiple files.

The following FairCom Server configuration option enables ctCHECKLOCK mode for data files whose name match filespec:

CHECKLOCK_FILE +filespec

  • where filespec is the name of a file, which can include wildcards, as described in c-treeACE Standard Wildcards. filespec needs to match the actual file name including extension.

This option takes effect immediately: all currently open and subsequently opened or created data files whose name match filespec have ctCHECKLOCK enabled.

The following FairCom Server configuration option is used to undo the effect of the CHECKLOCK_FILE +filespec:

CHECKLOCK_FILE -filespec

This option disables the ctCHECKLOCK mode for data files whose name match filespec (which can include wildcards) and whose ctCHECKLOCK option was turned on by the ctCHECKLOCK +filespec.

This option takes effect immediately: all currently open data files whose name match filespec have ctCHECKLOCK disabled, and subsequently opened or created data files whose name match filespec will not have ctCHECKLOCK enabled (unless another CHECKLOCK option has been specified that matches the data file name, or the file mode at file open or create time specifies the ctCHECKLOCK mode).

This feature is also available at runtime via the ctSETCFG() API call.

Default: Off

Runtime Option

The ctSETCFG() API function can be used to turn on or turn off the ctCHECKLOCK file mode at runtime.

For example, to turn on ctCHECKLOCK for the file test.dat (immediately if it is already open, or the next time a file by this name is created or opened), call:

ctSETCFG(setcfgCONFIG_OPTION, "CHECKLOCK_FILE +test.dat");

To turn off ctCHECKLOCK for the file test.dat and prevent ctCHECKLOCK from automatically being turned on for this file the next time it is created or opened, call:

ctSETCFG(setcfgCONFIG_OPTION, "CHECKLOCK_FILE -test.dat");

As with the configuration option, this call to ctSETCFG() can specify a filename with wildcard characters.

Note: A call to ctSETCFG(setcfgCONFIG_OPTION, "CHECKLOCK_FILE -filespec") will return INOT_ERR error 101 if no matching filespec is currently in effect.

Diagnostic Logging of DADV_ERR (error 57)

DIAGNOSTICS DADV_ERR

The configuration option DIAGNOSTICS DADV_ERR can be used to enable logging of a diagnostic message to CTSTATUS.FCS when a DADV_ERR error occurs. The message includes the name of the data file, the record offset at which the update was attempted without holding a lock, the c-tree function number and subfunction number, the caller's user ID, and the caller's node ID. Sample message:

Fri Mar 31 10:17:28 2017

- User# 00022 DADV_ERR: file=qaopnfil.dat offset=18863 func=121(0) userid=ADMIN nodeid=qaopnfil043: 57

This diagnostic logging can be enabled and disabled at runtime.

To enable diagnostic logging:

ctSETCFG(setcfgDIAGNOSTICS, "CHECKLOCK");

To disable diagnostic logging:

ctSETCFG(setcfgDIAGNOSTICS, "~CHECKLOCK");

Using the ctadmn utility to enable or disable diagnostic logging:

10. Change Server Settings

9. Change a DIAGNOSTICS option


Enter the DIAGNOSTICS option to enable or disable >> CHECKLOCK


Successfully changed the DIAGNOSTICS option.

TOCIndex