Introducing the Power and Flexibility of ISAM REV 6
By John Brunett, Senior Software Engineer
One of the highlights of Synergy/DE version 10 is a new revision of ISAM files. REV 6 ISAM comes with several new features, as well as plenty of room for growth before a future revision upgrade is required.
REV 6 includes a new on-disk file structure that’s optimized for the new “Advanced Format” large sector drives being sold today. All index blocks are now aligned to 4K by default. (As a result, to make room for the new 8K header and 4K default PAGE size, you can expect empty ISAM files to take a slightly larger disk footprint.)
Along with the new file structure, a few other features are well worth mentioning. One is a new key type called an autokey. An autokey is a key declared in a file’s record that is automatically filled-in by the Synergy DBMS. In Version 10.1, two types of autokeys are supported: a sequence autokey and a timestamp autokey. The sequence autokey is simply an i8 counter that increments each time a new record is stored. The timestamp autokey is an i8 datetime (in microseconds) that is set to the current time when a record is stored and again when the record is updated. Using the %DATETIME_FROM_I8 routine, you can convert the i8 datetime value to a string similar to that returned by %DATETIME. Both of these autokeys are guaranteed to be unique in a file.
Another exciting new feature is change tracking, which allows you to transparently keep track of all changes made to a file. After enabling change tracking on a file, you can replicate to a central database changes made between two points in time (snapshots), roll back changes made on a failed posting run, or access records exactly as they were at a single point in time. How you actually use change tracking is up to you, but the possibilities are endless. More details on change tracking will appear in a future article.
If you’re using GRFAs (which were released in version 9.3), you might be interested in the new Stored GRFA feature. GRFAs can be used to implement optimistic locking. One of the caveats discovered with this technique is that the extra overhead required to generate the GRFA can have a negative effect on performance. Our new SGRFA file option, however, moves that overhead to the STORE and WRITE operations, which occur far less often than the READ/READS operations, thus resulting in better performance.
Also new with REV 6 is the ability to store text to a file’s header and then programmatically retrieve it later. What text you store is entirely up to you. You might store a name to identify a particular file, your file’s version string, a string that identifies field types and offsets, or an entire XML document describing your file. Then, using %ISINFOA (FILTXT), you can retrieve that information whenever you need it. Initially, with Synergy version 10.1.1, you must define your file text upon file creation, and the text is read-only. In a future release, you will be able to modify the file text at any time.
To prepare for the future, the maximum TBYTE file size in a REV 6 file has been increased from 1Tb to 256Tb. Also, there are several new defaults for REV 6 files: static RFA is now default and is required for all files, the default PAGE size has been increased from 1024 to 4096, and files configured with change tracking also include the TBYTE (addressing=48) file attribute.
Patching and converting a prior-revision file to REV 6 are slightly different than in previous releases. The isutl utility is now used in both cases. Using isutl -p, small files are automatically converted, but larger files that will take longer to convert are only patched. When patched, a file becomes an intermediate REV 6 file (designated 4r6 or 5r6 when viewed from ipar). This intermediate revision is much like the REV 5 revision, which was the result of patching old revision 2 and 3 files. However, an intermediate REV 6 file is automatically converted to a full Revision 6 file the next time it is cleared or rebuilt using isutl. Also, you can choose to override the patch or convert decision by explicitly specifying the isutl -qfile=[no]convert option.
To facilitate future growth, a Revision 6 file now contains a compatibility level. As new file features are added that change a file’s structure, using one of these features in a file will appropriately elevate the compatibility level for that file such that an older Synergy version will not be allowed access (although it will still have access to files without that feature). This enables us to add new features that require structure changes without requiring a new file revision to be introduced.