Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Time limit on flushing updated data and index cache pages for TRNLOG files

An earlier revision introduced threads that flush updated data and index cache pages for non-transaction-controlled files to ensure updates to those files were written to the file system within a configurable time limit. This revision extends this support to TRNLOG files.

The following c-tree Server configuration options set the time limit in seconds that a data cache page or index buffer can remain dirty before it is written to the file system cache. The default time limit is 60 seconds.

TRAN_DATA_FLUSH_SEC <time_limit_in_seconds>

TRAN_INDEX_FLUSH_SEC <time_limit_in_seconds>

  • Specify IMMEDIATE to cause dirty pages to be written immediately.
  • Specify OFF to disable the time limit-based flushing.

(The NONTRAN_DATA_FLUSH_SEC and NONTRAN_INDEX_FLUSH_SEC configuration options still work and apply to the non-tran flush threads.)

These options can be changed using the ctSETCFG() API function and using the ctadmn utility.


This feature causes c-tree Server to create four threads when it starts up. One thread flushes dirty pages for non-transaction data files, one thread flushes dirty buffers for non-transaction index files, one thread flushes dirty pages for TRNLOG data files, and one thread flushes dirty buffers for TRNLOG index files. The threads always exist, even if the feature is disabled.

If the time limit is set to OFF, the threads simply wait for the time limit to change.

When the time limit is enabled, each thread reads its updated page list from oldest to newest entry: we added a tail pointer to the update lists for this purpose; and we added a field to hold the timestamp of the first update to each page. Based on the timestamp of the oldest page and the number of entries in the oldest two counter buckets (if they are being used), we decide how long to defer after each 10 pages that we flush.

When this feature is enabled at compile time, the idle flush thread feature is disabled.

When this feature is enabled at runtime, aging for updated TRNLOG file data cache pages and index buffers is disabled.

Snapshot Changes

In V11 and later, fields have been added to the system snapshot structure (ctGSMS) to hold the background TRNLOG flush settings and statistics. These values are now included in the text snapshot. The ctGSMS structure version has been changed from 17 to 18 to indicate the presence of these fields. These new fields, and the fields that were added for non-tran flush feature, are defined as fields in the bgflss[] array of structures in ctGSMS.

Non-TRNLOG background file flush fields:

type name description

---- ---- -----------

LONG bgflss[BGFLSNT].sctntdlmt time limit for dirty non-transaction data pages

LONG bgflss[BGFLSNT].sctntdmax highwater time for dirty non-transaction data page

LONG bgflss[BGFLSNT].sctntdage current oldest dirty non-transaction data page

LONG8 bgflss[BGFLSNT].sctntdfls number of non-transaction data page flushes

LONG bgflss[BGFLSNT].sctntdbkt non-transaction data page counter buckets (nominal)

LONG bgflss[BGFLSNT].sctntdbkc non-transaction data page counter buckets (current)

LONG bgflss[BGFLSNT].sctntilmt time limit for dirty non-transaction index buffers

LONG bgflss[BGFLSNT].sctntimax highwater time for dirty non-transaction index buffer

LONG bgflss[BGFLSNT].sctntiage current oldest dirty non-transaction index buffer

LONG8 bgflss[BGFLSNT].sctntifls number of non-transaction index buffer flushes

LONG bgflss[BGFLSNT].sctntibkt non-transaction index buffer counter buckets (nominal)

LONG bgflss[BGFLSNT].sctntibkc non-transaction index buffer counter buckets (current)

TRNLOG background file flush fields:

type name description

---- ---- -----------

LONG bgflss[BGFLSTR].sctntdlmt time limit for dirty TRNLOG data pages

LONG bgflss[BGFLSTR].sctntdmax highwater time for dirty TRNLOG data page

LONG bgflss[BGFLSTR].sctntdage current oldest dirty TRNLOG data page

LONG8 bgflss[BGFLSTR].sctntdfls number of TRNLOG data page flushes

LONG bgflss[BGFLSTR].sctntdbkt TRNLOG data page counter buckets (nominal)

LONG bgflss[BGFLSTR].sctntdbkc TRNLOG data page counter buckets (current)

LONG bgflss[BGFLSTR].sctntilmt time limit for dirty TRNLOG index buffers

LONG bgflss[BGFLSTR].sctntimax highwater time for dirty TRNLOG index buffer

LONG bgflss[BGFLSTR].sctntiage current oldest dirty TRNLOG index buffer

LONG8 bgflss[BGFLSTR].sctntifls number of TRNLOG index buffer flushes

LONG bgflss[BGFLSTR].sctntibkt TRNLOG index buffer counter buckets (nominal)

LONG bgflss[BGFLSTR].sctntibkc TRNLOG index buffer counter buckets (current)

A text snapshot includes these values in the SNAPSHOT.FCS file, and the ctsnpr utility has been updated so that it can parse this new SNAPSHOT.FCS file format.

Counter Buckets

These c-tree Server configuration options set the number of counter buckets for the dirty data page and index buffer lists:

TRAN_DATA_FLUSH_BUCKETS <number_of_buckets>

TRAN_INDEX_FLUSH_BUCKETS <number_of_buckets>

The default number of counter buckets is 10. Setting the option to zero disables the use of the counter buckets.

(The NONTRAN_DATA_FLUSH_BUCKETS and NONTRAN_INDEX_FLUSH_BUCKETS configuration options still work and apply to the non-tran flush threads.)

Other Changes

The configuration option DIAGNOSTICS NONTRAN_FLUSH has been changed to DIAGNOSTICS BACKGROUND_FLUSH. This option enables logging of flush thread operations to the file BGFLS.FCS.

The configuration option DIAGNOSTICS NONTRAN_FLUSH_BUCKETS has been changed to DIAGNOSTICS BACKGROUND_FLUSH_BUCKETS. This option enables logging of flush counter bucket statistics to the file BGFLSBKT.FCS. Each time a text snapshot is written to the file SNAPSHOT.FCS, the bucket statistics are written to the file BGFLSBKT.FCS.

TOCIndex