KI_VERIFY

Check integrity of a table

Synopsis:
CALL KI_VERIFY handle, level TO status
status = 'ki_verify( handle, level )
ArgumentEnumerationPurpose
handleHandle
levelLevel of verification (1-5)
statusKDB_ERROR_ENUMReturn status
>KI_VERIFY

KI_VERIFY

This call will verify the integrity of the internal structure of the table data and any indices associated with the table. It reads all the data rows, comparing the counts to the controls and verifying that all the keys can be looked up in the index correctly.

Various levels of thoroughness can be specified using the level parameter. All the tests for the lower levels are performed as well as the test for a given level so the higher the level the longer the procedure will take. For most purposes a level 2 or perhaps a level 3 verification will give a confident test of the tables integrity without a significant overhead.

Levelprocedures followed
1 Only controls counts are checked for a super-quick verification. Double entry bookkeeping counts are stored in the tables header. This will catch only gross corruptions but it is very quick.
2 The sequence sets of both the regular and WS indices are checked to be in order and free block chains are followed. Counts of keys and free blocks actually found are compared with the table's controls. This is a reasonable integrity test that will catch most corruptions.
3 The data area of the table is scanned and each row is looked up in each index. For non-unique indexes finding any key that matches is sufficient to avoid performance problems with big duplicate runs (see level 5).
4 For each rowid referenced in an index sequence set, the row is loaded and check to contain the right key segments. This can be slow on a large table and will catch only suble corruptions.
5 This is like level 3 but the rowid of the data row must be found in a list of duplicates. This is a more exaustive test than level three but can be extremely slow on big tables with long runs of duplicates. If there are no indices with duplicates allowed then this is identical to level 3.
6 Check ordering and uniqueness in index blocks.
7 Check that each indexed word in each row can be found using the WS indexes. This is very slow.

Tables can also be verified outside of KCML using the kverify utility

History
Introduced in KCML 3.00
See Also:
KI_CLOSE, KI_CLOSE_TABLE, KI_COPY_TABLE, KI_CREATE, KI_CREATE_TMP, KI_DB_NAME, KI_DELETE_ROWS, KI_DROP_TABLE, KI_EXTEND, KI_GET_HANDLE, KI_GET_SERIAL, KI_GROW, KI_INFO, KI_INITIALISE, KI_LOCK_ALL, KI_LOCK_OWNER, KI_MOVE_ROWS, KI_MOVE_TABLE, KI_OPEN, KI_PREFETCH_ROWS, KI_READ, KI_READ_HOLD, KI_READ_HOLD_NEXT, KI_READ_HOLD_PTR, KI_READ_NEXT, KI_READ_PTR, KI_READ_RAW, KI_REBUILD, KI_RESET_CACHEID, KI_REWRITE, KI_SET_DATESTAMP, KI_SET_EXTENT, KI_SET_ROWS, KI_SET_SERIAL, KI_SET_TIMESTAMP, KI_SET_USERSTAMP, KI_SET_WLOCK_COUNT, KI_SIZE_FILE, KI_START, KI_START_BEG, KI_UNLOCK, KI_UNLOCK_FILE, KI_WMODE_BITMAP, KI_WRITE, KI_WRITE_PTR, KI_WRITE_RAW, KI_WS_CREATE, KI_WS_DELETE, KI_WS_OPEN, KI_WS_READ, KI_WS_REWRITE, KI_WS_WRITE
KCML database status codes