diff --git a/c_src/bdberl_drv.h b/c_src/bdberl_drv.h index b26feb9..9718c70 100644 --- a/c_src/bdberl_drv.h +++ b/c_src/bdberl_drv.h @@ -167,7 +167,7 @@ typedef struct TPool* async_pool; /* Pool the async job is running on */ void* work_buffer; - + unsigned int work_buffer_sz; unsigned int work_buffer_offset; diff --git a/include/bdberl.hrl b/include/bdberl.hrl index 4ab2c4c..684fb52 100644 --- a/include/bdberl.hrl +++ b/include/bdberl.hrl @@ -92,258 +92,258 @@ -define(ERROR_INVALID_DB_TYPE,-29009). % Invalid database type %% DB (public, user visible) error return codes. --define(DB_BUFFER_SMALL, -30999). % User memory too small for return. --define(DB_DONOTINDEX, -30998). % "Null" return from 2ndary callbk. --define(DB_FOREIGN_CONFLICT, -30997). % A foreign db constraint triggered. --define(DB_HEAP_FULL, -30996). % No free space in a heap file. --define(DB_KEYEMPTY, -30995). % Key/data deleted or never created. --define(DB_KEYEXIST, -30994). % The key/data pair already exists. --define(DB_LOCK_DEADLOCK, -30993). % Deadlock. --define(DB_LOCK_NOTGRANTED, -30992). % Lock unavailable. --define(DB_LOG_BUFFER_FULL, -30991). % In-memory log buffer full. --define(DB_LOG_VERIFY_BAD, -30990). % Log verification failed. --define(DB_NOSERVER, -30989). % Server panic return. --define(DB_NOTFOUND, -30988). % Key/data pair not found (EOF). --define(DB_OLD_VERSION, -30987). % Out-of-date version. --define(DB_PAGE_NOTFOUND, -30986). % Requested page not found. --define(DB_REP_DUPMASTER, -30985). % There are two masters. --define(DB_REP_HANDLE_DEAD, -30984). % Rolled back a commit. --define(DB_REP_HOLDELECTION, -30983). % Time to hold an election. --define(DB_REP_IGNORE, -30982). % This msg should be ignored --define(DB_REP_ISPERM, -30981). % Cached not written perm written --define(DB_REP_JOIN_FAILURE, -30980). % Unable to join replication group. --define(DB_REP_LEASE_EXPIRED, -30979). % Master lease has expired. --define(DB_REP_LOCKOUT, -30978). % API/Replication lockout now. --define(DB_REP_NEWSITE, -30977). % New site entered system. --define(DB_REP_NOTPERM, -30976). % Permanent log record not written. --define(DB_REP_UNAVAIL, -30975). % Site cannot currently be reached. --define(DB_REP_WOULDROLLBACK, -30974). % UNDOC: rollback inhibited by app. --define(DB_RUNRECOVERY, -30973). % Panic return. --define(DB_SECONDARY_BAD, -30972). % Secondary index corrupt. --define(DB_TIMEOUT, -30971). % Timed out on read consistency. --define(DB_VERIFY_BAD, -30970). % Verify failed; bad format. --define(DB_VERSION_MISMATCH, -30969). % Environment version mismatch. +-define(DB_BUFFER_SMALL, -30999). % User memory too small for return. +-define(DB_DONOTINDEX, -30998). % "Null" return from 2ndary callbk. +-define(DB_FOREIGN_CONFLICT, -30997). % A foreign db constraint triggered. +-define(DB_HEAP_FULL, -30996). % No free space in a heap file. +-define(DB_KEYEMPTY, -30995). % Key/data deleted or never created. +-define(DB_KEYEXIST, -30994). % The key/data pair already exists. +-define(DB_LOCK_DEADLOCK, -30993). % Deadlock. +-define(DB_LOCK_NOTGRANTED, -30992). % Lock unavailable. +-define(DB_LOG_BUFFER_FULL, -30991). % In-memory log buffer full. +-define(DB_LOG_VERIFY_BAD, -30990). % Log verification failed. +-define(DB_NOSERVER, -30989). % Server panic return. +-define(DB_NOTFOUND, -30988). % Key/data pair not found (EOF). +-define(DB_OLD_VERSION, -30987). % Out-of-date version. +-define(DB_PAGE_NOTFOUND, -30986). % Requested page not found. +-define(DB_REP_DUPMASTER, -30985). % There are two masters. +-define(DB_REP_HANDLE_DEAD, -30984). % Rolled back a commit. +-define(DB_REP_HOLDELECTION, -30983). % Time to hold an election. +-define(DB_REP_IGNORE, -30982). % This msg should be ignored +-define(DB_REP_ISPERM, -30981). % Cached not written perm written +-define(DB_REP_JOIN_FAILURE, -30980). % Unable to join replication group. +-define(DB_REP_LEASE_EXPIRED, -30979). % Master lease has expired. +-define(DB_REP_LOCKOUT, -30978). % API/Replication lockout now. +-define(DB_REP_NEWSITE, -30977). % New site entered system. +-define(DB_REP_NOTPERM, -30976). % Permanent log record not written. +-define(DB_REP_UNAVAIL, -30975). % Site cannot currently be reached. +-define(DB_REP_WOULDROLLBACK, -30974). % UNDOC: rollback inhibited by app. +-define(DB_RUNRECOVERY, -30973). % Panic return. +-define(DB_SECONDARY_BAD, -30972). % Secondary index corrupt. +-define(DB_TIMEOUT, -30971). % Timed out on read consistency. +-define(DB_VERIFY_BAD, -30970). % Verify failed; bad format. +-define(DB_VERSION_MISMATCH, -30969). % Environment version mismatch. %% DB API flags --define(DB_AGGRESSIVE, 16#00000001). --define(DB_ARCH_ABS, 16#00000001). --define(DB_ARCH_DATA, 16#00000002). --define(DB_ARCH_LOG, 16#00000004). --define(DB_ARCH_REMOVE, 16#00000008). --define(DB_AUTO_COMMIT, 16#00000100). --define(DB_BOOTSTRAP_HELPER, 16#00000001). --define(DB_CDB_ALLDB, 16#00000040). --define(DB_CHKSUM, 16#00000008). --define(DB_CKP_INTERNAL, 16#00000002). --define(DB_CREATE, 16#00000001). --define(DB_CURSOR_BULK, 16#00000001). --define(DB_CURSOR_TRANSIENT, 16#00000004). --define(DB_CXX_NO_EXCEPTIONS, 16#00000002). --define(DB_DATABASE_LOCKING, 16#00000080). --define(DB_DIRECT, 16#00000010). --define(DB_DIRECT_DB, 16#00000200). --define(DB_DSYNC_DB, 16#00000400). --define(DB_DUP, 16#00000010). --define(DB_DUPSORT, 16#00000004). --define(DB_DURABLE_UNKNOWN, 16#00000020). --define(DB_ENCRYPT, 16#00000001). --define(DB_ENCRYPT_AES, 16#00000001). --define(DB_EXCL, 16#00000040). --define(DB_EXTENT, 16#00000040). --define(DB_FAILCHK, 16#00000020). --define(DB_FAILCHK_ISALIVE, 16#00000040). --define(DB_FAST_STAT, 16#00000001). --define(DB_FCNTL_LOCKING, 16#00000800). --define(DB_FLUSH, 16#00000001). --define(DB_FORCE, 16#00000001). --define(DB_FORCESYNC, 16#00000001). --define(DB_FOREIGN_ABORT, 16#00000001). --define(DB_FOREIGN_CASCADE, 16#00000002). --define(DB_FOREIGN_NULLIFY, 16#00000004). --define(DB_FREELIST_ONLY, 16#00000001). --define(DB_FREE_SPACE, 16#00000002). --define(DB_GROUP_CREATOR, 16#00000002). --define(DB_HOTBACKUP_IN_PROGRESS, 16#00000800). --define(DB_IGNORE_LEASE, 16#00001000). --define(DB_IMMUTABLE_KEY, 16#00000002). --define(DB_INIT_CDB, 16#00000080). --define(DB_INIT_LOCK, 16#00000100). --define(DB_INIT_LOG, 16#00000200). --define(DB_INIT_MPOOL, 16#00000400). --define(DB_INIT_MUTEX, 16#00000800). --define(DB_INIT_REP, 16#00001000). --define(DB_INIT_TXN, 16#00002000). --define(DB_INORDER, 16#00000020). --define(DB_INTERNAL_DB, 16#00001000). --define(DB_JOIN_NOSORT, 16#00000001). --define(DB_LEGACY, 16#00000004). --define(DB_LOCAL_SITE, 16#00000008). --define(DB_LOCKDOWN, 16#00004000). --define(DB_LOCK_CHECK, 16#00000001). --define(DB_LOCK_NOWAIT, 16#00000002). --define(DB_LOCK_RECORD, 16#00000004). --define(DB_LOCK_SET_TIMEOUT, 16#00000008). --define(DB_LOCK_SWITCH, 16#00000010). --define(DB_LOCK_UPGRADE, 16#00000020). --define(DB_LOG_AUTO_REMOVE, 16#00000001). --define(DB_LOG_CHKPNT, 16#00000002). --define(DB_LOG_COMMIT, 16#00000004). --define(DB_LOG_DIRECT, 16#00000002). --define(DB_LOG_DSYNC, 16#00000004). --define(DB_LOG_IN_MEMORY, 16#00000008). --define(DB_LOG_NOCOPY, 16#00000008). --define(DB_LOG_NOT_DURABLE, 16#00000010). --define(DB_LOG_NO_DATA, 16#00000004). --define(DB_LOG_VERIFY_CAF, 16#00000001). --define(DB_LOG_VERIFY_DBFILE, 16#00000002). --define(DB_LOG_VERIFY_ERR, 16#00000004). --define(DB_LOG_VERIFY_FORWARD, 16#00000008). --define(DB_LOG_VERIFY_INTERR, 16#00000010). --define(DB_LOG_VERIFY_PARTIAL, 16#00000020). --define(DB_LOG_VERIFY_VERBOSE, 16#00000040). --define(DB_LOG_VERIFY_WARNING, 16#00000080). --define(DB_LOG_WRNOSYNC, 16#00000020). --define(DB_LOG_ZERO, 16#00000010). --define(DB_MPOOL_CREATE, 16#00000001). --define(DB_MPOOL_DIRTY, 16#00000002). --define(DB_MPOOL_DISCARD, 16#00000001). --define(DB_MPOOL_EDIT, 16#00000004). --define(DB_MPOOL_FREE, 16#00000008). --define(DB_MPOOL_LAST, 16#00000010). --define(DB_MPOOL_NEW, 16#00000020). --define(DB_MPOOL_NOFILE, 16#00000001). --define(DB_MPOOL_NOLOCK, 16#00000002). --define(DB_MPOOL_TRY, 16#00000040). --define(DB_MPOOL_UNLINK, 16#00000002). --define(DB_MULTIPLE, 16#00000800). --define(DB_MULTIPLE_KEY, 16#00004000). --define(DB_MULTIVERSION, 16#00000004). --define(DB_MUTEX_ALLOCATED, 16#00000001). --define(DB_MUTEX_LOCKED, 16#00000002). --define(DB_MUTEX_LOGICAL_LOCK, 16#00000004). --define(DB_MUTEX_PROCESS_ONLY, 16#00000008). --define(DB_MUTEX_SELF_BLOCK, 16#00000010). --define(DB_MUTEX_SHARED, 16#00000020). --define(DB_NOERROR, 16#00002000). --define(DB_NOFLUSH, 16#00001000). --define(DB_NOLOCKING, 16#00002000). --define(DB_NOMMAP, 16#00000008). --define(DB_NOORDERCHK, 16#00000002). --define(DB_NOPANIC, 16#00004000). --define(DB_NOSYNC, 16#00000001). --define(DB_NO_AUTO_COMMIT, 16#00004000). --define(DB_NO_CHECKPOINT, 16#00008000). --define(DB_ODDFILESIZE, 16#00000080). --define(DB_ORDERCHKONLY, 16#00000004). --define(DB_OVERWRITE, 16#00008000). --define(DB_PANIC_ENVIRONMENT, 16#00010000). --define(DB_PRINTABLE, 16#00000008). --define(DB_PRIVATE, 16#00010000). --define(DB_PR_PAGE, 16#00000010). --define(DB_PR_RECOVERYTEST, 16#00000020). --define(DB_RDONLY, 16#00000400). --define(DB_RDWRMASTER, 16#00008000). --define(DB_READ_COMMITTED, 16#00000400). --define(DB_READ_UNCOMMITTED, 16#00000200). --define(DB_RECNUM, 16#00000040). --define(DB_RECOVER, 16#00000002). --define(DB_RECOVER_FATAL, 16#00020000). --define(DB_REGION_INIT, 16#00020000). --define(DB_REGISTER, 16#00040000). --define(DB_RENUMBER, 16#00000080). --define(DB_REPMGR_CONF_2SITE_STRICT, 16#00000001). --define(DB_REPMGR_CONF_ELECTIONS, 16#00000002). --define(DB_REPMGR_NEED_RESPONSE, 16#00000001). --define(DB_REPMGR_PEER, 16#00000010). --define(DB_REP_ANYWHERE, 16#00000001). --define(DB_REP_CLIENT, 16#00000001). --define(DB_REP_CONF_AUTOINIT, 16#00000004). --define(DB_REP_CONF_AUTOROLLBACK, 16#00000008). --define(DB_REP_CONF_BULK, 16#00000010). --define(DB_REP_CONF_DELAYCLIENT, 16#00000020). --define(DB_REP_CONF_INMEM, 16#00000040). --define(DB_REP_CONF_LEASE, 16#00000080). --define(DB_REP_CONF_NOWAIT, 16#00000100). --define(DB_REP_ELECTION, 16#00000004). --define(DB_REP_MASTER, 16#00000002). --define(DB_REP_NOBUFFER, 16#00000002). --define(DB_REP_PERMANENT, 16#00000004). --define(DB_REP_REREQUEST, 16#00000008). --define(DB_REVSPLITOFF, 16#00000100). --define(DB_RMW, 16#00002000). --define(DB_SALVAGE, 16#00000040). --define(DB_SA_SKIPFIRSTKEY, 16#00000080). --define(DB_SA_UNKNOWNKEY, 16#00000100). --define(DB_SEQ_DEC, 16#00000001). --define(DB_SEQ_INC, 16#00000002). --define(DB_SEQ_RANGE_SET, 16#00000004). --define(DB_SEQ_WRAP, 16#00000008). --define(DB_SEQ_WRAPPED, 16#00000010). --define(DB_SET_LOCK_TIMEOUT, 16#00000001). --define(DB_SET_REG_TIMEOUT, 16#00000004). --define(DB_SET_TXN_NOW, 16#00000008). --define(DB_SET_TXN_TIMEOUT, 16#00000002). --define(DB_SHALLOW_DUP, 16#00000100). --define(DB_SNAPSHOT, 16#00000200). --define(DB_STAT_ALL, 16#00000004). --define(DB_STAT_ALLOC, 16#00000008). --define(DB_STAT_CLEAR, 16#00000001). --define(DB_STAT_LOCK_CONF, 16#00000010). --define(DB_STAT_LOCK_LOCKERS, 16#00000020). --define(DB_STAT_LOCK_OBJECTS, 16#00000040). --define(DB_STAT_LOCK_PARAMS, 16#00000080). --define(DB_STAT_MEMP_HASH, 16#00000010). --define(DB_STAT_MEMP_NOERROR, 16#00000020). --define(DB_STAT_SUBSYSTEM, 16#00000002). --define(DB_STAT_SUMMARY, 16#00000010). --define(DB_ST_DUPOK, 16#00000200). --define(DB_ST_DUPSET, 16#00000400). --define(DB_ST_DUPSORT, 16#00000800). --define(DB_ST_IS_RECNO, 16#00001000). --define(DB_ST_OVFL_LEAF, 16#00002000). --define(DB_ST_RECNUM, 16#00004000). --define(DB_ST_RELEN, 16#00008000). --define(DB_ST_TOPLEVEL, 16#00010000). --define(DB_SYSTEM_MEM, 16#00080000). --define(DB_THREAD, 16#00000010). --define(DB_TIME_NOTGRANTED, 16#00040000). --define(DB_TRUNCATE, 16#00010000). --define(DB_TXN_BULK, 16#00000008). --define(DB_TXN_FAMILY, 16#00000040). --define(DB_TXN_NOSYNC, 16#00000001). --define(DB_TXN_NOT_DURABLE, 16#00000002). --define(DB_TXN_NOWAIT, 16#00000002). --define(DB_TXN_SNAPSHOT, 16#00000010). --define(DB_TXN_SYNC, 16#00000004). --define(DB_TXN_WAIT, 16#00000080). --define(DB_TXN_WRITE_NOSYNC, 16#00000020). --define(DB_UNREF, 16#00020000). --define(DB_UPGRADE, 16#00000001). --define(DB_USE_ENVIRON, 16#00000004). --define(DB_USE_ENVIRON_ROOT, 16#00000008). --define(DB_VERB_DEADLOCK, 16#00000001). --define(DB_VERB_FILEOPS, 16#00000002). --define(DB_VERB_FILEOPS_ALL, 16#00000004). --define(DB_VERB_RECOVERY, 16#00000008). --define(DB_VERB_REGISTER, 16#00000010). --define(DB_VERB_REPLICATION, 16#00000020). --define(DB_VERB_REPMGR_CONNFAIL, 16#00000040). --define(DB_VERB_REPMGR_MISC, 16#00000080). --define(DB_VERB_REP_ELECT, 16#00000100). --define(DB_VERB_REP_LEASE, 16#00000200). --define(DB_VERB_REP_MISC, 16#00000400). --define(DB_VERB_REP_MSGS, 16#00000800). --define(DB_VERB_REP_SYNC, 16#00001000). --define(DB_VERB_REP_SYSTEM, 16#00002000). --define(DB_VERB_REP_TEST, 16#00004000). --define(DB_VERB_WAITSFOR, 16#00008000). --define(DB_VERIFY, 16#00000002). --define(DB_VERIFY_PARTITION, 16#00040000). --define(DB_WRITECURSOR, 16#00000008). --define(DB_WRITELOCK, 16#00000020). --define(DB_WRITEOPEN, 16#00020000). --define(DB_XA_CREATE, 16#00000001). --define(DB_YIELDCPU, 16#00080000). +-define(DB_AGGRESSIVE, 16#00000001). +-define(DB_ARCH_ABS, 16#00000001). +-define(DB_ARCH_DATA, 16#00000002). +-define(DB_ARCH_LOG, 16#00000004). +-define(DB_ARCH_REMOVE, 16#00000008). +-define(DB_AUTO_COMMIT, 16#00000100). +-define(DB_BOOTSTRAP_HELPER, 16#00000001). +-define(DB_CDB_ALLDB, 16#00000040). +-define(DB_CHKSUM, 16#00000008). +-define(DB_CKP_INTERNAL, 16#00000002). +-define(DB_CREATE, 16#00000001). +-define(DB_CURSOR_BULK, 16#00000001). +-define(DB_CURSOR_TRANSIENT, 16#00000004). +-define(DB_CXX_NO_EXCEPTIONS, 16#00000002). +-define(DB_DATABASE_LOCKING, 16#00000080). +-define(DB_DIRECT, 16#00000010). +-define(DB_DIRECT_DB, 16#00000200). +-define(DB_DSYNC_DB, 16#00000400). +-define(DB_DUP, 16#00000010). +-define(DB_DUPSORT, 16#00000004). +-define(DB_DURABLE_UNKNOWN, 16#00000020). +-define(DB_ENCRYPT, 16#00000001). +-define(DB_ENCRYPT_AES, 16#00000001). +-define(DB_EXCL, 16#00000040). +-define(DB_EXTENT, 16#00000040). +-define(DB_FAILCHK, 16#00000020). +-define(DB_FAILCHK_ISALIVE, 16#00000040). +-define(DB_FAST_STAT, 16#00000001). +-define(DB_FCNTL_LOCKING, 16#00000800). +-define(DB_FLUSH, 16#00000001). +-define(DB_FORCE, 16#00000001). +-define(DB_FORCESYNC, 16#00000001). +-define(DB_FOREIGN_ABORT, 16#00000001). +-define(DB_FOREIGN_CASCADE, 16#00000002). +-define(DB_FOREIGN_NULLIFY, 16#00000004). +-define(DB_FREELIST_ONLY, 16#00000001). +-define(DB_FREE_SPACE, 16#00000002). +-define(DB_GROUP_CREATOR, 16#00000002). +-define(DB_HOTBACKUP_IN_PROGRESS, 16#00000800). +-define(DB_IGNORE_LEASE, 16#00001000). +-define(DB_IMMUTABLE_KEY, 16#00000002). +-define(DB_INIT_CDB, 16#00000080). +-define(DB_INIT_LOCK, 16#00000100). +-define(DB_INIT_LOG, 16#00000200). +-define(DB_INIT_MPOOL, 16#00000400). +-define(DB_INIT_MUTEX, 16#00000800). +-define(DB_INIT_REP, 16#00001000). +-define(DB_INIT_TXN, 16#00002000). +-define(DB_INORDER, 16#00000020). +-define(DB_INTERNAL_DB, 16#00001000). +-define(DB_JOIN_NOSORT, 16#00000001). +-define(DB_LEGACY, 16#00000004). +-define(DB_LOCAL_SITE, 16#00000008). +-define(DB_LOCKDOWN, 16#00004000). +-define(DB_LOCK_CHECK, 16#00000001). +-define(DB_LOCK_NOWAIT, 16#00000002). +-define(DB_LOCK_RECORD, 16#00000004). +-define(DB_LOCK_SET_TIMEOUT, 16#00000008). +-define(DB_LOCK_SWITCH, 16#00000010). +-define(DB_LOCK_UPGRADE, 16#00000020). +-define(DB_LOG_AUTO_REMOVE, 16#00000001). +-define(DB_LOG_CHKPNT, 16#00000002). +-define(DB_LOG_COMMIT, 16#00000004). +-define(DB_LOG_DIRECT, 16#00000002). +-define(DB_LOG_DSYNC, 16#00000004). +-define(DB_LOG_IN_MEMORY, 16#00000008). +-define(DB_LOG_NOCOPY, 16#00000008). +-define(DB_LOG_NOT_DURABLE, 16#00000010). +-define(DB_LOG_NO_DATA, 16#00000004). +-define(DB_LOG_VERIFY_CAF, 16#00000001). +-define(DB_LOG_VERIFY_DBFILE, 16#00000002). +-define(DB_LOG_VERIFY_ERR, 16#00000004). +-define(DB_LOG_VERIFY_FORWARD, 16#00000008). +-define(DB_LOG_VERIFY_INTERR, 16#00000010). +-define(DB_LOG_VERIFY_PARTIAL, 16#00000020). +-define(DB_LOG_VERIFY_VERBOSE, 16#00000040). +-define(DB_LOG_VERIFY_WARNING, 16#00000080). +-define(DB_LOG_WRNOSYNC, 16#00000020). +-define(DB_LOG_ZERO, 16#00000010). +-define(DB_MPOOL_CREATE, 16#00000001). +-define(DB_MPOOL_DIRTY, 16#00000002). +-define(DB_MPOOL_DISCARD, 16#00000001). +-define(DB_MPOOL_EDIT, 16#00000004). +-define(DB_MPOOL_FREE, 16#00000008). +-define(DB_MPOOL_LAST, 16#00000010). +-define(DB_MPOOL_NEW, 16#00000020). +-define(DB_MPOOL_NOFILE, 16#00000001). +-define(DB_MPOOL_NOLOCK, 16#00000002). +-define(DB_MPOOL_TRY, 16#00000040). +-define(DB_MPOOL_UNLINK, 16#00000002). +-define(DB_MULTIPLE, 16#00000800). +-define(DB_MULTIPLE_KEY, 16#00004000). +-define(DB_MULTIVERSION, 16#00000004). +-define(DB_MUTEX_ALLOCATED, 16#00000001). +-define(DB_MUTEX_LOCKED, 16#00000002). +-define(DB_MUTEX_LOGICAL_LOCK, 16#00000004). +-define(DB_MUTEX_PROCESS_ONLY, 16#00000008). +-define(DB_MUTEX_SELF_BLOCK, 16#00000010). +-define(DB_MUTEX_SHARED, 16#00000020). +-define(DB_NOERROR, 16#00002000). +-define(DB_NOFLUSH, 16#00001000). +-define(DB_NOLOCKING, 16#00002000). +-define(DB_NOMMAP, 16#00000008). +-define(DB_NOORDERCHK, 16#00000002). +-define(DB_NOPANIC, 16#00004000). +-define(DB_NOSYNC, 16#00000001). +-define(DB_NO_AUTO_COMMIT, 16#00004000). +-define(DB_NO_CHECKPOINT, 16#00008000). +-define(DB_ODDFILESIZE, 16#00000080). +-define(DB_ORDERCHKONLY, 16#00000004). +-define(DB_OVERWRITE, 16#00008000). +-define(DB_PANIC_ENVIRONMENT, 16#00010000). +-define(DB_PRINTABLE, 16#00000008). +-define(DB_PRIVATE, 16#00010000). +-define(DB_PR_PAGE, 16#00000010). +-define(DB_PR_RECOVERYTEST, 16#00000020). +-define(DB_RDONLY, 16#00000400). +-define(DB_RDWRMASTER, 16#00008000). +-define(DB_READ_COMMITTED, 16#00000400). +-define(DB_READ_UNCOMMITTED, 16#00000200). +-define(DB_RECNUM, 16#00000040). +-define(DB_RECOVER, 16#00000002). +-define(DB_RECOVER_FATAL, 16#00020000). +-define(DB_REGION_INIT, 16#00020000). +-define(DB_REGISTER, 16#00040000). +-define(DB_RENUMBER, 16#00000080). +-define(DB_REPMGR_CONF_2SITE_STRICT, 16#00000001). +-define(DB_REPMGR_CONF_ELECTIONS, 16#00000002). +-define(DB_REPMGR_NEED_RESPONSE, 16#00000001). +-define(DB_REPMGR_PEER, 16#00000010). +-define(DB_REP_ANYWHERE, 16#00000001). +-define(DB_REP_CLIENT, 16#00000001). +-define(DB_REP_CONF_AUTOINIT, 16#00000004). +-define(DB_REP_CONF_AUTOROLLBACK, 16#00000008). +-define(DB_REP_CONF_BULK, 16#00000010). +-define(DB_REP_CONF_DELAYCLIENT, 16#00000020). +-define(DB_REP_CONF_INMEM, 16#00000040). +-define(DB_REP_CONF_LEASE, 16#00000080). +-define(DB_REP_CONF_NOWAIT, 16#00000100). +-define(DB_REP_ELECTION, 16#00000004). +-define(DB_REP_MASTER, 16#00000002). +-define(DB_REP_NOBUFFER, 16#00000002). +-define(DB_REP_PERMANENT, 16#00000004). +-define(DB_REP_REREQUEST, 16#00000008). +-define(DB_REVSPLITOFF, 16#00000100). +-define(DB_RMW, 16#00002000). +-define(DB_SALVAGE, 16#00000040). +-define(DB_SA_SKIPFIRSTKEY, 16#00000080). +-define(DB_SA_UNKNOWNKEY, 16#00000100). +-define(DB_SEQ_DEC, 16#00000001). +-define(DB_SEQ_INC, 16#00000002). +-define(DB_SEQ_RANGE_SET, 16#00000004). +-define(DB_SEQ_WRAP, 16#00000008). +-define(DB_SEQ_WRAPPED, 16#00000010). +-define(DB_SET_LOCK_TIMEOUT, 16#00000001). +-define(DB_SET_REG_TIMEOUT, 16#00000004). +-define(DB_SET_TXN_NOW, 16#00000008). +-define(DB_SET_TXN_TIMEOUT, 16#00000002). +-define(DB_SHALLOW_DUP, 16#00000100). +-define(DB_SNAPSHOT, 16#00000200). +-define(DB_STAT_ALL, 16#00000004). +-define(DB_STAT_ALLOC, 16#00000008). +-define(DB_STAT_CLEAR, 16#00000001). +-define(DB_STAT_LOCK_CONF, 16#00000010). +-define(DB_STAT_LOCK_LOCKERS, 16#00000020). +-define(DB_STAT_LOCK_OBJECTS, 16#00000040). +-define(DB_STAT_LOCK_PARAMS, 16#00000080). +-define(DB_STAT_MEMP_HASH, 16#00000010). +-define(DB_STAT_MEMP_NOERROR, 16#00000020). +-define(DB_STAT_SUBSYSTEM, 16#00000002). +-define(DB_STAT_SUMMARY, 16#00000010). +-define(DB_ST_DUPOK, 16#00000200). +-define(DB_ST_DUPSET, 16#00000400). +-define(DB_ST_DUPSORT, 16#00000800). +-define(DB_ST_IS_RECNO, 16#00001000). +-define(DB_ST_OVFL_LEAF, 16#00002000). +-define(DB_ST_RECNUM, 16#00004000). +-define(DB_ST_RELEN, 16#00008000). +-define(DB_ST_TOPLEVEL, 16#00010000). +-define(DB_SYSTEM_MEM, 16#00080000). +-define(DB_THREAD, 16#00000010). +-define(DB_TIME_NOTGRANTED, 16#00040000). +-define(DB_TRUNCATE, 16#00010000). +-define(DB_TXN_BULK, 16#00000008). +-define(DB_TXN_FAMILY, 16#00000040). +-define(DB_TXN_NOSYNC, 16#00000001). +-define(DB_TXN_NOT_DURABLE, 16#00000002). +-define(DB_TXN_NOWAIT, 16#00000002). +-define(DB_TXN_SNAPSHOT, 16#00000010). +-define(DB_TXN_SYNC, 16#00000004). +-define(DB_TXN_WAIT, 16#00000080). +-define(DB_TXN_WRITE_NOSYNC, 16#00000020). +-define(DB_UNREF, 16#00020000). +-define(DB_UPGRADE, 16#00000001). +-define(DB_USE_ENVIRON, 16#00000004). +-define(DB_USE_ENVIRON_ROOT, 16#00000008). +-define(DB_VERB_DEADLOCK, 16#00000001). +-define(DB_VERB_FILEOPS, 16#00000002). +-define(DB_VERB_FILEOPS_ALL, 16#00000004). +-define(DB_VERB_RECOVERY, 16#00000008). +-define(DB_VERB_REGISTER, 16#00000010). +-define(DB_VERB_REPLICATION, 16#00000020). +-define(DB_VERB_REPMGR_CONNFAIL, 16#00000040). +-define(DB_VERB_REPMGR_MISC, 16#00000080). +-define(DB_VERB_REP_ELECT, 16#00000100). +-define(DB_VERB_REP_LEASE, 16#00000200). +-define(DB_VERB_REP_MISC, 16#00000400). +-define(DB_VERB_REP_MSGS, 16#00000800). +-define(DB_VERB_REP_SYNC, 16#00001000). +-define(DB_VERB_REP_SYSTEM, 16#00002000). +-define(DB_VERB_REP_TEST, 16#00004000). +-define(DB_VERB_WAITSFOR, 16#00008000). +-define(DB_VERIFY, 16#00000002). +-define(DB_VERIFY_PARTITION, 16#00040000). +-define(DB_WRITECURSOR, 16#00000008). +-define(DB_WRITELOCK, 16#00000020). +-define(DB_WRITEOPEN, 16#00020000). +-define(DB_XA_CREATE, 16#00000001). +-define(DB_YIELDCPU, 16#00080000). %% DB access method and cursor operation values. Each value is an operation %% code to which additional bit flags are added. diff --git a/src/bdberl.erl b/src/bdberl.erl index 11b0495..957e068 100644 --- a/src/bdberl.erl +++ b/src/bdberl.erl @@ -54,7 +54,7 @@ mutex_stat_print/0, mutex_stat_print/1, txn_stat/0, txn_stat/1, txn_stat_print/0, txn_stat_print/1, - env_stat_print/0, env_stat_print/1, + env_stat_print/0, env_stat_print/1, transaction/1, transaction/2, transaction/3, transaction/4, put/3, put/4, put_r/3, put_r/4, @@ -552,9 +552,10 @@ transaction(Fun, Retries, Opts) -> %% %% @end %%-------------------------------------------------------------------- --spec transaction(Fun :: db_txn_fun(), Retries :: db_txn_retries(), +-spec transaction(Fun :: db_txn_fun(), Retries :: db_txn_retries(), TimeLeft :: db_txn_timeleft(), Opts :: db_flags()) -> {ok, db_value()} | db_txn_error(). + transaction(_Fun, _Retries, TimeLeft, _Opts) when TimeLeft =/= infinity, TimeLeft < 0 -> {error, {transaction_failed, time_limit_reached}}; @@ -1082,7 +1083,7 @@ update(Db, Key, Fun, Args, Opts) -> %% @see update/7 %% @end %%-------------------------------------------------------------------- --spec update(Db :: db(), Key :: db_key(), Fun :: db_update_fun(), Args :: db_update_fun_args(), +-spec update(Db :: db(), Key :: db_key(), Fun :: db_update_fun(), Args :: db_update_fun_args(), Retries :: db_txn_retries(), Opts :: db_flags()) -> {ok, db_value()} | db_txn_error(). @@ -1113,7 +1114,7 @@ update(Db, Key, Fun, Args, Retries, Opts) -> %% %% @end %%-------------------------------------------------------------------- --spec update(Db :: db(), Key :: db_key(), Fun :: db_update_fun(), Args :: db_update_fun_args(), +-spec update(Db :: db(), Key :: db_key(), Fun :: db_update_fun(), Args :: db_update_fun_args(), Retries :: db_txn_retries(), TimeLeft :: db_txn_timeleft(), Opts :: db_flags()) -> {ok, db_value()} | db_txn_error(). @@ -1470,26 +1471,26 @@ get_txn_timeout() -> %% @doc %% Retrieve database stats %% -%% This function retrieves database statistics +%% This function retrieves database statistics %% %% === Options === %% %%
%%
fast_stat
-%%
Return only the values which do not require traversal of the database. +%%
Return only the values which do not require traversal of the database. %% Among other things, this flag makes it possible for applications to -%% request key and record counts without incurring the performance +%% request key and record counts without incurring the performance %% penalty of traversing the entire database.
%%
read_committed
-%%
Database items read during a transactional call will have degree 2 +%%
Database items read during a transactional call will have degree 2 %% isolation. This ensures the stability of the data items read during %% the stat operation but permits that data to be modified or deleted by -%% other transactions prior to the commit of the specified +%% other transactions prior to the commit of the specified %% transaction.
%%
read_uncommitted
-%%
Database items read during a transactional call will have degree 1 -%% isolation, including modified but not yet committed data. Silently -%% ignored if the read_committed flag was not specified when the +%%
Database items read during a transactional call will have degree 1 +%% isolation, including modified but not yet committed data. Silently +%% ignored if the read_committed flag was not specified when the %% underlying database was opened.
%%
%% @@ -1536,20 +1537,20 @@ stat(Db) -> %% %%
%%
fast_stat
-%%
Return only the values which do not require traversal of the database. +%%
Return only the values which do not require traversal of the database. %% Among other things, this flag makes it possible for applications to -%% request key and record counts without incurring the performance +%% request key and record counts without incurring the performance %% penalty of traversing the entire database.
%%
read_committed
-%%
Database items read during a transactional call will have degree 2 +%%
Database items read during a transactional call will have degree 2 %% isolation. This ensures the stability of the data items read during %% the stat operation but permits that data to be modified or deleted by %% other transactions prior to the commit of the specified transaction. %%
%%
read_uncommitted
-%%
Database items read during a transactional call will have degree 1 -%% isolation, including modified but not yet committed data. Silently -%% ignored if the read_committed flag was not specified when the +%%
Database items read during a transactional call will have degree 1 +%% isolation, including modified but not yet committed data. Silently +%% ignored if the read_committed flag was not specified when the %% underlying database was opened.
%%
%% @@ -2164,7 +2165,7 @@ init() -> _ -> ok end, - + Port = open_port({spawn, bdberl_drv}, [binary]), erlang:put(bdb_port, Port), Port. @@ -2221,28 +2222,29 @@ process_flags([Flag|Flags]) -> %% flag_value(Flag) -> case Flag of - append -> ?DB_APPEND; - auto_commit -> ?DB_AUTO_COMMIT; - consume -> ?DB_CONSUME; - consume_wait -> ?DB_CONSUME_WAIT; - create -> ?DB_CREATE; - exclusive -> ?DB_EXCL; - fast_stat -> ?DB_FAST_STAT; - get_both -> ?DB_GET_BOTH; - ignore_lease -> ?DB_IGNORE_LEASE; - multiple -> ?DB_MULTIPLE; - multiversion -> ?DB_MULTIVERSION; - no_duplicate -> ?DB_NODUPDATA; - no_mmap -> ?DB_NOMMAP; - no_overwrite -> ?DB_NOOVERWRITE; - read_committed -> ?DB_READ_COMMITTED; - read_uncommitted -> ?DB_READ_UNCOMMITTED; - readonly -> ?DB_RDONLY; - rmw -> ?DB_RMW; - set_recno -> ?DB_SET_RECNO; - stat_all -> ?DB_STAT_ALL; - stat_clear -> ?DB_STAT_CLEAR; - stat_lock_conf -> ?DB_STAT_LOCK_CONF; + append -> ?DB_APPEND; + auto_commit -> ?DB_AUTO_COMMIT; + consume -> ?DB_CONSUME; + consume_wait -> ?DB_CONSUME_WAIT; + create -> ?DB_CREATE; + exclusive -> ?DB_EXCL; + fast_stat -> ?DB_FAST_STAT; + get_both -> ?DB_GET_BOTH; + ignore_lease -> ?DB_IGNORE_LEASE; + multiple -> ?DB_MULTIPLE; + multiple_key -> ?DB_MULTIPLE_KEY; + multiversion -> ?DB_MULTIVERSION; + no_duplicate -> ?DB_NODUPDATA; + no_mmap -> ?DB_NOMMAP; + no_overwrite -> ?DB_NOOVERWRITE; + read_committed -> ?DB_READ_COMMITTED; + read_uncommitted -> ?DB_READ_UNCOMMITTED; + readonly -> ?DB_RDONLY; + rmw -> ?DB_RMW; + set_recno -> ?DB_SET_RECNO; + stat_all -> ?DB_STAT_ALL; + stat_clear -> ?DB_STAT_CLEAR; + stat_lock_conf -> ?DB_STAT_LOCK_CONF; stat_lock_lockers -> ?DB_STAT_LOCK_LOCKERS; stat_lock_objects -> ?DB_STAT_LOCK_OBJECTS; stat_lock_params -> ?DB_STAT_LOCK_PARAMS; @@ -2353,14 +2355,14 @@ recv_dirs_info(DirInfos) -> ok -> {ok, DirInfos} end. - + %% %% Receive an ok or an {error, Reason} pair if Rc is ok %% recv_ok(Rc) -> case decode_rc(Rc) of ok -> - receive + receive ok -> ok; {error, Reason} -> @@ -2376,7 +2378,7 @@ recv_ok(Rc) -> recv_val(Rc) -> case decode_rc(Rc) of ok -> - receive + receive {ok, Val} -> {ok, Val}; {error, Reason} -> diff --git a/test/bdberl_SUITE.erl b/test/bdberl_SUITE.erl index df1a4b3..185b7dc 100644 --- a/test/bdberl_SUITE.erl +++ b/test/bdberl_SUITE.erl @@ -317,7 +317,7 @@ hash_stat_should_report_on_success(_Config) -> 1 = proplists:get_value(nkeys, Stat1), 1 = proplists:get_value(ndata, Stat1), done. - + stat_should_fail_on_bad_dbref(_Config) -> {error, invalid_db} = bdberl:stat(10000000, []), done. @@ -357,7 +357,7 @@ data_dirs_info_should_report_on_success(_Config) -> lg_dir_info_should_report_on_success(_Config) -> {ok, _LgDir, _Fsid, _MBytesAvail} = bdberl:get_lg_dir_info(). - + %% Check the bdberl_logger gets reinstalled after stopping start_after_stop_should_be_safe(_Config) -> @@ -386,5 +386,5 @@ start_after_stop_should_be_safe(_Config) -> end, true = lists:keymember(bdberl_logger, 1, supervisor:which_children(kernel_safe_sup)), ok. - +