summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/docs/cursors.dox
diff options
context:
space:
mode:
authorRamon Fernandez <ramon@mongodb.com>2016-01-27 17:17:17 -0500
committerRamon Fernandez <ramon@mongodb.com>2016-01-27 17:17:21 -0500
commit90118b147a6943b19dc929862a11071538db1438 (patch)
treed1e2c409595332174953e7dbe2db262935d89ae5 /src/third_party/wiredtiger/src/docs/cursors.dox
parentb8cad6a59cbce2831e69e6b94f9544d83d6e00b0 (diff)
downloadmongo-90118b147a6943b19dc929862a11071538db1438.tar.gz
Import wiredtiger-wiredtiger-2.7.0-505-g7fea169.tar.gz from wiredtiger branch mongodb-3.4
ref: 44463c5..7fea169 WT-2355 Fix minor scratch buffer usage in logging. WT-2348 xargs -P isn't portable WT-2347 Java: schema format edge cases WT-2344 OS X compiler warning WT-2342 Enhance wtperf to support background create and drop operations WT-2340 Add logging guarantee assertions, whitespace WT-2339 format post-rebalance verify failure (stress run #11586) WT-2338 Disable using pre-allocated log files when backup cursor is open WT-2335 NULL pointer crash in config_check_search with invalid configuration string WT-2333 Add a flag so drop doesn't block WT-2332 Bug in logging write-no-sync mode WT-2331 Checking of search() result for reference cursors before join() WT-2328 schema drop does direct unlink, it should use a block manager interface. WT-2326 Change WTPERF to use new memory allocation functions instead of the standard WT-2321 WT-2321: race between eviction and worker threads on the eviction queue WT-2320 Only check copyright when cutting releases WT-2316 stress test failure: WT_CURSOR.prev out-of-order returns WT-2314 page-swap error handling is inconsistent WT-2313 sweep-server: conn_dhandle.c, 610: dhandle != conn->cache->evict_file_next WT-2312 re-creating a deleted column-store page can corrupt the in-memory tree WT-2308 custom extractor for ref_cursors in join cursor WT-2305 Fix coverity scan issues on 23/12/2015 WT-2296 New log algorithm needs improving for sync/flush settings WT-2295 WT_SESSION.create does a full-scan of the main table WT-2287 WT_SESSION.rebalance WT-2275 broken DB after application crash WT-2267 Improve wtperf throttling implementation to provide steady load WT-2247 variable-length column-store in-memory page splits WT-2242 WiredTiger treats dead trees the same as other trees in eviction WT-2142 Connection cleanup in Python tests WT-2073 metadata cleanups WT-1801 Add a directory sync after rollback of a WT_SESSION::rename operation WT-1517 schema format edge cases SERVER-22064 Coverity analysis defect 77699: Unchecked return value SERVER-21619 sys-perf: WT crash during core_workloads_WT execution
Diffstat (limited to 'src/third_party/wiredtiger/src/docs/cursors.dox')
-rw-r--r--src/third_party/wiredtiger/src/docs/cursors.dox144
1 files changed, 144 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/src/docs/cursors.dox b/src/third_party/wiredtiger/src/docs/cursors.dox
new file mode 100644
index 00000000000..b6271951f91
--- /dev/null
+++ b/src/third_party/wiredtiger/src/docs/cursors.dox
@@ -0,0 +1,144 @@
+/*! @m_page{{c,java},cursors,Cursors}
+
+Common operations in WiredTiger are performed using WT_CURSOR handles.
+A cursor includes:
+
+- a position within a data source
+- getter/setters for key and value fields
+- encoding of fields to store in the data source
+- methods to navigate within and iterate through the data
+
+See @subpage cursor_ops for a description of how to use cursors.
+
+@section cursor_types Cursor types
+
+@copydoc doc_cursor_types
+
+See the following for more details:
+
+- @subpage data_sources
+- @ref metadata
+- @ref cursor_log
+- @ref cursor_join
+
+@section cursor_projections Projections
+
+Cursors on tables and indices can return a subset of columns. This is done by
+listing the column names in parenthesis in the <code>uri</code> parameter to
+WT_SESSION::open_cursor. Only the fields from the listed columns are returned
+by WT_CURSOR::get_value.
+
+The @ex_ref{ex_schema.c} example creates a table where the value format is
+\c "5sHq", where the initial string is the country, the short is a year,
+and the long is a population. The following example lists just the country
+and year columns from the table record values:
+
+@snippet ex_schema.c Return a subset of values from the table
+
+This is particularly useful with index cursors, because if all columns in
+the projection are available in the index (including primary key columns,
+which are the values of the index), the data can be read from the index
+without accessing any column groups. See @ref schema_index_projections for
+more information.
+
+@section cursors_transactions Cursors and Transactions
+
+If there is a transaction active in a session, cursors operate in the
+context of that transaction. Reads performed while a transaction is
+active inherit the isolation level of the transaction, and updates
+performed within a transaction are made durable by calling
+WT_SESSION::commit_transaction, or discarded by calling
+WT_SESSION::rollback_transaction.
+
+If no transaction is active, cursor reads are performed at the isolation
+level of the session, set with the \c isolation configuration key to
+WT_CONNECTION::open_session and successful updates are automatically
+committed before the update operation completes.
+
+Any operation that consists of multiple related updates should be
+enclosed in an explicit transaction to ensure that the updates are
+applied atomically.
+
+At \c read-committed (the default) or \c snapshot isolation levels,
+committed changes from concurrent transactions become visible when no
+cursor is positioned. In other words, at these isolation levels, all
+cursors in a session read from a stable snapshot while any cursor in the
+session remains positioned.
+
+Cursor positions survive transaction boundaries, unless a transaction
+is rolled back. When a transaction is rolled-back either implicitly
+or explicitly, all cursors in the session are reset as if the
+WT_CURSOR::reset method was called, discarding any cursor position as
+well as any key and value.
+
+See @ref transactions for more information.
+
+@section cursors_eviction Cursors and Eviction
+
+Cursor positions hold resources that can inhibit the eviction of memory
+pages. If a cursor is active on a page being considered for eviction,
+the eviction will defer until the cursor is moved or reset. To avoid
+this and to keep resources freed in general, an application should call
+WT_CURSOR::reset during times it does not need to keep the cursor
+positioned. A cursor that has been reset is not active and will not
+inhibit eviction.
+
+@section cursor_raw Raw mode
+
+Cursors can be configured for raw mode by specifying the \c "raw" config
+keyword to WT_SESSION::open_cursor. In this mode, the methods
+WT_CURSOR::get_key, WT_CURSOR::get_value, WT_CURSOR::set_key and
+WT_CURSOR::set_value all take a single
+@m_if{c}
+WT_ITEM
+@m_else
+byte array
+@m_endif
+in the variable-length
+argument list instead of a separate argument for each column.
+
+@m_if{c}
+WT_ITEM structures do not need to be cleared before use.
+
+For WT_CURSOR::get_key and WT_CURSOR::get_value in raw mode, the WT_ITEM
+can be split into columns by calling WT_EXTENSION_API::struct_unpack
+with the cursor's \c key_format or \c value_format, respectively. For
+WT_CURSOR::set_key and WT_CURSOR::set_value in raw mode, the WT_ITEM
+should be equivalent to calling WT_EXTENSION_API::struct_pack for the
+cursor's \c key_format or \c value_format, respectively.
+
+The @ex_ref{ex_schema.c} example creates a table where the value format is
+\c "5sHq", where the initial string is the country, the short is a year,
+and the long is a population.
+@m_endif
+The following example lists the table record
+values, using raw mode:
+
+@snippet ex_schema.c List the records in the table using raw mode.
+
+Raw mode can be used in combination with projections. The following
+example lists just the country and year columns from the table record
+values, using raw mode:
+
+@snippet ex_schema.c Return a subset of values from the table using raw mode
+
+@section metadata Reading WiredTiger Metadata
+
+WiredTiger cursors provide access to data from a variety of sources.
+One of these sources is the list of objects in the database.
+
+To retrieve the list of database objects, open a cursor on the uri
+<code>metadata:</code>. Each returned key will be a database object and
+each returned value will be the information stored in the metadata for
+object named by the key.
+
+For example:
+
+@snippet ex_all.c Open a cursor on the metadata
+
+To retrieve value strings that are valid arguments for calls to
+WT_SESSION::create, open a cursor on <code>metadata:create</code>.
+
+The metadata cursor is read-only, and the metadata cannot be modified.
+
+*/