Database Open Parameters (mco_db_params_t)

The runtime settings for a database opened by mco_db_open_dev() are defined in the mco_db_params_t structure. (For common configuration examples, see the guides for in-memory or persistent databases.)

The mco_db_params_t structure is defined in mco.h as follows:


    typedef struct mco_db_params_t_ {
        mco_uint2            mark;                    /* Initialized by mco_db_params_init() */
        mco_uint2            mem_page_size;           /* Memory page size */
        mco_uint4            disk_page_size;          /* Disk page size (0 for in-memory DB) */
        mco_uint4            db_max_connections;      /* Maximum number of connections */
        mco_offs_t           disk_max_database_size;  /* Max size of persistent database */
        mco_offs_t           file_extension_quantum;  /* File extension quantum to reduce fragmentation */
        MCO_LOG_TYPE         db_log_type;             /* Database logging method */
        mco_uint2            connection_context_size; /* Recovery connection context size */
        mco_uint2            hash_load_factor;        /* Hash table load factor (%) */
        mco_uint2            index_optimistic_lock_threshold; /* Max write transactions for B-Tree optimistic locking */
        mco_log_params_t     log_params;              /* Initial log settings */
        int                  mode_mask;               /* Open mode mask */
        int                  min_conn_local_pages;    /* Min pages in per-connection allocator */
        int                  max_conn_local_pages;    /* Max pages in per-connection allocator */
        int                  allocation_bitmap_caching_priority; /* Priority for allocator bitmap pages */
        int                  index_caching_priority;  /* Priority for index pages */
        int                  object_caching_priority; /* Priority for object (non-BLOB) pages */
        struct mco_ddl_dictionary_t_* ddl_dict;
        mco_size_t           ddl_dict_size;
        int                  ddl_dict_flags;
        const char*          cipher_key;              /* Database encryption key */
        const char*          cipher_key_snapshot_tl;  /* Encryption key for snapshots/TL */
        mco_bool             dynamic_hash;            /* Enable dynamic hash table extension */
        const char*          license_key;             /* eXtremeDB license key */
        int                  max_classes;             /* Space reserved for classes (for dynamic schema) */
        int                  max_indexes;             /* Space reserved for indexes (for dynamic schema) */
        mco_size_t           autocompact_threshold;   /* Object size threshold for auto-compaction */
        MCO_TRANS_SCHED_POLICY trans_sched_policy;    /* Transaction scheduling policy */
        mco_uint8            max_trans_time;          /* Max transaction time (0 to disable) */
        mco_uint8            max_ttl_objects;         /* Max objects removed by TTL per transaction */
        mco_bool             ignore_ttl;              /* Ignore all TTL policies */
        int                  max_gc_versions;         /* Max old versions reclaimed by GC */
        int                  max_active_pages;        /* Max pages accessed by a connection */
        int                  page_hash_bundles;       /* Bundles in page hash for encryption/compression */
        int                  compression_level;       /* Compression level (-1..9) */
        int                  compression_mask;        /* Bitmap of page kinds to compress */
        int                  expected_compression_ratio; /* Expected compression ratio for page map allocation */
        mco_uint1            btree_cursor_read_ahead_size; /* B-Tree cursor read-ahead size */
        int                  mvcc_bitmap_size;        /* MVCC bitmap size (power of two) */
        int                  additional_heap_size;    /* Heap for internal DB operations (e.g., save/load) */
        mco_size_t           cow_pagemap_size;        /* Size of copy-on-write MVCC pagemap (bytes) */
        mco_size_t           backup_map_size;         /* Size of backup counters array (bytes, power of two) */
        unsigned int         backup_min_pages;        /* Pages for last exclusive backup pass */
        unsigned int         backup_max_passes;       /* Max passes before exclusive backup pass */
        char                 backup_map_filename[MCO_MAX_FILE_NAME]; /* Backup map filename */
        mco_uint8            iot_agent_id;            /* IoT agent identifier */
        mco_uint2            iot_level;               /* IoT level override */
        mco_uint4            file_backup_delay;       /* Delay between backup block writes (ms) */
        void*                filesys_media_ptr;       /* System-dependent filesystem media pointer */
    } mco_db_params_t;

The fields of this structure are described below:

mark
Internal marker set by mco_db_params_init(). Applications must not modify this field.
mem_page_size
Size of a memory page for conventional or shared memory devices (MCO_MEMORY_CONV, MCO_MEMORY_NAMED). For persistent and mixed-mode databases, this value must be a power of two. (See Creating Databases)
disk_page_size
Size of a persistent storage page. Set to zero for all-in-memory databases. Must be a power of two.

Note: While the general database configuration now allows disk_page_size and mem_page_size to be equal, the MCO_DB_SEPARATE_BITMAP open mode requires the disk page size to be at least eight times the memory page size (i.e., a 1:8 ratio). If you enable MCO_DB_SEPARATE_BITMAP with an incompatible page size configuration, the runtime will return an error.

(See Creating Databases)
db_max_connections
Maximum number of concurrent connections to the database. (See Creating Databases)
disk_max_database_size
Maximum size of the persistent database on disk. (See Creating Databases)
file_extension_quantum
Allocation block size used when extending the database file. This can help reduce file fragmentation.
db_log_type
Transaction log type for persistent databases. Must be one of: REDO_LOG, UNDO_LOG, or NO_LOG. (See Log File Types and Persistent Media I/O)
connection_context_size
Size of the application-specific context attached to each connection. This data is copied from the context parameter of mco_db_connect_ctx() and is used during recovery to verify that the connection's owner task is still alive. (See Recovery from Failed Processes)
hash_load_factor
Threshold (as a percentage) for hash index table reallocation. When the number of items exceeds this percentage of the table size, the table is extended. (See Hash Indexes)
index_optimistic_lock_threshold
Maximum number of active write transactions allowed for optimistic locking on B-Tree indexes. (See MVCC Locking Optimization)
log_params
Initial settings for the transaction log, specified as an mco_log_params_t structure.
mode_mask
Bitmask of database open mode flags. Defined in mco.h. (See Database Open Modes)
min_conn_local_pages
Minimum number of pages held by the per-connection allocator in MVCC mode. (See In-memory Page Allocation)
max_conn_local_pages
Maximum number of pages held by the per-connection allocator in MVCC mode. (See In-memory Page Allocation)
allocation_bitmap_caching_priority
Cache priority for allocation bitmap pages. Higher values keep these pages in the LRU cache longer. (See Prioritized Cache)
index_caching_priority
Cache priority for index pages. Higher values keep these pages in the LRU cache longer. (See Prioritized Cache)
object_caching_priority
Cache priority for object (non-BLOB) pages. Higher values keep these pages in the LRU cache longer. (See Prioritized Cache)
ddl_dict
Reserved for future use.
ddl_dict_size
Size of the DDL dictionary buffer. Used to reserve space in the database header for dynamic schema modifications (e.g., via SQL CREATE TABLE). This parameter is irrelevant for non-SQL applications.
ddl_dict_flags
Reserved for future use.
cipher_key
Primary encryption key for the database. Manages encryption for persistent files or in-memory pages. If cipher_key_snapshot_tl is also set, this key applies only to the main database storage. (See Database Encryption)
cipher_key_snapshot_tl
Encryption key specifically for database snapshots (created by mco_db_save()) and the transaction log (TL). If set to an empty string (""), snapshots and TL are not encrypted, even if cipher_key is provided. (See Database Encryption)
dynamic_hash
Enables dynamic extension of hash tables when the number of items exceeds the hash_load_factor. (See Hash Indexes)
license_key
eXtremeDB license key.
max_classes
Number of class slots to reserve in the database header to support dynamic schema creation (e.g., via SQL CREATE TABLE). Irrelevant for non-SQL applications.
max_indexes
Number of index slots to reserve in the database header to support dynamic schema modification (e.g., via SQL ALTER TABLE). Irrelevant for non-SQL applications.
autocompact_threshold
Object size threshold (in bytes) that triggers automatic compaction (mco_autocompact()) during transaction commit. (See Automatic De-fragmentation of Dynamic Objects)
trans_sched_policy
Scheduling policy for transactions with the same priority. (See MURSIW Transaction Scheduling Policies)
max_trans_time
Maximum allowed transaction duration (in milliseconds). A value of 0 disables the limit. Note: This setting has no effect except in special debug builds of the eXtremeDB runtime.
max_ttl_objects
Maximum number of objects that can be removed by Time-To-Live (TTL) policies in a single transaction.
ignore_ttl
If set to true, all Time-To-Live (TTL) policies are ignored. This setting can be changed at runtime.
max_gc_versions
Maximum number of old object versions that the Garbage Collector (GC) can reclaim in a single operation.
max_active_pages
Maximum number of pages a single connection can access. The default is 32. Relevant when encryption, protection, or compression is enabled. (See Database Encryption)
page_hash_bundles
Number of bundles in the internal page hash used for encryption, protection, or compression. (See Database Encryption)
compression_level
Compression level: -1 for default, 0 for no compression, 1-9 for increasing levels of compression. (See Database Compression)
compression_mask
Bitmap specifying which types of pages should be compressed. (See Database Compression)
expected_compression_ratio
Expected compression ratio used to allocate the virtual page map. The default value is 10. It is not recommended to change this value. (See Database Compression)
btree_cursor_read_ahead_size
Number of keys pre-fetched from a B-Tree leaf page on each access. Cannot exceed MCO_CFG_CURSOR_BUF_SIZE. (See B-Tree Read-Ahead Buffering)
mvcc_bitmap_size
Size of an internal bitmap used to accelerate MVCC performance. Must be a power of two. A value of 0 disables this feature. (See Accelerating MVCC Performance)
additional_heap_size
Additional heap memory allocated for internal database operations, primarily for buffering during XML export/import and database save/load operations.
cow_pagemap_size
Size of the copy-on-write (COW) MVCC page map, in bytes (one byte per disk page).
backup_map_size
Size of the backup counters array, in bytes (must be a power of two). Ignored if disk_max_database_size is not set. Set to zero to disable the incremental backup feature. (See Incremental Backup Implementation)
backup_min_pages
Number of pages processed in the final exclusive pass of the backup procedure. Set to zero to disable this threshold. (See Incremental Backup Implementation)
backup_max_passes
Maximum number of non-exclusive passes performed before the final exclusive backup pass. (See Incremental Backup Implementation)
backup_map_filename
Name of the file used to store backup metadata on mco_db_close(). If left empty, the default name is <persistent-storage>.bmap, located in the same directory as the persistent database file. (See Incremental Backup Implementation)
iot_agent_id
Identifier for the IoT agent.
iot_level
IoT level that overrides the router's level defined in the MCO schema file.
file_backup_delay
Delay in milliseconds between writing backup blocks to minimize performance impact. The default is 0 (no delay). (See File Backup)
filesys_media_ptr
System-dependent pointer to the filesystem media. Used for custom I/O implementations.