#[repr(C)]pub struct __wt_session {Show 30 fields
pub connection: *mut WT_CONNECTION,
pub app_private: *mut c_void,
pub close: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub reconfigure: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub strerror: Option<unsafe extern "C" fn(session: *mut WT_SESSION, error: c_int) -> *const c_char>,
pub open_cursor: Option<unsafe extern "C" fn(session: *mut WT_SESSION, uri: *const c_char, to_dup: *mut WT_CURSOR, config: *const c_char, cursorp: *mut *mut WT_CURSOR) -> c_int>,
pub alter: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>,
pub create: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>,
pub compact: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>,
pub drop: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>,
pub join: Option<unsafe extern "C" fn(session: *mut WT_SESSION, join_cursor: *mut WT_CURSOR, ref_cursor: *mut WT_CURSOR, config: *const c_char) -> c_int>,
pub log_flush: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub log_printf: Option<unsafe extern "C" fn(session: *mut WT_SESSION, format: *const c_char, ...) -> c_int>,
pub rebalance: Option<unsafe extern "C" fn(session: *mut WT_SESSION, uri: *const c_char, config: *const c_char) -> c_int>,
pub rename: Option<unsafe extern "C" fn(session: *mut WT_SESSION, uri: *const c_char, newuri: *const c_char, config: *const c_char) -> c_int>,
pub reset: Option<unsafe extern "C" fn(session: *mut WT_SESSION) -> c_int>,
pub salvage: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>,
pub truncate: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, start: *mut WT_CURSOR, stop: *mut WT_CURSOR, config: *const c_char) -> c_int>,
pub upgrade: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>,
pub verify: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>,
pub begin_transaction: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub commit_transaction: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub prepare_transaction: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub rollback_transaction: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub timestamp_transaction: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub checkpoint: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub snapshot: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub transaction_pinned_range: Option<unsafe extern "C" fn(session: *mut WT_SESSION, range: *mut u64) -> c_int>,
pub transaction_sync: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>,
pub breakpoint: Option<unsafe extern "C" fn(session: *mut WT_SESSION) -> c_int>,
}Expand description
All data operations are performed in the context of a WT_SESSION. This encapsulates the thread and transactional context of the operation.
Thread safety: A WT_SESSION handle is not usually shared between threads, see @ref threads for more information.
Fields§
§connection: *mut WT_CONNECTIONThe connection for this session.
app_private: *mut c_voidA location for applications to store information that will be available in callbacks taking a WT_SESSION handle.
close: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>Close the session handle.
This will release the resources associated with the session handle, including rolling back any active transactions and closing any cursors that remain open in the session.
@snippet ex_all.c Close a session
@param session the session handle @configempty{WT_SESSION.close, see dist/api_data.py} @errors
reconfigure: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>Reconfigure a session handle.
@snippet ex_all.c Reconfigure a session
WT_SESSION::reconfigure will fail if a transaction is in progress in the session.
All cursors are reset.
@param session the session handle @configstart{WT_SESSION.reconfigure, see dist/api_data.py} @config{cache_cursors, enable caching of cursors for reuse. Any calls to WT_CURSOR::close for a cursor created in this session will mark the cursor as cached and keep it available to be reused for later calls to WT_SESSION::open_cursor. Cached cursors may be eventually closed. This value is inherited from ::wiredtiger_open \c cache_cursors., a boolean flag; default \c true.} @config{ignore_cache_size, when set, operations performed by this session ignore the cache size and are not blocked when the cache is full. Note that use of this option for operations that create cache pressure can starve ordinary sessions that obey the cache size., a boolean flag; default \c false.} @config{isolation, the default isolation level for operations in this session., a string, chosen from the following options: \c “read-uncommitted”, \c “read-committed”, \c “snapshot”; default \c read-committed.} @configend @errors
strerror: Option<unsafe extern "C" fn(session: *mut WT_SESSION, error: c_int) -> *const c_char>Return information about an error as a string.
@snippet ex_all.c Display an error thread safe
@param session the session handle @param error a return value from a WiredTiger, ISO C, or POSIX standard API @returns a string representation of the error
open_cursor: Option<unsafe extern "C" fn(session: *mut WT_SESSION, uri: *const c_char, to_dup: *mut WT_CURSOR, config: *const c_char, cursorp: *mut *mut WT_CURSOR) -> c_int>Open a new cursor on a data source or duplicate an existing cursor.
@snippet ex_all.c Open a cursor
An existing cursor can be duplicated by passing it as the \c to_dup parameter and setting the \c uri parameter to \c NULL:
@snippet ex_all.c Duplicate a cursor
Cursors being duplicated must have a key set, and successfully duplicated cursors are positioned at the same place in the data source as the original.
Cursor handles should be discarded by calling WT_CURSOR::close.
Cursors capable of supporting transactional operations operate in the context of the current transaction, if any.
WT_SESSION::rollback_transaction implicitly resets all cursors.
Cursors are relatively light-weight objects but may hold references to heavier-weight objects; applications should re-use cursors when possible, but instantiating new cursors is not so expensive that applications need to cache cursors at all cost.
@param session the session handle
@param uri the data source on which the cursor operates; cursors
are usually opened on tables, however, cursors can be opened on
any data source, regardless of whether it is ultimately stored
in a table. Some cursor types may have limited functionality
(for example, they may be read-only or not support transactional
updates). See @ref data_sources for more information.
@copydoc doc_cursor_types
@param to_dup a cursor to duplicate or gather statistics on
@configstart{WT_SESSION.open_cursor, see dist/api_data.py}
@config{append, append the value as a new record, creating a new
record number key; valid only for cursors with record number keys., a
boolean flag; default \c false.}
@config{bulk, configure the cursor for bulk-loading, a fast,
initial load path (see @ref tune_bulk_load for more information).
Bulk-load may only be used for newly created objects and applications
should use the WT_CURSOR::insert method to insert rows. When
bulk-loading, rows must be loaded in sorted order. The value is
usually a true/false flag; when bulk-loading fixed-length column
store objects, the special value \c bitmap allows chunks of a memory
resident bitmap to be loaded directly into a file by passing a \c
WT_ITEM to WT_CURSOR::set_value where the \c size field indicates the
number of records in the bitmap (as specified by the object’s \c
value_format configuration). Bulk-loaded bitmap values must end on a
byte boundary relative to the bit count (except for the last set of
values loaded)., a string; default \c false.}
@config{checkpoint, the name of a checkpoint to open (the reserved
name “WiredTigerCheckpoint” opens the most recent internal checkpoint
taken for the object). The cursor does not support data
modification., a string; default empty.}
@config{dump, configure the cursor for dump format inputs and
outputs: “hex” selects a simple hexadecimal format, “json” selects a
JSON format with each record formatted as fields named by column
names if available, and “print” selects a format where only
non-printing characters are hexadecimal encoded. These formats are
compatible with the @ref util_dump and @ref util_load commands., a
string, chosen from the following options: \c “hex”, \c “json”, \c
“print”; default empty.}
@config{next_random, configure the cursor to return a pseudo-random
record from the object when the WT_CURSOR::next method is called;
valid only for row-store cursors. See @ref cursor_random for
details., a boolean flag; default \c false.}
@config{next_random_sample_size, cursors configured by \c next_random
to return pseudo-random records from the object randomly select from
the entire object, by default. Setting \c next_random_sample_size
to a non-zero value sets the number of samples the application
expects to take using the \c next_random cursor. A cursor configured
with both \c next_random and \c next_random_sample_size attempts to
divide the object into \c next_random_sample_size equal-sized
pieces, and each retrieval returns a record from one of those
pieces. See @ref cursor_random for details., a string; default \c
0.}
@config{overwrite, configures whether the cursor’s insert, update
and remove methods check the existing state of the record. If \c
overwrite is \c false, WT_CURSOR::insert fails with
::WT_DUPLICATE_KEY if the record exists, WT_CURSOR::update and
WT_CURSOR::remove fail with ::WT_NOTFOUND if the record does not
exist., a boolean flag; default \c true.}
@config{raw, ignore the encodings for the key and value, manage data
as if the formats were \c “u”. See @ref cursor_raw for details., a
boolean flag; default \c false.}
@config{readonly, only query operations are supported by this cursor.
An error is returned if a modification is attempted using the cursor.
The default is false for all cursor types except for log and metadata
cursors., a boolean flag; default \c false.}
@config{statistics, Specify the statistics to be gathered. Choosing
“all” gathers statistics regardless of cost and may include
traversing on-disk files; “fast” gathers a subset of relatively
inexpensive statistics. The selection must agree with the database
\c statistics configuration specified to ::wiredtiger_open or
WT_CONNECTION::reconfigure. For example, “all” or “fast” can be
configured when the database is configured with “all”, but the
cursor open will fail if “all” is specified when the database is
configured with “fast”, and the cursor open will fail in all cases
when the database is configured with “none”. If “size” is
configured, only the underlying size of the object on disk is filled
in and the object is not opened. If \c statistics is not
configured, the default configuration is the database configuration.
The “clear” configuration resets statistics after gathering them,
where appropriate (for example, a cache size statistic is not
cleared, while the count of cursor insert operations will be
cleared). See @ref statistics for more information., a list, with
values chosen from the following options: \c “all”, \c
“cache_walk”, \c “fast”, \c “clear”, \c “size”, \c “tree_walk”;
default empty.}
@config{target, if non-empty, backup the list of objects; valid only
for a backup data source., a list of strings; default empty.}
@configend
@param[out] cursorp a pointer to the newly opened cursor
@errors
alter: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>@name Table operations @{ / /*! Alter a table.
This will allow modification of some table settings after creation.
@exclusive
@snippet ex_all.c Alter a table
@param session the session handle @param name the URI of the object to alter, such as \c “table:stock” @configstart{WT_SESSION.alter, see dist/api_data.py} @config{access_pattern_hint, It is recommended that workloads that consist primarily of updates and/or point queries specify \c random. Workloads that do many cursor scans through large ranges of data specify \c sequential and other workloads specify \c none. The option leads to an advisory call to an appropriate operating system API where available., a string, chosen from the following options: \c “none”, \c “random”, \c “sequential”; default \c none.} @config{app_metadata, application-owned metadata for this object., a string; default empty.} @config{cache_resident, do not ever evict the object’s pages from cache. Not compatible with LSM tables; see @ref tuning_cache_resident for more information., a boolean flag; default \c false.} @config{log = (, the transaction log configuration for this object. Only valid if log is enabled in ::wiredtiger_open., a set of related configuration options defined below.} @config{ enabled, if false, this object has checkpoint-level durability., a boolean flag; default \c true.} @config{ ),,} @configend @errors
create: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>Create a table, column group, index or file.
@snippet ex_all.c Create a table
@param session the session handle
@param name the URI of the object to create, such as
\c “table:stock”. For a description of URI formats
see @ref data_sources.
@configstart{WT_SESSION.create, see dist/api_data.py}
@config{access_pattern_hint, It is recommended that workloads that
consist primarily of updates and/or point queries specify \c random.
Workloads that do many cursor scans through large ranges of data
specify \c sequential and other workloads specify \c none. The
option leads to an advisory call to an appropriate operating system
API where available., a string, chosen from the following options:
\c “none”, \c “random”, \c “sequential”; default \c none.}
@config{allocation_size, the file unit allocation size, in bytes,
must a power-of-two; smaller values decrease the file space required
by overflow items, and the default value of 4KB is a good choice
absent requirements from the operating system or storage device., an
integer between 512B and 128MB; default \c 4KB.}
@config{app_metadata, application-owned metadata for this object., a
string; default empty.}
@config{block_allocation, configure block allocation. Permitted
values are \c “first” or \c “best”; the \c “first” configuration uses
a first-available algorithm during block allocation, the \c “best”
configuration uses a best-fit algorithm., a string, chosen from the
following options: \c “first”, \c “best”; default \c best.}
@config{block_compressor, configure a compressor for file blocks.
Permitted values are \c “none” or custom compression engine name
created with WT_CONNECTION::add_compressor. If WiredTiger has
builtin support for \c “lz4”, \c “snappy”, \c “zlib” or \c “zstd”
compression, these names are also available. See @ref compression
for more information., a string; default \c none.}
@config{cache_resident, do not ever evict the object’s pages from
cache. Not compatible with LSM tables; see @ref
tuning_cache_resident for more information., a boolean flag; default
\c false.}
@config{checksum, configure block checksums; permitted values are
on (checksum all blocks), off (checksum no
blocks) and uncompresssed (checksum only blocks which
are not compressed for any reason). The \c uncompressed setting is
for applications which can rely on decompression to fail if a block
has been corrupted., a string, chosen from the following options: \c
“on”, \c “off”, \c “uncompressed”; default \c uncompressed.}
@config{colgroups, comma-separated list of names of column groups.
Each column group is stored separately, keyed by the primary key of
the table. If no column groups are specified, all columns are
stored together in a single file. All value columns in the table
must appear in at least one column group. Each column group must be
created with a separate call to WT_SESSION::create., a list of
strings; default empty.}
@config{collator, configure custom collation for keys. Permitted
values are \c “none” or a custom collator name created with
WT_CONNECTION::add_collator., a string; default \c none.}
@config{columns, list of the column names. Comma-separated list of
the form (column[,…]). For tables, the number of
entries must match the total number of values in \c key_format and \c
value_format. For colgroups and indices, all column names must
appear in the list of columns for the table., a list of strings;
default empty.}
@config{dictionary, the maximum number of unique values remembered in
the Btree row-store leaf page value dictionary; see @ref
file_formats_compression for more information., an integer greater
than or equal to 0; default \c 0.}
@config{encryption = (, configure an encryptor for file blocks. When
a table is created, its encryptor is not implicitly used for any
related indices or column groups., a set of related configuration
options defined below.}
@config{ keyid, An
identifier that identifies a unique instance of the encryptor. It is
stored in clear text, and thus is available when the wiredtiger
database is reopened. On the first use of a (name, keyid)
combination, the WT_ENCRYPTOR::customize function is called with the
keyid as an argument., a string; default empty.}
@config{ name, Permitted values are \c “none”
or custom encryption engine name created with
WT_CONNECTION::add_encryptor. See @ref encryption for more
information., a string; default \c none.}
@config{ ),,}
@config{exclusive, fail if the object exists. When false (the
default), if the object exists, check that its settings match the
specified configuration., a boolean flag; default \c false.}
@config{extractor, configure custom extractor for indices. Permitted
values are \c “none” or an extractor name created with
WT_CONNECTION::add_extractor., a string; default \c none.}
@config{format, the file format., a string, chosen from the
following options: \c “btree”; default \c btree.}
@config{huffman_key, configure Huffman encoding for keys. Permitted
values are \c “none”, \c “english”, \c “utf8leaf_page_max, and an
upper bound of cache_size / 10. This limit is soft - it
is possible for pages to be temporarily larger than this value. This
setting is ignored for LSM trees, see \c chunk_size., an integer
between 512B and 10TB; default \c 5MB.}
@config{os_cache_dirty_max, maximum dirty system buffer cache usage,
in bytes. If non-zero, schedule writes for dirty blocks belonging
to this object in the system buffer cache after that many bytes from
this object are written into the buffer cache., an integer greater
than or equal to 0; default \c 0.}
@config{os_cache_max, maximum system buffer cache usage, in bytes.
If non-zero, evict object blocks from the system buffer cache after
that many bytes from this object are read or written into the buffer
cache., an integer greater than or equal to 0; default \c 0.}
@config{prefix_compression, configure prefix compression on row-store
leaf pages., a boolean flag; default \c false.}
@config{prefix_compression_min, minimum gain before prefix
compression will be used on row-store leaf pages., an integer greater
than or equal to 0; default \c 4.}
@config{split_pct, the Btree page split size as a percentage of the
maximum Btree page size, that is, when a Btree page is split, it
will be split into smaller pages, where each page is the specified
percentage of the maximum Btree page size., an integer between 50 and
100; default \c 90.}
@config{type, set the type of data source used to store a column
group, index or simple table. By default, a \c “file:” URI is
derived from the object name. The \c type configuration can be used
to switch to a different data source, such as LSM or an extension
configured by the application., a string; default \c file.}
@config{value_format, the format of the data packed into value items.
See @ref schema_format_types for details. By default, the
value_format is \c ‘u’ and applications use a WT_ITEM structure to
manipulate raw byte arrays. Value items of type ‘t’ are bitfields,
and when configured with record number type keys, will be stored
using a fixed-length store., a format string; default \c u.}
@configend
@errors
compact: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>Compact a live row- or column-store btree or LSM tree.
@snippet ex_all.c Compact a table
@param session the session handle @param name the URI of the object to compact, such as \c “table:stock” @configstart{WT_SESSION.compact, see dist/api_data.py} @config{timeout, maximum amount of time to allow for compact in seconds. The actual amount of time spent in compact may exceed the configured value. A value of zero disables the timeout., an integer; default \c 1200.} @configend @errors
drop: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>Drop (delete) an object.
@exclusive
@snippet ex_all.c Drop a table
@param session the session handle @param name the URI of the object to drop, such as \c “table:stock” @configstart{WT_SESSION.drop, see dist/api_data.py} @config{force, return success if the object does not exist., a boolean flag; default \c false.} @config{remove_files, if the underlying files should be removed., a boolean flag; default \c true.} @configend @ebusy_errors
join: Option<unsafe extern "C" fn(session: *mut WT_SESSION, join_cursor: *mut WT_CURSOR, ref_cursor: *mut WT_CURSOR, config: *const c_char) -> c_int>Join a join cursor with a reference cursor.
@snippet ex_schema.c Join cursors
@param session the session handle @param join_cursor a cursor that was opened using a \c “join:” URI. It may not have been used for any operations other than other join calls. @param ref_cursor an index cursor having the same base table as the join_cursor, or a table cursor open on the same base table, or another join cursor. Unless the ref_cursor is another join cursor, it must be positioned.
The ref_cursor limits the results seen by iterating the join_cursor to table items referred to by the key in this index. The set of keys referred to is modified by the compare config option.
Multiple join calls builds up a set of ref_cursors, and by default, the results seen by iteration are the intersection of the cursor ranges participating in the join. When configured with \c “operation=or”, the results seen are the union of the participating cursor ranges.
After the join call completes, the ref_cursor cursor may not be used for any purpose other than get_key and get_value. Any other cursor method (e.g. next, prev,close) will fail. When the join_cursor is closed, the ref_cursor is made available for general use again. The application should close ref_cursor when finished with it, although not before the join_cursor is closed.
@configstart{WT_SESSION.join, see dist/api_data.py} @config{bloom_bit_count, the number of bits used per item for the bloom filter., an integer between 2 and 1000; default \c 16.} @config{bloom_false_positives, return all values that pass the bloom filter, without eliminating any false positives., a boolean flag; default \c false.} @config{bloom_hash_count, the number of hash values per item for the bloom filter., an integer between 2 and 100; default \c 8.} @config{compare, modifies the set of items to be returned so that the index key satisfies the given comparison relative to the key set in this cursor., a string, chosen from the following options: \c “eq”, \c “ge”, \c “gt”, \c “le”, \c “lt”; default \c “eq”.} @config{count, set an approximate count of the elements that would be included in the join. This is used in sizing the bloom filter, and also influences evaluation order for cursors in the join. When the count is equal for multiple bloom filters in a composition of joins, the bloom filter may be shared., an integer; default \c .} @config{operation, the operation applied between this and other joined cursors. When “operation=and” is specified, all the conditions implied by joins must be satisfied for an entry to be returned by the join cursor; when “operation=or” is specified, only one must be satisfied. All cursors joined to a join cursor must have matching operations., a string, chosen from the following options: \c “and”, \c “or”; default \c “and”.} @config{strategy, when set to bloom, a bloom filter is created and populated for this index. This has an up front cost but may reduce the number of accesses to the main table when iterating the joined cursor. The bloom setting requires that count be set., a string, chosen from the following options: \c “bloom”, \c “default”; default empty.} @configend @errors
log_flush: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>Flush the log.
@param session the session handle @configstart{WT_SESSION.log_flush, see dist/api_data.py} @config{sync, forcibly flush the log and wait for it to achieve the synchronization level specified. The \c background setting initiates a background synchronization intended to be used with a later call to WT_SESSION::transaction_sync. The \c off setting forces any buffered log records to be written to the file system. The \c on setting forces log records to be written to the storage device., a string, chosen from the following options: \c “background”, \c “off”, \c “on”; default \c on.} @configend @errors
log_printf: Option<unsafe extern "C" fn(session: *mut WT_SESSION, format: *const c_char, ...) -> c_int>Insert a ::WT_LOGREC_MESSAGE type record in the database log files (the database must be configured for logging when this method is called).
@param session the session handle @param format a printf format specifier @errors
rebalance: Option<unsafe extern "C" fn(session: *mut WT_SESSION, uri: *const c_char, config: *const c_char) -> c_int>Rebalance a table or file, see @ref rebalance.
@exclusive
@snippet ex_all.c Rebalance a table
@param session the session handle @param uri the current URI of the object, such as \c “table:mytable” @configempty{WT_SESSION.rebalance, see dist/api_data.py} @ebusy_errors
rename: Option<unsafe extern "C" fn(session: *mut WT_SESSION, uri: *const c_char, newuri: *const c_char, config: *const c_char) -> c_int>Rename an object.
@snippet ex_all.c Rename a table
@exclusive
@param session the session handle @param uri the current URI of the object, such as \c “table:old” @param newuri the new URI of the object, such as \c “table:new” @configempty{WT_SESSION.rename, see dist/api_data.py} @ebusy_errors
reset: Option<unsafe extern "C" fn(session: *mut WT_SESSION) -> c_int>Reset the session handle.
This method resets all cursors associated with this session and discards cached resources. The session can be re-used immediately after this call returns. If a transaction is running on this session, then this call takes no action and return an error.
@snippet ex_all.c Reset the session
@param session the session handle @errors
salvage: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>Salvage a table or file.
Salvage rebuilds the file, or files of which a table is comprised, discarding any corrupted file blocks.
Previously deleted records may re-appear, and inserted records may disappear, when salvage is done, so salvage should not be run unless it is known to be necessary. Normally, salvage should be called after a table or file has been corrupted, as reported by the WT_SESSION::verify method.
Files are rebuilt in place, the salvage method overwrites the existing files.
@exclusive
@snippet ex_all.c Salvage a table
@param session the session handle @param name the URI of the table or file to salvage @configstart{WT_SESSION.salvage, see dist/api_data.py} @config{force, force salvage even of files that do not appear to be WiredTiger files., a boolean flag; default \c false.} @configend @ebusy_errors
truncate: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, start: *mut WT_CURSOR, stop: *mut WT_CURSOR, config: *const c_char) -> c_int>Truncate a file, table or cursor range.
Truncate a table or file. @snippet ex_all.c Truncate a table
Truncate a cursor range. When truncating based on a cursor position, it is not required the cursor reference a record in the object, only that the key be set. This allows applications to discard portions of the object name space without knowing exactly what records the object contains. @snippet ex_all.c Truncate a range
Any specified cursors end with no position, and subsequent calls to the WT_CURSOR::next (WT_CURSOR::prev) method will iterate from the beginning (end) of the table.
@param session the session handle
@param name the URI of the table or file to truncate
@param start optional cursor marking the first record discarded;
if NULL, the truncate starts from the beginning of
the object
@param stop optional cursor marking the last record discarded;
if NULL, the truncate continues to the end of the
object
@configempty{WT_SESSION.truncate, see dist/api_data.py}
@errors
upgrade: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>Upgrade a table or file.
Upgrade upgrades a table or file, if upgrade is required.
@exclusive
@snippet ex_all.c Upgrade a table
@param session the session handle @param name the URI of the table or file to upgrade @configempty{WT_SESSION.upgrade, see dist/api_data.py} @ebusy_errors
verify: Option<unsafe extern "C" fn(session: *mut WT_SESSION, name: *const c_char, config: *const c_char) -> c_int>Verify a table or file.
Verify reports if a file, or the files of which a table is comprised, have been corrupted. The WT_SESSION::salvage method can be used to repair a corrupted file,
@snippet ex_all.c Verify a table
@exclusive
@param session the session handle @param name the URI of the table or file to verify @configstart{WT_SESSION.verify, see dist/api_data.py} @config{dump_address, Display addresses and page types as pages are verified, using the application’s message handler, intended for debugging., a boolean flag; default \c false.} @config{dump_blocks, Display the contents of on-disk blocks as they are verified, using the application’s message handler, intended for debugging., a boolean flag; default \c false.} @config{dump_layout, Display the layout of the files as they are verified, using the application’s message handler, intended for debugging; requires optional support from the block manager., a boolean flag; default \c false.} @config{dump_offsets, Display the contents of specific on-disk blocks, using the application’s message handler, intended for debugging., a list of strings; default empty.} @config{dump_pages, Display the contents of in-memory pages as they are verified, using the application’s message handler, intended for debugging., a boolean flag; default \c false.} @config{strict, Treat any verification problem as an error; by default, verify will warn, but not fail, in the case of errors that won’t affect future behavior (for example, a leaked block)., a boolean flag; default \c false.} @configend @ebusy_errors
begin_transaction: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>@name Transactions @{ / /*! Start a transaction in this session.
The transaction remains active until ended by WT_SESSION::commit_transaction or WT_SESSION::rollback_transaction. Operations performed on cursors capable of supporting transactional operations that are already open in this session, or which are opened before the transaction ends, will operate in the context of the transaction.
@requires_notransaction
@snippet ex_all.c transaction commit/rollback
@param session the session handle @configstart{WT_SESSION.begin_transaction, see dist/api_data.py} @config{ignore_prepare, whether to ignore the updates by other prepared transactions as part of read operations of this transaction., a boolean flag; default \c false.} @config{isolation, the isolation level for this transaction; defaults to the session’s isolation level., a string, chosen from the following options: \c “read-uncommitted”, \c “read-committed”, \c “snapshot”; default empty.} @config{name, name of the transaction for tracing and debugging., a string; default empty.} @config{priority, priority of the transaction for resolving conflicts. Transactions with higher values are less likely to abort., an integer between -100 and 100; default \c 0.} @config{read_timestamp, read using the specified timestamp. The supplied value must not be older than the current oldest timestamp. See @ref transaction_timestamps., a string; default empty.} @config{round_to_oldest, if read timestamp is earlier than oldest timestamp, read timestamp will be rounded to oldest timestamp., a boolean flag; default \c false.} @config{snapshot, use a named, in-memory snapshot, see @ref transaction_named_snapshots., a string; default empty.} @config{sync, whether to sync log records when the transaction commits, inherited from ::wiredtiger_open \c transaction_sync., a boolean flag; default empty.} @configend @errors
commit_transaction: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>Commit the current transaction.
A transaction must be in progress when this method is called.
If WT_SESSION::commit_transaction returns an error, the transaction was rolled back, not committed.
@requires_transaction
@snippet ex_all.c transaction commit/rollback
@param session the session handle @configstart{WT_SESSION.commit_transaction, see dist/api_data.py} @config{commit_timestamp, set the commit timestamp for the current transaction. The supplied value must not be older than the first commit timestamp set for the current transaction. The value must also not be older than the current oldest and stable timestamps. See @ref transaction_timestamps., a string; default empty.} @config{sync, override whether to sync log records when the transaction commits, inherited from ::wiredtiger_open \c transaction_sync. The \c background setting initiates a background synchronization intended to be used with a later call to WT_SESSION::transaction_sync. The \c off setting does not wait for record to be written or synchronized. The \c on setting forces log records to be written to the storage device., a string, chosen from the following options: \c “background”, \c “off”, \c “on”; default empty.} @configend @errors
prepare_transaction: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>Prepare the current transaction.
A transaction must be in progress when this method is called.
Preparing a transaction will guarantee a subsequent commit will succeed. Only commit and rollback are allowed on a transaction after it has been prepared. The transaction prepare API is designed to support MongoDB exclusively, and guarantees update conflicts have been resolved, but does not guarantee durability.
@requires_transaction
@snippet ex_all.c transaction prepare
@param session the session handle @configstart{WT_SESSION.prepare_transaction, see dist/api_data.py} @config{prepare_timestamp, set the prepare timestamp for the updates of the current transaction. The supplied value must not be older than any active read timestamps. This configuration option is mandatory. See @ref transaction_timestamps., a string; default empty.} @configend @errors
rollback_transaction: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>Roll back the current transaction.
A transaction must be in progress when this method is called.
All cursors are reset.
@requires_transaction
@snippet ex_all.c transaction commit/rollback
@param session the session handle @configempty{WT_SESSION.rollback_transaction, see dist/api_data.py} @errors
timestamp_transaction: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>Set a timestamp on a transaction.
@snippet ex_all.c transaction timestamp
@requires_transaction
@param session the session handle @configstart{WT_SESSION.timestamp_transaction, see dist/api_data.py} @config{commit_timestamp, set the commit timestamp for the current transaction. The supplied value must not be older than the first commit timestamp set for the current transaction. The value must also not be older than the current oldest and stable timestamps. See @ref transaction_timestamps., a string; default empty.} @config{read_timestamp, read using the specified timestamp. The supplied value must not be older than the current oldest timestamp. This can only be set once for a transaction. @ref transaction_timestamps., a string; default empty.} @config{round_to_oldest, if read timestamp is earlier than oldest timestamp, read timestamp will be rounded to oldest timestamp., a boolean flag; default \c false.} @configend @errors
checkpoint: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>Write a transactionally consistent snapshot of a database or set of objects. In the absence of transaction timestamps, the checkpoint includes all transactions committed before the checkpoint starts.
When timestamps are in use and a \c stable_timestamp has been set via WT_CONNECTION::set_timestamp and the checkpoint runs with \c use_timestamp=true (the default), updates committed with a timestamp larger than the \c stable_timestamp will not be included in the checkpoint for tables configured with \c log=(enabled=false). For tables with logging enabled, all committed changes will be included in the checkpoint (since recovery would roll them forward anyway).
Additionally, existing named checkpoints may optionally be discarded.
@requires_notransaction
@snippet ex_all.c Checkpoint examples
@param session the session handle
@configstart{WT_SESSION.checkpoint, see dist/api_data.py}
@config{drop, specify a list of checkpoints to drop. The list may
additionally contain one of the following keys: \c “from=all” to drop
all checkpoints, \c “from=
snapshot: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>Manage named snapshot transactions. Use this API to create and drop named snapshots. Named snapshot transactions can be accessed via WT_CURSOR::open. See @ref transaction_named_snapshots.
@snippet ex_all.c Snapshot examples
@param session the session handle @configstart{WT_SESSION.snapshot, see dist/api_data.py} @config{drop = (, if non-empty, specifies which snapshots to drop. Where a group of snapshots are being dropped, the order is based on snapshot creation order not alphanumeric name order., a set of related configuration options defined below.} @config{ all, drop all named snapshots., a boolean flag; default \c false.} @config{ before, drop all snapshots up to but not including the specified name., a string; default empty.} @config{ names, drop specific named snapshots., a list of strings; default empty.} @config{ to, drop all snapshots up to and including the specified name., a string; default empty.} @config{ ),,} @config{include_updates, make updates from the current transaction visible to users of the named snapshot. Transactions started with such a named snapshot are restricted to being read-only., a boolean flag; default \c false.} @config{name, specify a name for the snapshot., a string; default empty.} @configend @errors
transaction_pinned_range: Option<unsafe extern "C" fn(session: *mut WT_SESSION, range: *mut u64) -> c_int>Return the transaction ID range pinned by the session handle.
The ID range is approximate and is calculated based on the oldest ID needed for the active transaction in this session, compared to the newest transaction in the system.
@snippet ex_all.c transaction pinned range
@param session the session handle @param[out] range the range of IDs pinned by this session. Zero if there is no active transaction. @errors
transaction_sync: Option<unsafe extern "C" fn(session: *mut WT_SESSION, config: *const c_char) -> c_int>Wait for a transaction to become synchronized. This method is only useful when ::wiredtiger_open is configured with the \c transaction_sync setting disabled.
@requires_notransaction
@snippet ex_all.c Transaction sync
@param session the session handle @configstart{WT_SESSION.transaction_sync, see dist/api_data.py} @config{timeout_ms, maximum amount of time to wait for background sync to complete in milliseconds. A value of zero disables the timeout and returns immediately., an integer; default \c 1200000.} @configend @errors
breakpoint: Option<unsafe extern "C" fn(session: *mut WT_SESSION) -> c_int>Call into the library.
This method is used for breakpoints and to set other configuration when debugging layers not directly supporting those features.
@param session the session handle @errors
Trait Implementations§
Source§impl Clone for __wt_session
impl Clone for __wt_session
Source§fn clone(&self) -> __wt_session
fn clone(&self) -> __wt_session
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more