Import BSDDB 4.7.25 (as of svn r89086)

This commit is contained in:
Zachary Ware
2017-09-04 13:40:25 -05:00
parent 4b29e0458f
commit 8f590873d0
4781 changed files with 2241032 additions and 6 deletions

21
docs_src/lock/Makefile Normal file
View File

@@ -0,0 +1,21 @@
# $Id: Makefile,v 1.7 2008/01/28 23:59:30 sarette Exp $
COMMON= env_cdsgroup_begin.html \
env_set_lk_conflicts.html \
env_set_lk_detect.html \
env_set_lk_max_lockers.html \
env_set_lk_max_locks.html \
env_set_lk_max_objects.html \
env_set_lk_partitions.html \
lock_class.html \
lock_detect.html \
lock_get.html \
lock_id.html \
lock_id_free.html \
lock_list.html \
lock_put.html \
lock_stat.html \
lock_vec.html
CXX= deadlock_class.html \
lockng_class.html

View File

@@ -0,0 +1,27 @@
m4_comment([$Id: deadlock_class.so,v 10.17 2004/08/13 03:38:57 bostic Exp $])
define(M4PAGELOCAL, DbDeadlockException)
include(m4/m4.seealso)
m4_pf_header(m4_ref(DbDeadlockException),
ifelse(M4API, C_API, [dnl
])
ifelse(M4API, CXX_API, [dnl
class DbDeadlockException : public DbException { ... };
]))
m4_p([dnl
This information describes the m4_ref(DbDeadlockException) class and how
it is used in the m4_db library.])
m4_p([dnl
A m4_ref(DbDeadlockException) is thrown when multiple threads competing
for a lock are deadlocked, when a lock request has timed out, or when a
lock request would need to block and the transaction has been configured
to not wait for locks. One of the threads' transactions is selected for
termination, and a m4_ref(DbDeadlockException) is thrown to that thread.])
m4_p([dnl
The m4_ref(DbException) errno value is set to DB_LOCK_DEADLOCK.])
m4_page_footer

View File

@@ -0,0 +1,36 @@
m4_comment([$Id: env_cdsgroup_begin.so,v 1.3 2008/04/09 20:31:41 sarette Exp $])
define(M4PAGELOCAL, [cdsgroup_begin])
include(m4/m4.seealso)
m4_pf_header(m4_ref(cdsgroup_begin),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__cdsgroup_begin(DB_ENV *dbenv, DB_TXN **tid);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::cdsgroup_begin(DbTxn **tid);
]))
m4_idefz([allocate a @locker ID for m4_cam])
m4_p([dnl
The m4_ref(cdsgroup_begin) method allocates a locker ID in an
environment configured for m4_cam applications. It copies a pointer to
a m4_ref(DbTxn) that uniquely identifies the locker ID into the memory
to which m4_arg(tid) refers. Calling the m4_refT(txn_commit) will
discard the allocated locker ID.])
m4_p([dnl
See m4_link(M4RELDIR/ref/cam/intro, [m4_cam applications]) for more
information about when this is required.])
m4_when_any(cdsgroup_begin)
m4_return(cdsgroup_begin, std)
m4_err(cdsgroup_begin, memory,
[maximum number of lockers has been reached])
m4_seealso(DbTxn)
m4_page_footer

View File

@@ -0,0 +1,69 @@
m4_comment([$Id: env_set_lk_conflicts.so,v 10.43 2004/09/28 15:04:20 bostic Exp $])
define(M4PAGELOCAL, [dbenv_set_lk_conflicts, dbenv_get_lk_conflicts])
include(m4/m4.seealso)
m4_pf_header(m4_ref(dbenv_set_lk_conflicts),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__set_lk_conflicts(DB_ENV *dbenv,
u_int8_t *conflicts, int nmodes);
m4_blank
int
DB_ENV-__GT__get_lk_conflicts(DB_ENV *dbenv,
const u_int8_t **lk_conflictsp, int *lk_modesp);
])dnl
ifelse(M4API, CXX_API, [dnl
int
DbEnv::set_lk_conflicts(u_int8_t *conflicts, int nmodes);
m4_blank
int
DbEnv::get_lk_conflicts(const u_int8_t **lk_conflictsp, int *lk_modesp);
]))
m4_p([dnl
Set the locking conflicts matrix.])
m4_p([dnl
If m4_ref(dbenv_set_lk_conflicts) is never called, a standard conflicts
array is used; see m4_link(M4RELDIR/ref/lock/stdmode, [Standard Lock
Modes]) for more information.])
m4_scope_env(dbenv_set_lk_conflicts)
m4_when_envopen(dbenv_set_lk_conflicts, ignored)
m4_return(dbenv_set_lk_conflicts, std)
m4_parambegin
m4_param(conflicts, [dnl
The m4_arg(conflicts) parameter is the new locking conflicts matrix.
The m4_arg(conflicts) parameter is an m4_arg(nmodes) by m4_arg(nmodes)
array. A non-0 value for the array element indicates that
requested_mode and held_mode conflict:
m4_indent([conflicts__LB__requested_mode__RB____LB__held_mode__RB__])
m4_p([dnl
The m4_italic(not-granted) mode must be represented by 0.])])
m4_param(nmodes, [dnl
The m4_arg(nmodes) parameter is the size of the lock conflicts matrix.])
m4_paramend
m4_err(dbenv_set_lk_conflicts,
einval, [the method was called after m4_ref(dbenv_open) was called],
memory, [conflicts array could not be copied])
m4_pf_description(dbenv_get_lk_conflicts)
m4_p([dnl
The m4_refT(dbenv_get_lk_conflicts) returns the current conflicts array.])
m4_when_any(dbenv_get_lk_conflicts)
m4_return(dbenv_get_lk_conflicts, std)
m4_parambegin
m4_param_co(lk_conflictsp, current conflicts array, REF)
m4_param_co(lk_modesp, size of the current conflicts array)
m4_paramend
m4_seealso(DbLock)
m4_page_footer

View File

@@ -0,0 +1,53 @@
m4_comment([$Id: env_set_lk_detect.so,v 10.50 2006/02/27 14:51:30 bostic Exp $])
define(M4PAGELOCAL, [dbenv_set_lk_detect, dbenv_get_lk_detect, DB_LOCK_EXPIRE])
include(m4/m4.seealso)
m4_pf_header(m4_ref(dbenv_set_lk_detect),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__set_lk_detect(DB_ENV *dbenv, u_int32_t detect);
m4_blank
int
DB_ENV-__GT__get_lk_detect(DB_ENV *dbenv, u_int32_t *lk_detectp);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::set_lk_detect(u_int32_t detect);
m4_blank
int
DbEnv::get_lk_detect(u_int32_t *lk_detectp);
]))
m4_p([dnl
Set if the deadlock detector is to be run whenever a lock conflict
occurs, and specify what lock request(s) should be rejected. As
transactions acquire locks on behalf of a single locker ID, rejecting a
lock request associated with a transaction normally requires the
transaction be aborted.])
m4_env_config(dbenv_set_lk_detect,
[deadlock detector configuration], set_lk_detect, [dnl
the method m4_arg(detect) parameter as a string; for example,
"set_lk_detect DB_LOCK_OLDEST"])
m4_scope_env(dbenv_set_lk_detect)
m4_when_any(dbenv_set_lk_detect)
m4_return(dbenv_set_lk_detect, std)
m4_parambegin
m4_param(detect, [dnl
The m4_arg(detect) parameter configures the deadlock detector. The
specified value must be one of the following list:
m4_lk_detect_flags])
m4_paramend
m4_err(dbenv_set_lk_detect, einval)
m4_pf_getter(dbenv_get_lk_detect, deadlock detector configuration,, lk_detectp)
m4_seealso(DbLock)
m4_page_footer

View File

@@ -0,0 +1,51 @@
m4_comment([$Id: env_set_lk_max_lockers.so,v 1.23 2004/09/28 15:04:20 bostic Exp $])
define(M4PAGELOCAL, [dbenv_set_lk_max_lockers, dbenv_get_lk_max_lockers])
include(m4/m4.seealso)
m4_pf_header(m4_ref(dbenv_set_lk_max_lockers),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__set_lk_max_lockers(DB_ENV *dbenv, u_int32_t max);
m4_blank
int
DB_ENV-__GT__get_lk_max_lockers(DB_ENV *dbenv, u_int32_t *lk_maxp);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::set_lk_max_lockers(u_int32_t max);
m4_blank
int
DbEnv::get_lk_max_lockers(u_int32_t *, lk_maxp);
]))
m4_p([dnl
Set the maximum number of locking entities supported by the m4_db
environment. This value is used by m4_ref(dbenv_open) to estimate how
much space to allocate for various lock-table data structures. The
default value is 1000 lockers. For specific information on configuring
the size of the lock subsystem, see m4_link(M4RELDIR/ref/lock/max,
Configuring locking: sizing the system).])
m4_env_config(dbenv_set_lk_max_lockers,
[maximum number of lockers], set_lk_max_lockers, [the number of lockers])
m4_scope_env(dbenv_set_lk_max_lockers)
m4_when_envopen(dbenv_set_lk_max_lockers, ignored)
m4_return(dbenv_set_lk_max_lockers, std)
m4_parambegin
m4_param(max, [dnl
The m4_arg(max) parameter is the maximum number simultaneous locking
entities supported by the m4_db environment.])
m4_paramend
m4_err(dbenv_set_lk_max_lockers,
einval, [the method was called after m4_ref(dbenv_open) was called])
m4_pf_getter(dbenv_get_lk_max_lockers, maximum number of lockers,, lk_maxp)
m4_seealso(DbLock)
m4_page_footer

View File

@@ -0,0 +1,51 @@
m4_comment([$Id: env_set_lk_max_locks.so,v 10.23 2004/09/28 15:04:20 bostic Exp $])
define(M4PAGELOCAL, [dbenv_set_lk_max_locks, dbenv_get_lk_max_locks])
include(m4/m4.seealso)
m4_pf_header(m4_ref(dbenv_set_lk_max_locks),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__set_lk_max_locks(DB_ENV *dbenv, u_int32_t max);
m4_blank
int
DB_ENV-__GT__get_lk_max_locks(DB_ENV *dbenv, u_int32_t *lk_maxp);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::set_lk_max_locks(u_int32_t max);
m4_blank
int
DbEnv::get_lk_max_locks(u_int32_t *lk_maxp);
]))
m4_p([dnl
Set the maximum number of locks supported by the m4_db environment.
This value is used by m4_ref(dbenv_open) to estimate how much space to
allocate for various lock-table data structures. The default value is
1000 locks. For specific information on configuring the size of the lock
subsystem, see m4_link(M4RELDIR/ref/lock/max, Configuring locking:
sizing the system).])
m4_env_config(dbenv_set_lk_max_locks,
[maximum number of locks], set_lk_max_locks, [the number of locks])
m4_scope_env(dbenv_set_lk_max_locks)
m4_when_envopen(dbenv_set_lk_max_locks, ignored)
m4_return(dbenv_set_lk_max_locks, std)
m4_parambegin
m4_param(max, [dnl
The m4_arg(max) parameter is the maximum number of locks supported by
the m4_db environment.])
m4_paramend
m4_err(dbenv_set_lk_max_locks,
einval, [the method was called after m4_ref(dbenv_open) was called])
m4_pf_getter(dbenv_get_lk_max_locks, maximum number of locks,, lk_maxp)
m4_seealso(DbLock)
m4_page_footer

View File

@@ -0,0 +1,52 @@
m4_comment([$Id: env_set_lk_max_objects.so,v 1.23 2004/09/28 15:04:20 bostic Exp $])
define(M4PAGELOCAL, [dbenv_set_lk_max_objects, dbenv_get_lk_max_objects])
include(m4/m4.seealso)
m4_pf_header(m4_ref(dbenv_set_lk_max_objects),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__set_lk_max_objects(DB_ENV *dbenv, u_int32_t max);
m4_blank
int
DB_ENV-__GT__get_lk_max_objects(DB_ENV *dbenv, u_int32_t *lk_maxp);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::set_lk_max_objects(u_int32_t max);
m4_blank
int
DbEnv::get_lk_max_objects(u_int32_t *lk_maxp);
]))
m4_p([dnl
Set the maximum number of locked objects supported by the m4_db
environment. This value is used by m4_ref(dbenv_open) to estimate how
much space to allocate for various lock-table data structures. The
default value is 1000 objects. For specific information on configuring
the size of the lock subsystem, see m4_link(M4RELDIR/ref/lock/max,
Configuring locking: sizing the system).])
m4_env_config(dbenv_set_lk_max_objects,
[maximum number of objects], set_lk_max_objects, [the number of objects])
m4_scope_env(dbenv_set_lk_max_objects)
m4_when_envopen(dbenv_set_lk_max_objects, ignored)
m4_return(dbenv_set_lk_max_objects, std)
m4_parambegin
m4_param(max, [dnl
The m4_arg(max) parameter is the maximum number of locked objects
supported by the m4_db environment.])
m4_paramend
m4_err(dbenv_set_lk_max_objects,
einval, [the method was called after m4_ref(dbenv_open) was called])
m4_pf_getter(dbenv_get_lk_max_objects,
maximum number of locked objects,, lk_maxp)
m4_seealso(DbLock)
m4_page_footer

View File

@@ -0,0 +1,57 @@
m4_comment([$Id: env_set_lk_partitions.so,v 10.2 2008/04/29 22:45:33 mbrey Exp $])
define(M4PAGELOCAL, [dbenv_set_lk_partitions, dbenv_get_lk_partitions])
include(m4/m4.seealso)
m4_pf_header(m4_ref(dbenv_set_lk_partitions),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__set_lk_partitions(DB_ENV *dbenv, u_int32_t partitions);
m4_blank
int
DB_ENV-__GT__get_lk_partitions(DB_ENV *dbenv, u_int32_t *lk_partitions);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::set_lk_partitions(u_int32_t partitions);
m4_blank
int
DbEnv::get_lk_partitions(u_int32_t *lk_partitions);
]))
m4_p([dnl
Set the number of lock table partitions in the m4_db
environment.
The default value is 10 times the number of CPUs on the system if there
is more than one CPU.
Increasing the number of partitions can provide for greater throughput on
a system with multiple CPUs and more than one thread contending for the
lock manager.
On single processor systems more than one partition may increase the overhead
of the lock manager. Systems often report threading contexts as CPUs this
may require setting the number of partitions to 1 to get optimal performance.
])
m4_env_config(dbenv_set_lk_partitions,
[number of partitions], set_lk_partitions, [the number of partitions])
m4_scope_env(dbenv_set_lk_partitions)
m4_when_envopen(dbenv_set_lk_partitions, ignored)
m4_return(dbenv_set_lk_partitions, std)
m4_parambegin
m4_param(partitions, [dnl
The m4_arg(partitions) parameter is the number of partitions
to be configured in the m4_db environment.])
m4_paramend
m4_err(dbenv_set_lk_partitions,
einval, [the method was called after m4_ref(dbenv_open) was called])
m4_pf_getter(dbenv_get_lk_partitions,
number of partitions,, lk_partitions)
m4_seealso(DbLock)
m4_page_footer

View File

@@ -0,0 +1,26 @@
m4_comment([$Id: lock_class.so,v 10.21 2004/08/13 03:38:57 bostic Exp $])
define(M4PAGELOCAL, DbLock)
include(m4/m4.seealso)
m4_pf_header(m4_ref(DbLock),
ifelse(M4API, C_API, [dnl
typedef struct __db_lock_u DB_LOCK;
])
ifelse(M4API, CXX_API, [dnl
class DbLock {
public:
DbLock();
DbLock(const DbLock &);
DbLock &operator = (const DbLock &);
~DbLock();
};
]))
m4_p([dnl
The locking interfaces for the m4_db database environment are methods
of the m4_ref(DbEnv) handle. The m4_ref(DbLock) object is the handle
for a single lock, and has no methods of its own.])
m4_seealso(DbLock)
m4_page_footer

View File

@@ -0,0 +1,44 @@
m4_comment([$Id: lock_detect.so,v 10.50 2006/12/13 17:57:23 bostic Exp $])
define(M4PAGELOCAL, lock_detect)
include(m4/m4.seealso)
m4_pf_header(m4_ref(lock_detect),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__lock_detect(DB_ENV *env,
u_int32_t flags, u_int32_t atype, int *rejected);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::lock_detect(u_int32_t flags, u_int32_t atype, int *rejected);
]))
m4_p([dnl
The m4_refT(lock_detect) runs one iteration of the deadlock detector.
The deadlock detector traverses the lock table and marks one of the
participating lock requesters for rejection in each deadlock it finds.])
m4_underfunc(lock_detect, lock_detect, db_deadlock)
m4_return(lock_detect, std)
m4_parambegin
m4_param(rejected, [dnl
If the m4_arg(rejected) parameter is non-NULL, the memory location to
which it refers will be set to the number of lock requests that were
rejected.])
m4_param(atype, [dnl
The m4_arg(atype) parameter specifies which lock request(s) to reject.
It must be set to one of the following list:
m4_lk_detect_flags])
m4_unusedflags
m4_paramend
m4_err(lock_detect, einval)
m4_seealso(DbLock)
m4_page_footer

78
docs_src/lock/lock_get.so Normal file
View File

@@ -0,0 +1,78 @@
m4_comment([$Id: lock_get.so,v 10.54 2007/10/26 15:01:06 bostic Exp $])
define(M4PAGELOCAL, lock_get)
include(m4/m4.seealso)
m4_pf_header(m4_ref(lock_get),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__lock_get(DB_ENV *env, u_int32_t locker,
u_int32_t flags, const DBT *object,
const db_lockmode_t lock_mode, DB_LOCK *lock);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::lock_get(u_int32_t locker, u_int32_t flags,
const Dbt *object, const db_lockmode_t lock_mode, DbLock *lock);
]))
m4_p([dnl
The m4_refT(lock_get) acquires a lock from the lock table, returning
information about it in the m4_arg(lock) parameter.])
m4_return(lock_get, std)
m4_parambegin
m4_param(flags, [dnl
m4_sf_zmust(0)
m4_tagbegin
m4_tag(m4_idef(DB_LOCK_NOWAIT), [dnl
If a lock cannot be granted because the requested lock conflicts with an
existing lock,
ifelse(M4API, C_API, [dnl
return DB_LOCK_NOTGRANTED immediately instead of waiting
for the lock to become available.])
ifelse(M4API, CXX_API, [dnl
return DB_LOCK_NOTGRANTED or throw a
m4_ref(DbLockNotGrantedException) immediately instead of waiting for
the lock to become available.])])
m4_tagend])
m4_param(lock_mode, [dnl
The m4_arg(lock_mode) parameter is used as an index into the environment's
lock conflict matrix. When using the default lock conflict matrix,
m4_arg(lock_mode) must be set to one of the following values:
m4_tagbegin
m4_tag(DB_LOCK_READ, [read (shared)])
m4_tag(DB_LOCK_WRITE, [write (exclusive)])
m4_tag(DB_LOCK_IWRITE, [intention to write (shared)])
m4_tag(DB_LOCK_IREAD, [intention to read (shared)])
m4_tag(DB_LOCK_IWR, [intention to read and write (shared)])
m4_tagend
m4_p([dnl
See m4_ref(dbenv_set_lk_conflicts) and m4_link(M4RELDIR/ref/lock/stdmode,
[Standard Lock Modes]) for more information on the lock conflict matrix.])])
m4_param(locker, [dnl
The m4_arg(locker) parameter is an unsigned 32-bit integer quantity. It
represents the entity requesting the lock.])
m4_param(object, [dnl
The m4_arg(object) parameter is an untyped byte string that specifies the
object to be locked. Applications using the locking subsystem directly
while also doing locking via the m4_db access methods must take care not
to inadvertently lock objects that happen to be equal to the unique file
IDs used to lock files. See
m4_link(M4RELDIR/ref/lock/am_conv, [Access method locking conventions])
for more information.])
m4_paramend
m4_err(lock_get, deadlock, locknotgranted,
[m4_ref(DB_LOCK_NOWAIT) flag or lock timers were configured and the],
einval,,
memory, [maximum number of locks has been reached])
m4_seealso(DbLock)
m4_page_footer

32
docs_src/lock/lock_id.so Normal file
View File

@@ -0,0 +1,32 @@
m4_comment([$Id: lock_id.so,v 10.33 2004/08/13 03:38:57 bostic Exp $])
define(M4PAGELOCAL, lock_id)
include(m4/m4.seealso)
m4_pf_header(m4_ref(lock_id),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__lock_id(DB_ENV *env, u_int32_t *idp);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::lock_id(u_int32_t *idp);
]))
m4_p([dnl
The m4_refT(lock_id) copies a locker ID, which is guaranteed to be
unique in the specified lock table, into the memory location to which
m4_arg(idp) refers.])
m4_p([dnl
The m4_refT(lock_id_free) should be called to return the locker ID to
the m4_db library when it is no longer needed.])
m4_return(lock_id, std)
m4_parambegin
m4_param_co(idp, allocated locker ID)
m4_paramend
m4_seealso(DbLock)
m4_page_footer

View File

@@ -0,0 +1,31 @@
m4_comment([$Id: lock_id_free.so,v 10.14 2004/08/13 03:38:57 bostic Exp $])
define(M4PAGELOCAL, lock_id_free)
include(m4/m4.seealso)
m4_pf_header(m4_ref(lock_id_free),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__lock_id_free(DB_ENV *env, u_int32_t id);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::lock_id_free(u_int32_t id);
]))
m4_p([dnl
The m4_refT(lock_id_free) frees a locker ID allocated by the
m4_refT(lock_id).])
m4_return(lock_id_free, std)
m4_parambegin
m4_param(id, [dnl
The m4_arg(id) parameter is the locker id to be freed.])
m4_paramend
m4_err(lock_id_free, einval,
[the locker ID is invalid or locks are still held by this locker ID])
m4_seealso(DbLock)
m4_page_footer

View File

@@ -0,0 +1,7 @@
m4_comment([$Id: lock_list.so,v 1.1 2002/08/30 20:00:51 bostic Exp $])
m4_page_title([m4_db: Locking Subsystem and Related Methods])
include(lock/m4.methods)
m4_page_footer

29
docs_src/lock/lock_put.so Normal file
View File

@@ -0,0 +1,29 @@
m4_comment([$Id: lock_put.so,v 10.37 2004/08/13 03:38:57 bostic Exp $])
define(M4PAGELOCAL, lock_put)
include(m4/m4.seealso)
m4_pf_header(m4_ref(lock_put),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__lock_put(DB_ENV *env, DB_LOCK *lock);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::lock_put(DbLock *lock);
]))
m4_p([dnl
The m4_refT(lock_put) releases m4_arg(lock).])
m4_return(lock_put, std)
m4_parambegin
m4_param(lock, [dnl
The m4_arg(lock) parameter is the lock to be released.])
m4_paramend
m4_err(lock_put, einval)
m4_seealso(DbLock)
m4_page_footer

193
docs_src/lock/lock_stat.so Normal file
View File

@@ -0,0 +1,193 @@
m4_comment([$Id: lock_stat.so,v 10.71 2008/03/21 18:20:27 ubell Exp $])
define(M4PAGELOCAL, [lock_stat, lock_stat_print])
include(m4/m4.seealso)
m4_pf_header(m4_ref(lock_stat),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__lock_stat(DB_ENV *env, DB_LOCK_STAT **statp, u_int32_t flags);
m4_blank
int
DB_ENV-__GT__lock_stat_print(DB_ENV *env, u_int32_t flags);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::lock_stat(DB_LOCK_STAT **statp, u_int32_t flags);
m4_blank
int
DbEnv::lock_stat_print(u_int32_t flags);
]))
m4_p([dnl
The m4_refT(lock_stat) returns the locking subsystem statistics.])
m4_p([dnl
The m4_refT(lock_stat) creates a statistical structure of type
DB_LOCK_STAT and copies a pointer to it into a user-specified memory
location.])
m4_alloc([Statistical structures])
m4_p([dnl
The following DB_LOCK_STAT fields will be filled in:])
m4_tagbegin
m4_field(u_int32_t, st_id,
[The last allocated locker ID.])
m4_field(u_int32_t, st_cur_maxid,
[The current maximum unused locker ID.])
m4_field(u_int32_t, st_nmodes,
[The number of lock modes.])
m4_field(u_int32_t, st_maxlocks,
[The maximum number of locks possible.])
m4_field(u_int32_t, st_maxlockers,
[The maximum number of lockers possible.])
m4_field(u_int32_t, st_maxobjects,
[The maximum number of lock objects possible.])
m4_field(u_int32_t, st_partitions,
[The number of lock table partitions.])
m4_field(u_int32_t, st_nlocks,
[The number of current locks.])
m4_field(u_int32_t, st_maxnlocks,
[The maximum number of locks at any one time. Note that if there is more
than one partition, this is the sum of the maximum across all partitions.])
m4_field(u_int32_t, st_maxhlocks,
[The maximum number of locks in any hash bucket at any one time.])
m4_field(u_int32_t, st_locksteals,
[The maximum number of locks stolen by for an empty partition.])
m4_field(u_int32_t, st_maxlsteals,
[The maximum number of lock steals for any one partition.])
m4_field(u_int32_t, st_nlockers,
[The number of current lockers.])
m4_field(u_int32_t, st_maxnlockers,
[The maximum number of lockers at any one time.])
m4_field(u_int32_t, st_nobjects,
[The number of current lock objects.])
m4_field(u_int32_t, st_maxnobjects,
[The maximum number of lock objects at any one time. Note that if there is more
than one partition this is the sum of the maximum across all partitions.])
m4_field(u_int32_t, st_maxhobjects,
[The maximum number of objects in any hash bucket at any one time.])
m4_field(u_int32_t, st_objectsteals,
[The maximum number of objects stolen by for an empty partition.])
m4_field(u_int32_t, st_maxosteals,
[The maximum number of object steals for any one partition.])
m4_field(u_int32_t, st_nrequests,
[The total number of locks requested.])
m4_field(u_int32_t, st_nreleases,
[The total number of locks released.])
m4_field(u_int32_t, st_nupgrade,
[The total number of locks upgraded.])
m4_field(u_int32_t, st_ndowngrade,
[The total number of locks downgraded.])
m4_field(u_int32_t, st_lock_wait,
[The number of lock requests not immediately available due to conflicts,
for which the thread of control waited.])
m4_field(u_int32_t, st_lock_nowait,
[The number of lock requests not immediately available due to conflicts,
for which the thread of control did not wait.])
m4_field(u_int32_t, st_ndeadlocks,
[The number of deadlocks.])
m4_field(u_int32_t, st_locktimeout,
[Lock timeout value.])
m4_field(u_int32_t, st_nlocktimeouts,
[The number of lock requests that have timed out.])
m4_field(u_int32_t, st_txntimeout,
[Transaction timeout value.])
m4_field(u_int32_t, st_ntxntimeouts,
[The number of transactions that have timed out. This value is also a
component of m4_arg(st_ndeadlocks), the total number of deadlocks
detected.])
m4_field(u_int32_t, st_objs_wait,
[The number of requests to allocate or deallocate an object
for which the thread of control waited.])
m4_field(u_int32_t, st_objs_nowait,
[The number of requests to allocate or deallocate an object
for which the thread of control did not wait.])
m4_field(u_int32_t, st_lockers_wait,
[The number of requests to allocate or deallocate a locker
for which the thread of control waited.])
m4_field(u_int32_t, st_lockers_nowait,
[The number of requests to allocate or deallocate a locker
for which the thread of control did not wait.])
m4_field(u_int32_t, st_hash_len,
[Maximum length of a lock hash bucket.])
m4_field(roff_t, st_regsize,
[The size of the lock region, in bytes.])
m4_field(u_int32_t, st_part_wait,
[The number of times that a thread of control was forced to wait before
obtaining the lock partition mutex.])
m4_field(u_int32_t, st_part_nowait,
[The number of times that a thread of control was able to obtain
the lock partition mutex without waiting.])
m4_field(u_int32_t, st_part_max_wait,
[The maximum number of times that a thread of control was forced to wait before
obtaining any one lock partition mutex.])
m4_field(u_int32_t, st_part_max_nowait,
[The number of times that a thread of control was able to obtain
any one lock partition mutex without waiting.])
m4_field(u_int32_t, st_region_wait,
[The number of times that a thread of control was forced to wait before
obtaining the lock region mutex.])
m4_field(u_int32_t, st_region_nowait,
[The number of times that a thread of control was able to obtain
the lock region mutex without waiting.])
m4_tagend
m4_when(lock_stat, before, dbenv_open)
m4_return(lock_stat, std)
m4_parambegin
m4_param(flags, m4_stat_flags)
m4_param_co(statp, allocated statistics structure, REF)
m4_paramend
m4_err(lock_stat, einval)
m4_stat_print(lock_stat_print, locking subsystem, lock_stat)
m4_seealso(DbLock)
m4_page_footer

173
docs_src/lock/lock_vec.so Normal file
View File

@@ -0,0 +1,173 @@
m4_comment([$Id: lock_vec.so,v 10.70 2007/10/26 15:01:06 bostic Exp $])
define(M4PAGELOCAL,
[lock_vec, DB_LOCK_GET, DB_LOCK_GET_TIMEOUT, DB_LOCK_PUT,
DB_LOCK_IREAD, DB_LOCK_PUT_ALL, DB_LOCK_PUT_OBJ,
DB_LOCK_TIMEOUT, DB_LOCK_READ, DB_LOCK_WRITE, DB_LOCK_IWRITE,
DB_LOCK_IREAD, DB_LOCK_IWR])
include(m4/m4.seealso)
m4_pf_header(m4_ref(lock_vec),
ifelse(M4API, C_API, [dnl
int
DB_ENV-__GT__lock_vec(DB_ENV *env, u_int32_t locker, u_int32_t flags,
DB_LOCKREQ list__LB____RB__, int nlist, DB_LOCKREQ **elistp);
])
ifelse(M4API, CXX_API, [dnl
int
DbEnv::lock_vec(u_int32_t locker, u_int32_t flags,
DB_LOCKREQ list__LB____RB__, int nlist, DB_LOCKREQ **elistp);
]))
m4_p([dnl
The m4_refT(lock_vec) atomically obtains and releases one or more locks
from the lock table. The m4_refT(lock_vec) is intended to support
acquisition or trading of multiple locks under one lock table semaphore,
as is needed for lock coupling or in multigranularity locking for lock
escalation.])
m4_p([dnl
If any of the requested locks cannot be acquired, or any of the locks to
be released cannot be released, the operations before the failing
operation are guaranteed to have completed successfully, and
m4_ref(lock_vec) returns a non-zero value. In addition, if
m4_arg(elistp) is not NULL, it is set to point to the DB_LOCKREQ entry
that was being processed when the error occurred.])
m4_return(lock_vec, prev)
m4_parambegin
m4_param(elistp, [dnl
If an error occurs, and the m4_arg(elistp) parameter is non-NULL, it
is set to point to the DB_LOCKREQ entry that was being processed when
the error occurred.])
m4_param(flags, [dnl
m4_sf_zmust(0)
m4_tagbegin
m4_tag(m4_idef(DB_LOCK_NOWAIT), [dnl
If a lock cannot be granted because the requested lock conflicts with
an existing lock,
ifelse(M4API, C_API, [dnl
return DB_LOCK_NOTGRANTED immediately instead of waiting
for the lock to become available. In this case, if non-NULL,
m4_arg(elistp) identifies the request that was not granted.])
ifelse(M4API, CXX_API, [dnl
return DB_LOCK_NOTGRANTED or throw a
m4_ref(DbLockNotGrantedException) immediately instead of waiting for
the lock to become available. In this case, if non-NULL,
m4_arg(elistp) identifies the request that was not granted, or, if an
exception is thrown, the index of the request that was not granted can
be found by calling DbLockNotGrantedException.get_index.])])
m4_tagend])
m4_param(locker, [dnl
The m4_arg(locker) parameter is an unsigned 32-bit integer quantity. It
represents the entity requesting or releasing the lock.])
m4_param(list, [dnl
The m4_arg(list) array provided to m4_ref(lock_vec) is typedef'd as
DB_LOCKREQ.
m4_p([dnl
To ensure compatibility with future releases of m4_db, all
fields of the DB_LOCKREQ structure that are not explicitly set should
be initialized to 0 before the first time the structure is used. Do
this by declaring the structure external or static, or by calling
m4_manref(memset, 3).])
m4_p([dnl
A DB_LOCKREQ structure has at least the following fields:])
m4_tagbegin
m4_tag([lockop_t m4_idef(op);], [dnl
The operation to be performed, which must be set to one of the
following values:])
m4_tagbegin
m4_tag(m4_idef(DB_LOCK_GET), [dnl
Get the lock defined by the values of the m4_arg(mode) and m4_arg(obj)
structure fields, for the specified m4_arg(locker). Upon return from
m4_ref(lock_vec), if the m4_arg(lock) field is non-NULL, a reference
to the acquired lock is stored there. (This reference is invalidated
by any call to m4_ref(lock_vec) or m4_ref(lock_put) that releases the
lock.)])
m4_tag(m4_idef(DB_LOCK_GET_TIMEOUT), [dnl
Identical to m4_ref(DB_LOCK_GET) except that the value in the m4_arg(timeout)
structure field overrides any previously specified timeout value for
this lock. A value of 0 turns off any previously specified timeout.])
m4_tag(m4_idef(DB_LOCK_PUT), [dnl
The lock to which the m4_arg(lock) structure field refers is released.
The m4_arg(locker) parameter, and m4_arg(mode) and m4_arg(obj) fields
are ignored.])
m4_tag(m4_idef(DB_LOCK_PUT_ALL), [dnl
All locks held by the specified m4_arg(locker) are released. The
m4_arg(lock), m4_arg(mode), and m4_arg(obj) structure fields are
ignored. Locks acquired in operations performed by the current call to
m4_ref(lock_vec) which appear before the DB_LOCK_PUT_ALL
operation are released; those acquired in operations appearing after
the DB_LOCK_PUT_ALL operation are not released.])
m4_tag(m4_idef(DB_LOCK_PUT_OBJ), [dnl
All locks held on m4_arg(obj) are released. The m4_arg(locker)
parameter and the m4_arg(lock) and m4_arg(mode) structure fields are
ignored. Locks acquired in operations performed by the current call to
m4_ref(lock_vec) that appear before the DB_LOCK_PUT_OBJ
operation are released; those acquired in operations appearing after the
DB_LOCK_PUT_OBJ operation are not released.])
m4_tag(m4_idef(DB_LOCK_TIMEOUT), [dnl
Cause the specified m4_arg(locker) to timeout immediately. If the
database environment has not configured automatic deadlock detection,
the transaction will timeout the next time deadlock detection is
performed. As transactions acquire locks on behalf of a single locker
ID, timing out the locker ID associated with a transaction will time
out the transaction itself.])
m4_tagend
m4_tag([DB_LOCK m4_idef(lock);],
[A lock reference.])
m4_tag([const lockmode_t m4_idef(mode);], [dnl
The lock mode, used as an index into the environment's lock conflict matrix.
When using the default lock conflict matrix, m4_arg(mode) must be set to one
of the following values:
m4_tagbegin
m4_tag(m4_idef(DB_LOCK_READ), [read (shared)])
m4_tag(m4_idef(DB_LOCK_WRITE), [write (exclusive)])
m4_tag(m4_idef(DB_LOCK_IWRITE), [intention to write (shared)])
m4_tag(m4_idef(DB_LOCK_IREAD), [intention to read (shared)])
m4_tag(m4_idef(DB_LOCK_IWR), [intention to read and write (shared)])
m4_tagend
m4_p([dnl
See m4_ref(dbenv_set_lk_conflicts) and m4_link(M4RELDIR/ref/lock/stdmode,
[Standard Lock Modes]) for more information on the lock conflict matrix.])])
m4_tag([const ifelse(M4API, C_API, DBT, Dbt) m4_idef(obj);], [dnl
An untyped byte string that specifies the object to be locked or
released. Applications using the locking subsystem directly while also
doing locking via the m4_db access methods must take care not to
inadvertently lock objects that happen to be equal to the unique file
IDs used to lock files. See m4_link(M4RELDIR/ref/lock/am_conv, [Access
method locking conventions]) for more information.])
m4_tag([u_int32_t timeout;], [dnl
The lock timeout value.])
m4_tagend])
m4_param(nlist, [dnl
The m4_arg(nlist) parameter specifies the number of elements in the
m4_arg(list) array.])
m4_paramend
m4_err(lock_vec, deadlock, locknotgranted,
[m4_ref(DB_LOCK_NOWAIT) flag or lock timers were configured and the],
einval,,
memory, [maximum number of locks has been reached])
m4_seealso(DbLock)
m4_page_footer

View File

@@ -0,0 +1,72 @@
m4_comment([$Id: lockng_class.so,v 1.14 2004/08/13 03:38:57 bostic Exp $])
define(M4PAGELOCAL, DbLockNotGrantedException)
include(m4/m4.seealso)
m4_pf_header(m4_ref(DbLockNotGrantedException),
ifelse(M4API, C_API, [dnl
])
ifelse(M4API, CXX_API, [dnl
class DbLockNotGrantedException : public DbException {
public:
db_lockop_t get_op() const;
db_lockmode_t get_mode() const;
const Dbt* get_obj() const;
DbLock *get_lock() const;
int get_index() const;
};
]))
m4_p([dnl
This information describes the m4_ref(DbLockNotGrantedException) class and
how it is used by the various Db* classes.])
m4_p([dnl
A m4_ref(DbLockNotGrantedException) is thrown when a lock requested using
the m4_ref(lock_get) or m4_refT(lock_vec)s, where the m4_ref(DB_LOCK_NOWAIT)
flag or lock timers were configured, could not be granted before the
wait-time expired.])
m4_p([dnl
Additionally, m4_ref(DbLockNotGrantedException) is thrown when a m4_db
Concurrent Data Store database environment configured for lock timeouts
was unable to grant a lock in the allowed time.])
m4_p([dnl
Additionally, m4_ref(DbLockNotGrantedException) is thrown when lock or
transaction timeouts have been configured, a database operation has
timed out, and the m4_ref(DB_TIME_NOTGRANTED) configuration flag has
been specified.])
m4_p([dnl
The m4_ref(DbException) errno value is set to DB_LOCKNOTGRANTED.])
m4_p([dnl
The m4_arg(get_op) method returns 0 when m4_ref(lock_get) was called,
and returns the m4_arg(op) for the failed m4_ref(DbLockRequest) when
m4_ref(lock_vec) was called.])
m4_p([dnl
The m4_arg(get_mode) method returns the m4_arg(mode) parameter when
m4_ref(lock_get) was called, and returns the m4_arg(mode) for the failed
m4_ref(DbLockRequest) when m4_ref(lock_vec) was called.])
m4_p([dnl
The m4_arg(get_obj) method returns the m4_arg(mode) parameter when
returns the m4_arg(object) parameter when m4_ref(lock_get) was called,
and returns the m4_arg(object) for the failed m4_ref(DbLockRequest) when
m4_ref(lock_vec) was called.
ifelse(M4API, CXX_API, [dnl
The m4_ref(Dbt) pointer may or may not refer to valid memory, depending on
whether the m4_ref(Dbt) used in the call to the failed m4_ref(lock_get) or
m4_refT(lock_vec) is still in scope and has not been deleted.])])
m4_p([dnl
The m4_arg(get_lock) method returns NULL when m4_ref(lock_get) was
called, and returns the m4_arg(lock) in the failed m4_ref(DbLockRequest)
when m4_ref(lock_vec) was called.])
m4_p([dnl
The m4_arg(get_index) method returns -1 when m4_ref(lock_get) was
called, and returns the index of the failed m4_ref(DbLockRequest) when
m4_ref(lock_vec) was called.])
m4_page_footer

27
docs_src/lock/m4.methods Normal file
View File

@@ -0,0 +1,27 @@
m4_comment([$Id: m4.methods,v 1.7 2008/01/28 23:59:30 sarette Exp $])
m4_table_begin(, _center)
m4_table_header(Locking Subsystem and Related Methods, Description)
m4_comment([DbDeadlockException])ifelse(M4API, CXX_API, [m4_table_element(m4_ref(DbDeadlockException), Deadlock exception)])
m4_comment([DbEnv::lock_detect])m4_table_element(m4_ref(lock_detect), Perform deadlock detection)
m4_comment([DbEnv::lock_get])m4_table_element(m4_ref(lock_get), Acquire a lock)
m4_comment([DbEnv::lock_id])m4_table_element(m4_ref(lock_id), Acquire a locker ID)
m4_comment([DbEnv::lock_id_free])m4_table_element(m4_ref(lock_id_free), Release a locker ID)
m4_comment([DbEnv::lock_put])m4_table_element(m4_ref(lock_put), Release a lock)
m4_comment([DbEnv::lock_stat])m4_table_element(m4_ref(lock_stat), Return lock subsystem statistics)
m4_comment([DbEnv::lock_vec])m4_table_element(m4_ref(lock_vec), Acquire/release locks)
m4_comment([DbEnv::cdsgroup_begin])m4_table_element(m4_ref(cdsgroup_begin), Get a locker ID in m4_cam)
m4_comment([DbLockNotGrantedException])ifelse(M4API, CXX_API, [m4_table_element(m4_ref(DbLockNotGrantedException), Lock-not-granted exception)])
m4_comment([DbLock])ifelse(M4API, CXX_API, [m4_table_element(m4_ref(DbLock), Lock object)])
m4_table_header(Locking Subsystem Configuration, _empty)
m4_comment([DbEnv::set_lk_conflicts])m4_table_element(m4_ref(dbenv_set_lk_conflicts), Set lock conflicts matrix)
m4_comment([DbEnv::set_lk_max_detect])m4_table_element(m4_ref(dbenv_set_lk_detect), Set automatic deadlock detection)
m4_comment([DbEnv::set_lk_max_lockers])m4_table_element(m4_ref(dbenv_set_lk_max_lockers), Set maximum number of lockers)
m4_comment([DbEnv::set_lk_max_locks])m4_table_element(m4_ref(dbenv_set_lk_max_locks), Set maximum number of locks)
m4_comment([DbEnv::set_lk_max_objects])m4_table_element(m4_ref(dbenv_set_lk_max_objects), Set maximum number of lock objects)
m4_comment([DbEnv::set_lk_partitions])m4_table_element(m4_ref(dbenv_set_lk_partitions), Set number of lock partitions)
m4_comment([DbEnv::set_timeout])m4_table_element(m4_ref(dbenv_set_timeout), Set lock and transaction timeout)
m4_table_end