Version 2.4.1
WiredTiger API

The functions, handles and methods applications use to access and manage data with WiredTiger. More...

Classes

struct  WT_ITEM
 A raw item of data to be managed, including a pointer to the data and a length. More...
 
struct  WT_LSN
 A log sequence number, representing a position in the transaction log. More...
 
struct  WT_CURSOR
 A WT_CURSOR handle is the interface to a cursor. More...
 
struct  WT_ASYNC_OP
 A WT_ASYNC_OP handle is the interface to an asynchronous operation. More...
 
struct  WT_SESSION
 All data operations are performed in the context of a WT_SESSION. More...
 
struct  WT_CONNECTION
 A connection to a WiredTiger database. More...
 
struct  WT_ASYNC_CALLBACK
 The interface implemented by applications to accept notifications of the completion of asynchronous operations. More...
 
struct  WT_EVENT_HANDLER
 The interface implemented by applications to handle error, informational and progress messages. More...
 
struct  WT_CONFIG_ITEM
 The configuration information returned by the WiredTiger configuration parsing functions in the WT_EXTENSION_API and the public API. More...
 
struct  WT_CONFIG_PARSER
 A handle that can be used to search and traverse configuration strings compatible with WiredTiger APIs. More...
 

Macros

#define WT_INTPACK64_MAXSIZE
 The maximum packed size of a 64-bit integer. More...
 
#define WT_INTPACK32_MAXSIZE
 The maximum packed size of a 32-bit integer. More...
 

Enumerations

enum  WT_ASYNC_OPTYPE {
  WT_AOP_NONE, WT_AOP_COMPACT, WT_AOP_INSERT, WT_AOP_REMOVE,
  WT_AOP_SEARCH, WT_AOP_UPDATE
}
 Asynchronous operation types. More...
 

Functions

int wiredtiger_open (const char *home, WT_EVENT_HANDLER *errhandler, const char *config, WT_CONNECTION **connectionp)
 Open a connection to a database. More...
 
const char * wiredtiger_strerror (int err)
 Return information about an error as a string; wiredtiger_strerror is a superset of the ISO C99/POSIX 1003.1-2001 function strerror. More...
 
const char * wiredtiger_version (int *majorp, int *minorp, int *patchp)
 Get version information. More...
 

Data packing and unpacking

typedef struct __wt_pack_stream WT_PACK_STREAM
 Streaming interface to packing. More...
 
int wiredtiger_struct_pack (WT_SESSION *session, void *buffer, size_t size, const char *format,...)
 Pack a structure into a buffer. More...
 
int wiredtiger_struct_size (WT_SESSION *session, size_t *sizep, const char *format,...)
 Calculate the size required to pack a structure. More...
 
int wiredtiger_struct_unpack (WT_SESSION *session, const void *buffer, size_t size, const char *format,...)
 Unpack a structure from a buffer. More...
 
int wiredtiger_pack_start (WT_SESSION *session, const char *format, void *buffer, size_t size, WT_PACK_STREAM **psp)
 Start a packing operation into a buffer with the given format string. More...
 
int wiredtiger_unpack_start (WT_SESSION *session, const char *format, const void *buffer, size_t size, WT_PACK_STREAM **psp)
 Start an unpacking operation from a buffer with the given format string. More...
 
int wiredtiger_pack_close (WT_PACK_STREAM *ps, size_t *usedp)
 Close a packing stream. More...
 
int wiredtiger_pack_item (WT_PACK_STREAM *ps, WT_ITEM *item)
 Pack an item into a packing stream. More...
 
int wiredtiger_pack_int (WT_PACK_STREAM *ps, int64_t i)
 Pack a signed integer into a packing stream. More...
 
int wiredtiger_pack_str (WT_PACK_STREAM *ps, const char *s)
 Pack a string into a packing stream. More...
 
int wiredtiger_pack_uint (WT_PACK_STREAM *ps, uint64_t u)
 Pack an unsigned integer into a packing stream. More...
 
int wiredtiger_unpack_item (WT_PACK_STREAM *ps, WT_ITEM *item)
 Unpack an item from a packing stream. More...
 
int wiredtiger_unpack_int (WT_PACK_STREAM *ps, int64_t *ip)
 Unpack a signed integer from a packing stream. More...
 
int wiredtiger_unpack_str (WT_PACK_STREAM *ps, const char **sp)
 Unpack a string from a packing stream. More...
 
int wiredtiger_unpack_uint (WT_PACK_STREAM *ps, uint64_t *up)
 Unpack an unsigned integer from a packing stream. More...
 

Configuration string parsing

int wiredtiger_config_parser_open (WT_SESSION *session, const char *config, size_t len, WT_CONFIG_PARSER **config_parserp)
 Create a handle that can be used to parse or create configuration strings compatible with WiredTiger APIs. More...
 

Error returns

Most functions and methods in WiredTiger return an integer code indicating whether the operation succeeded or failed. A return of zero indicates success, all non-zero return values indicate some kind of failure.

WiredTiger reserves all values from -31,800 to -31,999 as possible error return values. WiredTiger may also return C99/POSIX error codes such as ENOMEM, EINVAL and ENOTSUP, with the usual meanings.

The following are all of the WiredTiger-specific error returns:

#define WT_DUPLICATE_KEY
 Attempt to insert an existing key. More...
 
#define WT_ERROR
 Non-specific WiredTiger error. More...
 
#define WT_NOTFOUND
 Item not found. More...
 
#define WT_PANIC
 WiredTiger library panic. More...
 
#define WT_ROLLBACK
 Conflict between concurrent operations. More...
 

Connection statistics

Statistics are accessed through cursors with "statistics:" URIs. Individual statistics can be queried through the cursor using the following keys. See Statistics Data for more information.

#define WT_STAT_CONN_ASYNC_ALLOC_RACE
 async: number of allocation state races
 
#define WT_STAT_CONN_ASYNC_ALLOC_VIEW
 async: number of operation slots viewed for allocation
 
#define WT_STAT_CONN_ASYNC_CUR_QUEUE
 async: current work queue length
 
#define WT_STAT_CONN_ASYNC_FLUSH
 async: number of flush calls
 
#define WT_STAT_CONN_ASYNC_FULL
 async: number of times operation allocation failed
 
#define WT_STAT_CONN_ASYNC_MAX_QUEUE
 async: maximum work queue length
 
#define WT_STAT_CONN_ASYNC_NOWORK
 async: number of times worker found no work
 
#define WT_STAT_CONN_ASYNC_OP_ALLOC
 async: total allocations
 
#define WT_STAT_CONN_ASYNC_OP_COMPACT
 async: total compact calls
 
#define WT_STAT_CONN_ASYNC_OP_INSERT
 async: total insert calls
 
#define WT_STAT_CONN_ASYNC_OP_REMOVE
 async: total remove calls
 
#define WT_STAT_CONN_ASYNC_OP_SEARCH
 async: total search calls
 
#define WT_STAT_CONN_ASYNC_OP_UPDATE
 async: total update calls
 
#define WT_STAT_CONN_BLOCK_BYTE_MAP_READ
 block-manager: mapped bytes read
 
#define WT_STAT_CONN_BLOCK_BYTE_READ
 block-manager: bytes read
 
#define WT_STAT_CONN_BLOCK_BYTE_WRITE
 block-manager: bytes written
 
#define WT_STAT_CONN_BLOCK_MAP_READ
 block-manager: mapped blocks read
 
#define WT_STAT_CONN_BLOCK_PRELOAD
 block-manager: blocks pre-loaded
 
#define WT_STAT_CONN_BLOCK_READ
 block-manager: blocks read
 
#define WT_STAT_CONN_BLOCK_WRITE
 block-manager: blocks written
 
#define WT_STAT_CONN_CACHE_BYTES_DIRTY
 cache: tracked dirty bytes in the cache
 
#define WT_STAT_CONN_CACHE_BYTES_INUSE
 cache: bytes currently in the cache
 
#define WT_STAT_CONN_CACHE_BYTES_MAX
 cache: maximum bytes configured
 
#define WT_STAT_CONN_CACHE_BYTES_READ
 cache: bytes read into cache
 
#define WT_STAT_CONN_CACHE_BYTES_WRITE
 cache: bytes written from cache
 
#define WT_STAT_CONN_CACHE_EVICTION_CHECKPOINT
 cache: checkpoint blocked page eviction
 
#define WT_STAT_CONN_CACHE_EVICTION_CLEAN
 cache: unmodified pages evicted
 
#define WT_STAT_CONN_CACHE_EVICTION_DEEPEN
 cache: page split during eviction deepened the tree
 
#define WT_STAT_CONN_CACHE_EVICTION_DIRTY
 cache: modified pages evicted
 
#define WT_STAT_CONN_CACHE_EVICTION_FAIL
 cache: pages selected for eviction unable to be evicted
 
#define WT_STAT_CONN_CACHE_EVICTION_FORCE
 cache: pages evicted because they exceeded the in-memory maximum
 
#define WT_STAT_CONN_CACHE_EVICTION_FORCE_FAIL
 cache: failed eviction of pages that exceeded the in-memory maximum
 
#define WT_STAT_CONN_CACHE_EVICTION_HAZARD
 cache: hazard pointer blocked page eviction
 
#define WT_STAT_CONN_CACHE_EVICTION_INTERNAL
 cache: internal pages evicted
 
#define WT_STAT_CONN_CACHE_EVICTION_QUEUE_EMPTY
 cache: eviction server candidate queue empty when topping up
 
#define WT_STAT_CONN_CACHE_EVICTION_QUEUE_NOT_EMPTY
 cache: eviction server candidate queue not empty when topping up
 
#define WT_STAT_CONN_CACHE_EVICTION_SERVER_EVICTING
 cache: eviction server evicting pages
 
#define WT_STAT_CONN_CACHE_EVICTION_SERVER_NOT_EVICTING
 cache: eviction server populating queue, but not evicting pages
 
#define WT_STAT_CONN_CACHE_EVICTION_SLOW
 cache: eviction server unable to reach eviction goal
 
#define WT_STAT_CONN_CACHE_EVICTION_SPLIT
 cache: pages split during eviction
 
#define WT_STAT_CONN_CACHE_EVICTION_WALK
 cache: pages walked for eviction
 
#define WT_STAT_CONN_CACHE_PAGES_DIRTY
 cache: tracked dirty pages in the cache
 
#define WT_STAT_CONN_CACHE_PAGES_INUSE
 cache: pages currently held in the cache
 
#define WT_STAT_CONN_CACHE_READ
 cache: pages read into cache
 
#define WT_STAT_CONN_CACHE_WRITE
 cache: pages written from cache
 
#define WT_STAT_CONN_COND_WAIT
 connection: pthread mutex condition wait calls
 
#define WT_STAT_CONN_CURSOR_CREATE
 btree: cursor create calls
 
#define WT_STAT_CONN_CURSOR_INSERT
 btree: cursor insert calls
 
#define WT_STAT_CONN_CURSOR_NEXT
 btree: cursor next calls
 
#define WT_STAT_CONN_CURSOR_PREV
 btree: cursor prev calls
 
#define WT_STAT_CONN_CURSOR_REMOVE
 btree: cursor remove calls
 
#define WT_STAT_CONN_CURSOR_RESET
 btree: cursor reset calls
 
#define WT_STAT_CONN_CURSOR_SEARCH
 btree: cursor search calls
 
#define WT_STAT_CONN_CURSOR_SEARCH_NEAR
 btree: cursor search near calls
 
#define WT_STAT_CONN_CURSOR_UPDATE
 btree: cursor update calls
 
#define WT_STAT_CONN_DH_SESSION_HANDLES
 data-handle: session dhandles swept
 
#define WT_STAT_CONN_DH_SESSION_SWEEPS
 data-handle: session sweep attempts
 
#define WT_STAT_CONN_FILE_OPEN
 connection: files currently open
 
#define WT_STAT_CONN_LOG_BUFFER_GROW
 log: log buffer size increases
 
#define WT_STAT_CONN_LOG_BUFFER_SIZE
 log: total log buffer size
 
#define WT_STAT_CONN_LOG_BYTES_USER
 log: user provided log bytes written
 
#define WT_STAT_CONN_LOG_BYTES_WRITTEN
 log: log bytes written
 
#define WT_STAT_CONN_LOG_CLOSE_YIELDS
 log: yields waiting for previous log file close
 
#define WT_STAT_CONN_LOG_MAX_FILESIZE
 log: maximum log file size
 
#define WT_STAT_CONN_LOG_READS
 log: log read operations
 
#define WT_STAT_CONN_LOG_SCAN_RECORDS
 log: records processed by log scan
 
#define WT_STAT_CONN_LOG_SCAN_REREADS
 log: log scan records requiring two reads
 
#define WT_STAT_CONN_LOG_SCANS
 log: log scan operations
 
#define WT_STAT_CONN_LOG_SLOT_CLOSES
 log: consolidated slot closures
 
#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED
 log: logging bytes consolidated
 
#define WT_STAT_CONN_LOG_SLOT_JOINS
 log: consolidated slot joins
 
#define WT_STAT_CONN_LOG_SLOT_RACES
 log: consolidated slot join races
 
#define WT_STAT_CONN_LOG_SLOT_SWITCH_FAILS
 log: slots selected for switching that were unavailable
 
#define WT_STAT_CONN_LOG_SLOT_TOOBIG
 log: record size exceeded maximum
 
#define WT_STAT_CONN_LOG_SLOT_TOOSMALL
 log: failed to find a slot large enough for record
 
#define WT_STAT_CONN_LOG_SLOT_TRANSITIONS
 log: consolidated slot join transitions
 
#define WT_STAT_CONN_LOG_SYNC
 log: log sync operations
 
#define WT_STAT_CONN_LOG_WRITES
 log: log write operations
 
#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE
 LSM: sleep for LSM checkpoint throttle.
 
#define WT_STAT_CONN_LSM_MERGE_THROTTLE
 LSM: sleep for LSM merge throttle.
 
#define WT_STAT_CONN_LSM_ROWS_MERGED
 LSM: rows merged in an LSM tree.
 
#define WT_STAT_CONN_LSM_WORK_QUEUE_APP
 LSM: application work units currently queued.
 
#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER
 LSM: merge work units currently queued.
 
#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX
 LSM: tree queue hit maximum.
 
#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH
 LSM: switch work units currently queued.
 
#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED
 LSM: tree maintenance operations scheduled.
 
#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED
 LSM: tree maintenance operations discarded.
 
#define WT_STAT_CONN_LSM_WORK_UNITS_DONE
 LSM: tree maintenance operations executed.
 
#define WT_STAT_CONN_MEMORY_ALLOCATION
 connection: memory allocations
 
#define WT_STAT_CONN_MEMORY_FREE
 connection: memory frees
 
#define WT_STAT_CONN_MEMORY_GROW
 connection: memory re-allocations
 
#define WT_STAT_CONN_READ_IO
 connection: total read I/Os
 
#define WT_STAT_CONN_REC_PAGES
 reconciliation: page reconciliation calls
 
#define WT_STAT_CONN_REC_PAGES_EVICTION
 reconciliation: page reconciliation calls for eviction
 
#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES
 reconciliation: split bytes currently awaiting free
 
#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS
 reconciliation: split objects currently awaiting free
 
#define WT_STAT_CONN_RWLOCK_READ
 connection: pthread mutex shared lock read-lock calls
 
#define WT_STAT_CONN_RWLOCK_WRITE
 connection: pthread mutex shared lock write-lock calls
 
#define WT_STAT_CONN_SESSION_CURSOR_OPEN
 session: open cursor count
 
#define WT_STAT_CONN_SESSION_OPEN
 session: open session count
 
#define WT_STAT_CONN_TXN_BEGIN
 transaction: transaction begins
 
#define WT_STAT_CONN_TXN_CHECKPOINT
 transaction: transaction checkpoints
 
#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING
 transaction: transaction checkpoint currently running
 
#define WT_STAT_CONN_TXN_COMMIT
 transaction: transactions committed
 
#define WT_STAT_CONN_TXN_FAIL_CACHE
 transaction: transaction failures due to cache overflow
 
#define WT_STAT_CONN_TXN_PINNED_RANGE
 transaction: transaction range of IDs currently pinned
 
#define WT_STAT_CONN_TXN_ROLLBACK
 transaction: transactions rolled back
 
#define WT_STAT_CONN_WRITE_IO
 connection: total write I/Os
 

Statistics for data sources

#define WT_STAT_DSRC_ALLOCATION_SIZE
 block-manager: file allocation unit size
 
#define WT_STAT_DSRC_BLOCK_ALLOC
 block-manager: blocks allocated
 
#define WT_STAT_DSRC_BLOCK_CHECKPOINT_SIZE
 block-manager: checkpoint size
 
#define WT_STAT_DSRC_BLOCK_EXTENSION
 block-manager: allocations requiring file extension
 
#define WT_STAT_DSRC_BLOCK_FREE
 block-manager: blocks freed
 
#define WT_STAT_DSRC_BLOCK_MAGIC
 block-manager: file magic number
 
#define WT_STAT_DSRC_BLOCK_MAJOR
 block-manager: file major version number
 
#define WT_STAT_DSRC_BLOCK_MINOR
 block-manager: minor version number
 
#define WT_STAT_DSRC_BLOCK_REUSE_BYTES
 block-manager: file bytes available for reuse
 
#define WT_STAT_DSRC_BLOCK_SIZE
 block-manager: file size in bytes
 
#define WT_STAT_DSRC_BLOOM_COUNT
 LSM: bloom filters in the LSM tree.
 
#define WT_STAT_DSRC_BLOOM_FALSE_POSITIVE
 LSM: bloom filter false positives.
 
#define WT_STAT_DSRC_BLOOM_HIT
 LSM: bloom filter hits.
 
#define WT_STAT_DSRC_BLOOM_MISS
 LSM: bloom filter misses.
 
#define WT_STAT_DSRC_BLOOM_PAGE_EVICT
 LSM: bloom filter pages evicted from cache.
 
#define WT_STAT_DSRC_BLOOM_PAGE_READ
 LSM: bloom filter pages read into cache.
 
#define WT_STAT_DSRC_BLOOM_SIZE
 LSM: total size of bloom filters.
 
#define WT_STAT_DSRC_BTREE_COLUMN_DELETED
 btree: column-store variable-size deleted values
 
#define WT_STAT_DSRC_BTREE_COLUMN_FIX
 btree: column-store fixed-size leaf pages
 
#define WT_STAT_DSRC_BTREE_COLUMN_INTERNAL
 btree: column-store internal pages
 
#define WT_STAT_DSRC_BTREE_COLUMN_VARIABLE
 btree: column-store variable-size leaf pages
 
#define WT_STAT_DSRC_BTREE_COMPACT_REWRITE
 btree: pages rewritten by compaction
 
#define WT_STAT_DSRC_BTREE_ENTRIES
 btree: number of key/value pairs
 
#define WT_STAT_DSRC_BTREE_FIXED_LEN
 btree: fixed-record size
 
#define WT_STAT_DSRC_BTREE_MAXIMUM_DEPTH
 btree: maximum tree depth
 
#define WT_STAT_DSRC_BTREE_MAXINTLITEM
 btree: maximum internal page item size
 
#define WT_STAT_DSRC_BTREE_MAXINTLPAGE
 btree: maximum internal page size
 
#define WT_STAT_DSRC_BTREE_MAXLEAFITEM
 btree: maximum leaf page item size
 
#define WT_STAT_DSRC_BTREE_MAXLEAFPAGE
 btree: maximum leaf page size
 
#define WT_STAT_DSRC_BTREE_OVERFLOW
 btree: overflow pages
 
#define WT_STAT_DSRC_BTREE_ROW_INTERNAL
 btree: row-store internal pages
 
#define WT_STAT_DSRC_BTREE_ROW_LEAF
 btree: row-store leaf pages
 
#define WT_STAT_DSRC_CACHE_BYTES_READ
 cache: bytes read into cache
 
#define WT_STAT_DSRC_CACHE_BYTES_WRITE
 cache: bytes written from cache
 
#define WT_STAT_DSRC_CACHE_EVICTION_CHECKPOINT
 cache: checkpoint blocked page eviction
 
#define WT_STAT_DSRC_CACHE_EVICTION_CLEAN
 cache: unmodified pages evicted
 
#define WT_STAT_DSRC_CACHE_EVICTION_DIRTY
 cache: modified pages evicted
 
#define WT_STAT_DSRC_CACHE_EVICTION_FAIL
 cache: data source pages selected for eviction unable to be evicted
 
#define WT_STAT_DSRC_CACHE_EVICTION_HAZARD
 cache: hazard pointer blocked page eviction
 
#define WT_STAT_DSRC_CACHE_EVICTION_INTERNAL
 cache: internal pages evicted
 
#define WT_STAT_DSRC_CACHE_OVERFLOW_VALUE
 cache: overflow values cached in memory
 
#define WT_STAT_DSRC_CACHE_READ
 cache: pages read into cache
 
#define WT_STAT_DSRC_CACHE_READ_OVERFLOW
 cache: overflow pages read into cache
 
#define WT_STAT_DSRC_CACHE_WRITE
 cache: pages written from cache
 
#define WT_STAT_DSRC_COMPRESS_RAW_FAIL
 compression: raw compression call failed, no additional data available
 
#define WT_STAT_DSRC_COMPRESS_RAW_FAIL_TEMPORARY
 compression: raw compression call failed, additional data available
 
#define WT_STAT_DSRC_COMPRESS_RAW_OK
 compression: raw compression call succeeded
 
#define WT_STAT_DSRC_COMPRESS_READ
 compression: compressed pages read
 
#define WT_STAT_DSRC_COMPRESS_WRITE
 compression: compressed pages written
 
#define WT_STAT_DSRC_COMPRESS_WRITE_FAIL
 compression: page written failed to compress
 
#define WT_STAT_DSRC_COMPRESS_WRITE_TOO_SMALL
 compression: page written was too small to compress
 
#define WT_STAT_DSRC_CURSOR_CREATE
 cursor: create calls
 
#define WT_STAT_DSRC_CURSOR_INSERT
 cursor: insert calls
 
#define WT_STAT_DSRC_CURSOR_INSERT_BULK
 cursor: bulk-loaded cursor-insert calls
 
#define WT_STAT_DSRC_CURSOR_INSERT_BYTES
 cursor: cursor-insert key and value bytes inserted
 
#define WT_STAT_DSRC_CURSOR_NEXT
 cursor: next calls
 
#define WT_STAT_DSRC_CURSOR_PREV
 cursor: prev calls
 
#define WT_STAT_DSRC_CURSOR_REMOVE
 cursor: remove calls
 
#define WT_STAT_DSRC_CURSOR_REMOVE_BYTES
 cursor: cursor-remove key bytes removed
 
#define WT_STAT_DSRC_CURSOR_RESET
 cursor: reset calls
 
#define WT_STAT_DSRC_CURSOR_SEARCH
 cursor: search calls
 
#define WT_STAT_DSRC_CURSOR_SEARCH_NEAR
 cursor: search near calls
 
#define WT_STAT_DSRC_CURSOR_UPDATE
 cursor: update calls
 
#define WT_STAT_DSRC_CURSOR_UPDATE_BYTES
 cursor: cursor-update value bytes updated
 
#define WT_STAT_DSRC_LSM_CHECKPOINT_THROTTLE
 LSM: sleep for LSM checkpoint throttle.
 
#define WT_STAT_DSRC_LSM_CHUNK_COUNT
 LSM: chunks in the LSM tree.
 
#define WT_STAT_DSRC_LSM_GENERATION_MAX
 LSM: highest merge generation in the LSM tree.
 
#define WT_STAT_DSRC_LSM_LOOKUP_NO_BLOOM
 LSM: queries that could have benefited from a Bloom filter that did not exist.
 
#define WT_STAT_DSRC_LSM_MERGE_THROTTLE
 LSM: sleep for LSM merge throttle.
 
#define WT_STAT_DSRC_REC_DICTIONARY
 reconciliation: dictionary matches
 
#define WT_STAT_DSRC_REC_MULTIBLOCK_INTERNAL
 reconciliation: internal page multi-block writes
 
#define WT_STAT_DSRC_REC_MULTIBLOCK_LEAF
 reconciliation: leaf page multi-block writes
 
#define WT_STAT_DSRC_REC_MULTIBLOCK_MAX
 reconciliation: maximum blocks required for a page
 
#define WT_STAT_DSRC_REC_OVERFLOW_KEY_INTERNAL
 reconciliation: internal-page overflow keys
 
#define WT_STAT_DSRC_REC_OVERFLOW_KEY_LEAF
 reconciliation: leaf-page overflow keys
 
#define WT_STAT_DSRC_REC_OVERFLOW_VALUE
 reconciliation: overflow values written
 
#define WT_STAT_DSRC_REC_PAGE_DELETE
 reconciliation: pages deleted
 
#define WT_STAT_DSRC_REC_PAGE_MATCH
 reconciliation: page checksum matches
 
#define WT_STAT_DSRC_REC_PAGES
 reconciliation: page reconciliation calls
 
#define WT_STAT_DSRC_REC_PAGES_EVICTION
 reconciliation: page reconciliation calls for eviction
 
#define WT_STAT_DSRC_REC_PREFIX_COMPRESSION
 reconciliation: leaf page key bytes discarded using prefix compression
 
#define WT_STAT_DSRC_REC_SUFFIX_COMPRESSION
 reconciliation: internal page key bytes discarded using suffix compression
 
#define WT_STAT_DSRC_SESSION_COMPACT
 session: object compaction
 
#define WT_STAT_DSRC_SESSION_CURSOR_OPEN
 session: open cursor count
 
#define WT_STAT_DSRC_TXN_UPDATE_CONFLICT
 transaction: update conflicts
 

Log record and operation types

#define WT_LOGOP_INVALID
 invalid operation
 
#define WT_LOGREC_CHECKPOINT
 checkpoint
 
#define WT_LOGREC_COMMIT
 transaction commit
 
#define WT_LOGREC_FILE_SYNC
 file sync
 
#define WT_LOGREC_MESSAGE
 message
 
#define WT_LOGOP_COL_PUT
 column put
 
#define WT_LOGOP_COL_REMOVE
 column remove
 
#define WT_LOGOP_COL_TRUNCATE
 column truncate
 
#define WT_LOGOP_ROW_PUT
 row put
 
#define WT_LOGOP_ROW_REMOVE
 row remove
 
#define WT_LOGOP_ROW_TRUNCATE
 row truncate
 

Detailed Description

The functions, handles and methods applications use to access and manage data with WiredTiger.


Class Documentation

struct WT_ITEM

A raw item of data to be managed, including a pointer to the data and a length.

WT_ITEM structures do not need to be cleared before use.

Examples:
ex_async.c, ex_extending.c, ex_extractor.c, ex_log.c, and ex_schema.c.
Class Members
const void * data The memory reference of the data item.

For items returned by a WT_CURSOR, the pointer is only valid until the next operation on that cursor. Applications that need to keep an item across multiple cursor operations must make a copy.

size_t size The number of bytes in the data item.

The maximum length of a single column stored in a table is not fixed (as it partially depends on the underlying file configuration), but is always a small number of bytes less than 4GB.

struct WT_LSN

A log sequence number, representing a position in the transaction log.

Examples:
ex_log.c.
Class Members
uint32_t file Log file number.
wt_off_t offset Log file offset.
struct WT_CONFIG_ITEM

The configuration information returned by the WiredTiger configuration parsing functions in the WT_EXTENSION_API and the public API.

Class Members
__unnamed__ Permitted values of the type field.
Class Members
size_t len The number of bytes in the value referenced by str.
const char * str The value of a configuration string.

Regardless of the type of the configuration string (boolean, int, list or string), the str field will reference the value of the configuration string.

The bytes referenced by str are not nul-terminated, use the len field instead of a terminating nul byte.

enum WT_CONFIG_ITEM type Permitted values of the type field.

The type of value determined by the parser. In all cases, the str and len fields are set.

int64_t val The value of a configuration boolean or integer.

If the configuration string's value is "true" or "false", the val field will be set to 1 (true), or 0 (false).

If the configuration string can be legally interpreted as an integer, using the strtoll function rules as specified in ISO/IEC 9899:1990 ("ISO C90"), that integer will be stored in the val field.

Macro Definition Documentation

#define WT_DUPLICATE_KEY

Attempt to insert an existing key.

This error is generated when the application attempts to insert a record with the same key as an existing record without the 'overwrite' configuration to WT_SESSION::open_cursor.

#define WT_ERROR

Non-specific WiredTiger error.

This error is returned when an error is not covered by a specific error return.

#define WT_INTPACK32_MAXSIZE

The maximum packed size of a 32-bit integer.

The wiredtiger_struct_pack function will pack single integers into at most this many bytes.

#define WT_INTPACK64_MAXSIZE

The maximum packed size of a 64-bit integer.

The wiredtiger_struct_pack function will pack single long integers into at most this many bytes.

#define WT_NOTFOUND

Item not found.

This error indicates an operation did not find a value to return. This includes cursor search and other operations where no record matched the cursor's search key such as WT_CURSOR::update or WT_CURSOR::remove.

Examples:
ex_log.c, ex_stat.c, and ex_thread.c.
#define WT_PANIC

WiredTiger library panic.

This error indicates an underlying problem that requires the application exit and restart.

#define WT_ROLLBACK

Conflict between concurrent operations.

This error is generated when an operation cannot be completed due to a conflict with concurrent operations. The operation may be retried; if a transaction is in progress, it should be rolled back and the operation retried in a new transaction.

Typedef Documentation

typedef struct __wt_pack_stream WT_PACK_STREAM

Streaming interface to packing.

This allows applications to pack or unpack records one field at a time. This is an opaque handle returned by wiredtiger_pack_start or wiredtiger_unpack_start. It must be closed with wiredtiger_pack_close.

Enumeration Type Documentation

Asynchronous operation types.

Enumerator
WT_AOP_NONE 

No operation type set.

WT_AOP_COMPACT 

WT_ASYNC_OP::compact.

WT_AOP_INSERT 

WT_ASYNC_OP::insert.

WT_AOP_REMOVE 

WT_ASYNC_OP::remove.

WT_AOP_SEARCH 

WT_ASYNC_OP::search.

WT_AOP_UPDATE 

WT_ASYNC_OP::update.

Function Documentation

int wiredtiger_config_parser_open ( WT_SESSION session,
const char *  config,
size_t  len,
WT_CONFIG_PARSER **  config_parserp 
)

Create a handle that can be used to parse or create configuration strings compatible with WiredTiger APIs.

This API is outside the scope of a WiredTiger connection handle, since applications may need to generate configuration strings prior to calling wiredtiger_open.

Parameters
sessionthe session handle to be used for error reporting. If NULL error messages will be written to stdout.
configthe configuration string being parsed. The string must remain valid for the lifetime of the parser handle.
lenthe number of valid bytes in config
[out]config_parserpA pointer to the newly opened handle
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int wiredtiger_open ( const char *  home,
WT_EVENT_HANDLER errhandler,
const char *  config,
WT_CONNECTION **  connectionp 
)

Open a connection to a database.

ret = wiredtiger_open(home, NULL, "create,cache_size=500M", &conn);
Parameters
homeThe path to the database home directory. See Database Home Directory for more information.
errhandlerAn error handler. If NULL, a builtin error handler is installed that writes error messages to stderr
configConfiguration string, see Configuration Strings. Permitted values:
NameEffectValues
async = (asynchronous operations configuration options.a set of related configuration options defined below.
    enabledenable asynchronous operation.a boolean flag; default false.
    ops_maxmaximum number of expected simultaneous asynchronous operations.an integer between 10 and 4096; default 1024.
    threadsthe number of worker threads to service asynchronous requests.an integer between 1 and 20; default 2.
)
buffer_alignmentin-memory alignment (in bytes) for buffers used for I/O. The default value of -1 indicates a platform-specific alignment value should be used (4KB on Linux systems, zero elsewhere).an integer between -1 and 1MB; default -1.
cache_sizemaximum heap memory to allocate for the cache. A database should configure either a cache_size or a shared_cache not both.an integer between 1MB and 10TB; default 100MB.
checkpoint = (periodically checkpoint the database.a set of related configuration options defined below.
    log_sizewait for this amount of log record bytes to be written to the log between each checkpoint. A database can configure both log_size and wait to set an upper bound for checkpoints; setting this value above 0 configures periodic checkpoints.an integer between 0 and 2GB; default 0.
    namethe checkpoint name.a string; default "WiredTigerCheckpoint".
    waitseconds to wait between each checkpoint; setting this value above 0 configures periodic checkpoints.an integer between 0 and 100000; default 0.
)
checkpoint_syncflush files to stable storage when closing or writing checkpoints.a boolean flag; default true.
config_basewrite the base configuration file if creating the database, see WiredTiger.basecfg file for more information.a boolean flag; default true.
createcreate the database if it does not exist.a boolean flag; default false.
direct_ioUse O_DIRECT to access files. Options are given as a list, such as "direct_io=[data]". Configuring direct_io requires care, see Direct I/O for important warnings. Including "data" will cause WiredTiger data files to use O_DIRECT, including "log" will cause WiredTiger log files to use O_DIRECT, and including "checkpoint" will cause WiredTiger data files opened at a checkpoint (i.e: read only) to use O_DIRECT.a list, with values chosen from the following options: "checkpoint", "data", "log"; default empty.
error_prefixprefix string for error messages.a string; default empty.
eviction = (eviction configuration options.a set of related configuration options defined below.
    threads_maxmaximum number of threads WiredTiger will start to help evict pages from cache. The number of threads started will vary depending on the current eviction load.an integer between 1 and 20; default 1.
    threads_minminimum number of threads WiredTiger will start to help evict pages from cache. The number of threads currently running will vary depending on the current eviction load.an integer between 1 and 20; default 1.
)
eviction_dirty_targetcontinue evicting until the cache has less dirty memory than the value, as a percentage of the total cache size. Dirty pages will only be evicted if the cache is full enough to trigger eviction.an integer between 10 and 99; default 80.
eviction_targetcontinue evicting until the cache has less total memory than the value, as a percentage of the total cache size. Must be less than eviction_trigger.an integer between 10 and 99; default 80.
eviction_triggertrigger eviction when the cache is using this much memory, as a percentage of the total cache size.an integer between 10 and 99; default 95.
exclusivefail if the database already exists, generally used with the create option.a boolean flag; default false.
extensionslist of shared library extensions to load (using dlopen). Any values specified to an library extension are passed to WT_CONNECTION::load_extension as the config parameter (for example, extensions=(/path/ext.so={entry=my_entry})).a list of strings; default empty.
file_extendfile extension configuration. If set, extend files of the set type in allocations of the set size, instead of a block at a time as each new block is written. For example, file_extend=(data=16MB).a list, with values chosen from the following options: "data", "log"; default empty.
hazard_maxmaximum number of simultaneous hazard pointers per session handle.an integer greater than or equal to 15; default 1000.
log = (enable logging.a set of related configuration options defined below.
    archiveautomatically archive unneeded log files.a boolean flag; default true.
    enabledenable logging subsystem.a boolean flag; default false.
    file_maxthe maximum size of log files.an integer between 100KB and 2GB; default 100MB.
    paththe path to a directory into which the log files are written. If the value is not an absolute path name, the files are created relative to the database home.a string; default "".
)
lsm_manager = (configure database wide options for LSM tree management.a set of related configuration options defined below.
    mergemerge LSM chunks where possible.a boolean flag; default true.
    worker_thread_maxConfigure a set of threads to manage merging LSM trees in the database.an integer between 3 and 20; default 4.
)
mmapUse memory mapping to access files when possible.a boolean flag; default true.
multiprocesspermit sharing between processes (will automatically start an RPC server for primary processes and use RPC for secondary processes). Not yet supported in WiredTiger.a boolean flag; default false.
session_maxmaximum expected number of sessions (including server threads).an integer greater than or equal to 1; default 100.
shared_cache = (shared cache configuration options. A database should configure either a cache_size or a shared_cache not both.a set of related configuration options defined below.
    chunkthe granularity that a shared cache is redistributed.an integer between 1MB and 10TB; default 10MB.
    namename of a cache that is shared between databases.a string; default empty.
    reserveamount of cache this database is guaranteed to have available from the shared cache. This setting is per database. Defaults to the chunk size.an integer; default 0.
    sizemaximum memory to allocate for the shared cache. Setting this will update the value if one is already set.an integer between 1MB and 10TB; default 500MB.
)
statisticsMaintain database statistics, which may impact performance. Choosing "all" maintains all statistics regardless of cost, "fast" maintains a subset of statistics that are relatively inexpensive, "none" turns off all statistics. The "clear" configuration resets statistics after they are gathered, where appropriate (for example, a cache size statistic is not cleared, while the count of cursor insert operations will be cleared). When "clear" is configured for the database, gathered statistics are reset each time a statistics cursor is used to gather statistics, as well as each time statistics are logged using the statistics_log configuration. See Statistics for more information.a list, with values chosen from the following options: "all", "fast", "none", "clear"; default none.
statistics_log = (log any statistics the database is configured to maintain, to a file. See Statistics for more information.a set of related configuration options defined below.
    on_closelog statistics on database close.a boolean flag; default false.
    paththe pathname to a file into which the log records are written, may contain ISO C standard strftime conversion specifications. If the value is not an absolute path name, the file is created relative to the database home.a string; default "WiredTigerStat.%d.%H".
    sourcesif non-empty, include statistics for the list of data source URIs, if they are open at the time of the statistics logging. The list may include URIs matching a single data source ("table:mytable"), or a URI matching all data sources of a particular type ("table:").a list of strings; default empty.
    timestampa timestamp prepended to each log record, may contain strftime conversion specifications.a string; default "%b %d %H:%M:%S".
    waitseconds to wait between each write of the log records.an integer between 0 and 100000; default 0.
)
transaction_sync = (how to sync log records when the transaction commits.a set of related configuration options defined below.
    enabledwhether to sync the log on every commit by default, can be overridden by the sync setting to WT_SESSION::begin_transaction.a boolean flag; default false.
    methodthe method used to ensure log records are stable on disk, see Commit-level durability for more information.a string, chosen from the following options: "dsync", "fsync", "none"; default fsync.
)
use_environment_privuse the WIREDTIGER_CONFIG and WIREDTIGER_HOME environment variables regardless of whether or not the process is running with special privileges. See Database Home Directory for more information.a boolean flag; default false.
verboseenable messages for various events. Only available if WiredTiger is configured with –enable-verbose. Options are given as a list, such as "verbose=[evictserver,read]".a list, with values chosen from the following options: "api", "block", "checkpoint", "compact", "evict", "evictserver", "fileops", "log", "lsm", "metadata", "mutex", "overflow", "read", "reconcile", "recovery", "salvage", "shared_cache", "split", "temporary", "transaction", "verify", "version", "write"; default empty.
Additionally, if files named WiredTiger.config or WiredTiger.basecfg appear in the WiredTiger home directory, they are read for configuration values (see WiredTiger.config file and WiredTiger.basecfg file for details). See Configuration ordering for ordering of the configuration mechanisms.
[out]connectionpA pointer to the newly opened connection handle
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
Examples:
ex_access.c, ex_async.c, ex_call_center.c, ex_config.c, ex_cursor.c, ex_extending.c, ex_extractor.c, ex_file.c, ex_hello.c, ex_log.c, ex_pack.c, ex_schema.c, ex_stat.c, and ex_thread.c.
int wiredtiger_pack_close ( WT_PACK_STREAM ps,
size_t *  usedp 
)

Close a packing stream.

Parameters
psthe packing stream handle
[out]usedpthe number of bytes in the buffer used by the stream
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int wiredtiger_pack_int ( WT_PACK_STREAM ps,
int64_t  i 
)

Pack a signed integer into a packing stream.

Parameters
psthe packing stream handle
ia signed integer to pack
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int wiredtiger_pack_item ( WT_PACK_STREAM ps,
WT_ITEM item 
)

Pack an item into a packing stream.

Parameters
psthe packing stream handle
iteman item to pack
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int wiredtiger_pack_start ( WT_SESSION session,
const char *  format,
void *  buffer,
size_t  size,
WT_PACK_STREAM **  psp 
)

Start a packing operation into a buffer with the given format string.

This should be followed by a series of calls to wiredtiger_pack_item, wiredtiger_pack_int, wiredtiger_pack_str or wiredtiger_pack_uint to fill in the values.

Parameters
sessionthe session handle
formatthe data format, see Packing and Unpacking Data
buffera pointer to memory to hold the packed data
sizethe size of the buffer
[out]pspthe new packing stream handle
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int wiredtiger_pack_str ( WT_PACK_STREAM ps,
const char *  s 
)

Pack a string into a packing stream.

Parameters
psthe packing stream handle
sa string to pack
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int wiredtiger_pack_uint ( WT_PACK_STREAM ps,
uint64_t  u 
)

Pack an unsigned integer into a packing stream.

Parameters
psthe packing stream handle
uan unsigned integer to pack
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
const char* wiredtiger_strerror ( int  err)

Return information about an error as a string; wiredtiger_strerror is a superset of the ISO C99/POSIX 1003.1-2001 function strerror.

const char *key = "non-existent key";
cursor->set_key(cursor, key);
if ((ret = cursor->remove(cursor)) != 0) {
fprintf(stderr,
"cursor.remove: %s\n", wiredtiger_strerror(ret));
return (ret);
}
Parameters
erra return value from a WiredTiger, C library or POSIX function
Returns
a string representation of the error
Examples:
ex_access.c, ex_async.c, ex_call_center.c, ex_config.c, ex_cursor.c, ex_extending.c, ex_file.c, ex_hello.c, ex_log.c, ex_pack.c, ex_schema.c, and ex_thread.c.
int wiredtiger_struct_pack ( WT_SESSION session,
void *  buffer,
size_t  size,
const char *  format,
  ... 
)

Pack a structure into a buffer.

See Packing and Unpacking Data for a description of the permitted format strings.

Packing Examples

For example, the string "iSh" will pack a 32-bit integer followed by a NUL-terminated string, followed by a 16-bit integer. The default, big-endian encoding will be used, with no alignment. This could be used in C as follows:

char buf[100];
session, buf, sizeof(buf), "iSh", 42, "hello", -3);

Then later, the values can be unpacked as follows:

int i;
char *s;
short h;
session, buf, sizeof(buf), "iSh", &i, &s, &h);
Parameters
sessionthe session handle
buffera pointer to a packed byte array
sizethe number of valid bytes in the buffer
formatthe data format, see Packing and Unpacking Data
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
Examples:
ex_pack.c.
int wiredtiger_struct_size ( WT_SESSION session,
size_t *  sizep,
const char *  format,
  ... 
)

Calculate the size required to pack a structure.

Note that for variable-sized fields including variable-sized strings and integers, the calculated sized merely reflects the expected sizes specified in the format string itself.

size_t size;
ret = wiredtiger_struct_size(session, &size, "iSh", 42, "hello", -3);
Parameters
sessionthe session handle
sizepa location where the number of bytes needed for the matching call to wiredtiger_struct_pack is returned
formatthe data format, see Packing and Unpacking Data
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
Examples:
ex_pack.c.
int wiredtiger_struct_unpack ( WT_SESSION session,
const void *  buffer,
size_t  size,
const char *  format,
  ... 
)

Unpack a structure from a buffer.

Reverse of wiredtiger_struct_pack: gets values out of a packed byte string.

int i;
char *s;
short h;
session, buf, sizeof(buf), "iSh", &i, &s, &h);
Parameters
sessionthe session handle
buffera pointer to a packed byte array
sizethe number of valid bytes in the buffer
formatthe data format, see Packing and Unpacking Data
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
Examples:
ex_extractor.c, ex_pack.c, and ex_schema.c.
int wiredtiger_unpack_int ( WT_PACK_STREAM ps,
int64_t *  ip 
)

Unpack a signed integer from a packing stream.

Parameters
psthe packing stream handle
[out]ipthe unpacked signed integer
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int wiredtiger_unpack_item ( WT_PACK_STREAM ps,
WT_ITEM item 
)

Unpack an item from a packing stream.

Parameters
psthe packing stream handle
iteman item to unpack
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int wiredtiger_unpack_start ( WT_SESSION session,
const char *  format,
const void *  buffer,
size_t  size,
WT_PACK_STREAM **  psp 
)

Start an unpacking operation from a buffer with the given format string.

This should be followed by a series of calls to wiredtiger_unpack_item, wiredtiger_unpack_int, wiredtiger_unpack_str or wiredtiger_unpack_uint to retrieve the packed values.

Parameters
sessionthe session handle
formatthe data format, see Packing and Unpacking Data
buffera pointer to memory holding the packed data
sizethe size of the buffer
[out]pspthe new packing stream handle
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int wiredtiger_unpack_str ( WT_PACK_STREAM ps,
const char **  sp 
)

Unpack a string from a packing stream.

Parameters
psthe packing stream handle
[out]spthe unpacked string
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int wiredtiger_unpack_uint ( WT_PACK_STREAM ps,
uint64_t *  up 
)

Unpack an unsigned integer from a packing stream.

Parameters
psthe packing stream handle
[out]upthe unpacked unsigned integer
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
const char* wiredtiger_version ( int *  majorp,
int *  minorp,
int *  patchp 
)

Get version information.

printf("WiredTiger version %s\n", wiredtiger_version(NULL, NULL, NULL));
int major_v, minor_v, patch;
(void)wiredtiger_version(&major_v, &minor_v, &patch);
printf("WiredTiger version is %d, %d (patch %d)\n",
major_v, minor_v, patch);
Parameters
majorpa location where the major version number is returned
minorpa location where the minor version number is returned
patchpa location where the patch version number is returned
Returns
a string representation of the version