Cyclic Redundancy Check

A Cyclic Redundancy Check ( CRC32 ) algorithm is used by the eXtremeDB runtime to verify the integrity of persistent database pages, the transaction logs and the saved database images.

(The CRC algorithm can be changed or CRC checking disabled using the C API.)

Currently the default implementation is MCO_RT_CRC32C. On Intel platforms it can be based on the CRC32Q instruction from the SSE4 instruction set. By default however, the hardware version is used only for Intel processors, and only on the 64-bit platform and only with the GCC compiler.

There is a runtime check that the processor really supports this instruction. If not, the software implementation of the CRC32C algorithm is used.

The default CRC32 algorithm can be changed to a different implementation or CRC checking can be disabled by calling mco_runtime_setoption() to set the runtime option MCO_RT_CRC_ALGORITHM (which is set to MCO_RT_CRC32C by default). Less efficient calculation algorithms are available for backward compatibility with older versions of eXtremeDB. (See page Runtime Options for the list of available CRC algorithms.)

For persistent databases each page can be augmented with a 4 byte CRC field (when enabled by MCO_DB_USE_CRC_CHECK or use_crc_check). This will cost space (adds 4 bytes to every page header) and performance (typically +3%) overhead.

For Transaction Logging CRC32 is automatically enabled unless the mode flags MCO_TRANSLOG_PIPE, MCO_TRANSLOG_DYNAMIC_PIPE or MCO_TRANSLOG_DUAL_OUT are specified. However, for any of the pipe modes, CRC can still be enabled by specifying the flag MCO_TRANSLOG_CRC (crc for xSQL).

Database images saved by mco_db_save() and loaded by mco_db_load() employ CRC integrity check unconditionally.

CRC checking cannot be enabled simultaneously with data compression because compression implements its own CRC.