Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbAlterTable

Rebuild existing table based on field, index, and segment changes.

Declaration

CTDBRET ctdbAlterTable(CTHANDLE Handle, NINT Action)

Description

ctdbAlterTable() rebuilds an existing table based on field, index and segment changes.

  • Handle [in] the table handle.
  • Action [in] the alter table action. One or more of the following actions can be selected:
    • CTDB_ALTER_NORMAL: Check for changes before altering.
    • CTDB_ALTER_INDEX: Force rebuild of all indexes.
    • CTDB_ALTER_FULL: Force full table rebuild.
    • CTDB_ALTER_TRUNCATE: Quickly remove all records.
    • CTDB_ALTER_PURGEDUP: OR in with any of the other modes to deal with cases where an alter table is performed on data files with duplicated index information.
    • CTDB_ALTER_KEEPTRAN: Allow tables with different TRANDEP modes (e.g. transaction capable, however, transaction control disabled for performance) to undergo ALTER TABLE. (This is generally an internal FairCom operation for certain table types.)
    • CTDB_ALTER_V8DELFLD: (Supported in V10.3 and later) The table (if re-created) must have the old $DELFLD$ size (CTDB_ALTER_V8DELFLD forces CTCREATE_V8DELFLD during "alter table").
    • CTDB_ALTER_HOT: (Supported in V11.5 and later) A Hot Alter Table will be performed if possible (which requires the file to use the FLEXREC feature and for the changes to the schema to be possible to accomplish using Hot Alter Table). If a Hot Alter Table cannot be performed, ctdbAlterTable() returns error CTDBRET_NOTSUPPORTED.

Unix Note: Due to the non-exclusive nature of Unix, this function can be successfully executed on a file that was opened by several other applications in shared mode. However, although the function succeeds, it may cause havoc for the other applications. This can be prevented by enforcing exclusivity with locks, however, this is not the default mode.

Mirrored Files: The c-treeDB API alter table function will not operate on mirrored tables. If ctdbAlterTable() is called for a mirrored table, nothing is done and it returns error CTDBRET_NOTSUPPORTED.

Existing Indexes: For updating the conditional expression of existing indexes, use ctdbAlterTable() with mode CTDB_ALTER_INDEX.

Returns

ctdbAlterTable() returns CTDBRET_OK if successful, or the c-tree error code on failure.

See also

ctdbCreateTable()

TOCIndex