Previous Topic

Next Topic

Improved File Compaction Behavior for 6-Byte Transaction Enabled Files

Introduction

Prior to V9.1, the compact IFIL and rebuild IFIL API functions (CMPIFILX() and RBLDIFILX()) did not make assumptions about 6-byte transaction numbers for indexes associated with 6-byte transaction enabled files. As a result, regardless of if the data file was 6-byte transaction number enabled, when new indexes were recreated they lost the ct6BTRAN attribute. This caused errors when the server configuration specified 6-byte transaction enabled files only (for example, error R6BT_ERR, 745). It could also lead to transaction number overflow errors (OTRN_ERR, 534) on high volume systems when 4-byte transaction numbers quickly become exhausted.

When the underlying data file contains an extended header, it is more appropriate for the extended rebuild and compact functions to use 6-byte transaction numbers for the associated indices by default. As a result, any data file containing an extended header that is compacted or rebuilt, will now have have the 6-byte transaction number attribute enabled by default.

New CMPIFILX8 API

The CMPIFILX() extended API call does not facilitate an array of XCREblks to be passed in. When the indices associated with the data file to be compacted exist, then compact generally does not need these XCREblk's used when the indices were created. However, if one or more of the indices does not exist, then CMPIFILX() recreated a XCREblk from the data file. But this does not account for differences between the original data file XCREblk and the original index file XCREblk.

An extended header version of CMPIFILX() has been introduced as a step to alleviate this situation.

This new API call declaration is:

ctCONV COUNT ctDECL CMPIFILX8(pIFIL ifilptr, pTEXT dataextn, pTEXT indxextn,LONG permmask, pTEXT groupid, pTEXT fileword, pXCREblk pxcreblk)

Secondly, when either CMPIFILX() or CMPIFILX8() are run on the server (as opposed to stand-alone) and the server configuration option COMPATIBILITY EXTENDED_TRAN_ONLY is specified, then the ct6BTRAN mode bit is turned on in the recreated XCREblk or the explicit XCREblk, respectively, to ensure 6-byte transaction number support.

It should be noted that since CMPIFILX() reconstructs an XCREblk for the index from the data file, there may be attributes of the data file that were not part of the original index file definition. For example, if the data file supported a large extent size, then the index inherits this large extent size regardless of how it was originally created.

If the configuration option, COMPATIBILITY 6BTRAN_NOT_DEFAULT, is specified, the XCREblk array passed into RBLIFILX8() and CMPIFILX8() can still explicitly set the ct6BTRAN attribute bit. Likewise, if ctNO6BTRAN is passed in explicitly in calls to CMPIFILX8() and RBLIFILX8() then the default behavior is overridden, and ct6BTRAN will not be turned on.

Compact File Utility ctcmpcif

#define USEXCREBLK and #define LOCALGETXCREBLK have been added to the compact IFIL utility source code (cmpifil.c, as in ctrbldif.c,) to control definition of the data and index XCREblks using the new CMPIFILX8() API call. This option is off by default. Uncomment this #define should you desire this functionality in the compact IFIL utility.