xSQL Devices Specification

The xSQL configuration file can be used to define an array of memory devices which corresponds to C API mco_device_t structures.

For an overview see page Configuration File Parameters

The devices section has syntax like the following to define an array:

 
    devices : [
        {
            type : memory,
            assignment : database,
            name : "diskdb-db",
            size : 10m
        },
        {
            type : memory,
            assignment : cache,
            name : "diskdb-cache",
            size : 10m
        },
        {
            type : file,
            assignment : persistent,
            name : "diskdb.dbs"
        },
        {
            type : file,
            assignment : log,
            name : "diskdb.log"
        }
    ]
     

An alternative to specifying the individual memory devices, the following "shortcut" parameters can be specified outside of the devices section:

 
    database_size    :  10m,
    cache_size : 10m,
    database_filename: "diskdb.dbs", 
    log_filename     : "diskdb.log",
      

Note that care must be taken to avoid conflicts between these shortcut parameters and the device specifications.

The following table lists the possible options for the "shortcut" parameters and the devices section with the corresponding C API structures and values specified in the comment:

Option name : example value Comment
database_size : 100m, Database size in bytes, unsigned
cache_size : 200m, Disk cache size in bytes, unsigned
database_filename: "test.dbs",

Persistent database file name, string

log_filename : "test.log", Log file name, string
Device array specification parameters
type : memory,

Device type (mco_device_t::type), one of :

  • memory (MCO_MEMORY_CONV or MCO_MEMORY_NAMED depending on runtime_configuration.shared_memory),
  • file (MCO_MEMORY_FILE),
  • multifile (MCO_MEMORY_MULTIFILE),
  • raid (MCO_MEMORY_RAID) or
  • cyclic_file_buf (MCO_MEMORY_CYCLIC_FILE_BUF)

Default value is memory

assignment : database,

Device assignment (mco_device_t::assignment), one of :

  • database (MCO_MEMORY_ASSIGN_DATABASE),
  • cache (MCO_MEMORY_ASSIGN_CACHE),
  • persistent (MCO_MEMORY_ASSIGN_PERSISTENT) or
  • log (MCO_MEMORY_ASSIGN_LOG)

Default value is database

size : 100m Size of the device (mco_device_t::size), unsigned
name : "device-name", Device name (mco_device_t::dev.<...>.name). Ignored for MCO_MEMORY_CONV. string
shared_hint : 0x2000000, Shared memory address hint (mco_device_t::dev.named.hint) for a MCO_MEMORY_NAMED device, unsigned
segment_size : 10m, Multifile segment size (mco_device_t::dev.multifile.segment_size) for MCO_MEMORY_MULTIFILE device type, unsigned
offset : 0, RAID offset (mco_device_t::dev.raid.offset) for MCO_MEMORY_RAID device type, unsigned
level : 0, RAID level (mco_device_t::dev.raid.level) for MCO_MEMORY_RAID device type, unsigned
flags : default,

Flag settings (mco_device_t::dev.XXX.flags), depends on device type:

For device type Combination of flag values
MCO_MEMORY_NAMED

anonymous (MCO_RT_POSIX_SHM_ANONYMOUS)

shared (MCO_RT_POSIX_SHM_SHARED)

MCO_MEMORY_FILE,

MCO_MEMORY_CYCLIC_FILE_BUF,

MCO_MEMORY_MULTIFILE,

MCO_MEMORY_RAID

default (MCO_FILE_OPEN_DEFAULT),

read_only (MCO_FILE_OPEN_READ_ONLY),

truncate (MCO_FILE_OPEN_TRUNCATE),

no_buffering (MCO_FILE_OPEN_NO_BUFFERING),

existing (MCO_FILE_OPEN_EXISTING),

temporary (MCO_FILE_OPEN_TEMPORARY),

fsync_fix (MCO_FILE_OPEN_FSYNC_FIX),

subpartition (MCO_FILE_OPEN_SUBPARTITION),

fsync_aio_barrier (MCO_FILE_OPEN_FSYNC_AIO_BARRIER)

compressed (MCO_FILE_OPEN_COMPRESSED)

lock (MCO_FILE_OPEN_LOCK)

no_read_buffering (MCO_FILE_OPEN_NO_READ_BUFFERING)

no_write_buffering (MCO_FILE_OPEN_NO_WRITE_BUFFERING)