1/*- 2 * Copyright (c) 2014-2018 MongoDB, Inc. 3 * Copyright (c) 2008-2014 WiredTiger, Inc. 4 * All rights reserved. 5 * 6 * See the file LICENSE for redistribution information. 7 */ 8 9#ifndef __WIREDTIGER_H_ 10#define __WIREDTIGER_H_ 11 12#if defined(__cplusplus) 13extern "C" { 14#endif 15 16/******************************************* 17 * Version information 18 *******************************************/ 19#define WIREDTIGER_VERSION_MAJOR @VERSION_MAJOR@ 20#define WIREDTIGER_VERSION_MINOR @VERSION_MINOR@ 21#define WIREDTIGER_VERSION_PATCH @VERSION_PATCH@ 22#define WIREDTIGER_VERSION_STRING @VERSION_STRING@ 23 24/******************************************* 25 * Required includes 26 *******************************************/ 27@wiredtiger_includes_decl@ 28 29/******************************************* 30 * Portable type names 31 *******************************************/ 32@off_t_decl@ 33@uintmax_t_decl@ 34@uintptr_t_decl@ 35 36#if defined(DOXYGEN) || defined(SWIG) 37#define __F(func) func 38#else 39#define __F(func) (*func) 40#endif 41 42/* 43 * We support configuring WiredTiger with the gcc/clang -fvisibility=hidden 44 * flags, but that requires public APIs be specifically marked. 45 */ 46#if defined(DOXYGEN) || defined(SWIG) || !defined(__GNUC__) 47#define WT_ATTRIBUTE_LIBRARY_VISIBLE 48#else 49#define WT_ATTRIBUTE_LIBRARY_VISIBLE __attribute__((visibility("default"))) 50#endif 51 52/*! 53 * @defgroup wt WiredTiger API 54 * The functions, handles and methods applications use to access and manage 55 * data with WiredTiger. 56 * 57 * @{ 58 */ 59 60/******************************************* 61 * Public forward structure declarations 62 *******************************************/ 63struct __wt_async_callback; 64 typedef struct __wt_async_callback WT_ASYNC_CALLBACK; 65struct __wt_async_op; typedef struct __wt_async_op WT_ASYNC_OP; 66struct __wt_collator; typedef struct __wt_collator WT_COLLATOR; 67struct __wt_compressor; typedef struct __wt_compressor WT_COMPRESSOR; 68struct __wt_config_item; typedef struct __wt_config_item WT_CONFIG_ITEM; 69struct __wt_config_parser; 70 typedef struct __wt_config_parser WT_CONFIG_PARSER; 71struct __wt_connection; typedef struct __wt_connection WT_CONNECTION; 72struct __wt_cursor; typedef struct __wt_cursor WT_CURSOR; 73struct __wt_data_source; typedef struct __wt_data_source WT_DATA_SOURCE; 74struct __wt_encryptor; typedef struct __wt_encryptor WT_ENCRYPTOR; 75struct __wt_event_handler; typedef struct __wt_event_handler WT_EVENT_HANDLER; 76struct __wt_extension_api; typedef struct __wt_extension_api WT_EXTENSION_API; 77struct __wt_extractor; typedef struct __wt_extractor WT_EXTRACTOR; 78struct __wt_file_handle; typedef struct __wt_file_handle WT_FILE_HANDLE; 79struct __wt_file_system; typedef struct __wt_file_system WT_FILE_SYSTEM; 80struct __wt_item; typedef struct __wt_item WT_ITEM; 81struct __wt_modify; typedef struct __wt_modify WT_MODIFY; 82struct __wt_session; typedef struct __wt_session WT_SESSION; 83 84#if defined(SWIGJAVA) 85#define WT_HANDLE_NULLABLE(typename) typename##_NULLABLE 86#define WT_HANDLE_CLOSED(typename) typename##_CLOSED 87typedef WT_CURSOR WT_CURSOR_NULLABLE; 88typedef WT_CURSOR WT_CURSOR_CLOSED; 89typedef WT_SESSION WT_SESSION_CLOSED; 90typedef WT_CONNECTION WT_CONNECTION_CLOSED; 91#elif !defined(DOXYGEN) 92#define WT_HANDLE_NULLABLE(typename) typename 93#define WT_HANDLE_CLOSED(typename) typename 94#endif 95 96/*! 97 * A raw item of data to be managed, including a pointer to the data and a 98 * length. 99 * 100 * WT_ITEM structures do not need to be cleared before use. 101 */ 102struct __wt_item { 103 /*! 104 * The memory reference of the data item. 105 * 106 * For items returned by a WT_CURSOR, the pointer is only valid until 107 * the next operation on that cursor. Applications that need to keep 108 * an item across multiple cursor operations must make a copy. 109 */ 110 const void *data; 111 112 /*! 113 * The number of bytes in the data item. 114 * 115 * The maximum length of a single column stored in a table is not fixed 116 * (as it partially depends on the underlying file configuration), but 117 * is always a small number of bytes less than 4GB. 118 */ 119 size_t size; 120 121#ifndef DOXYGEN 122 /*! Managed memory chunk (internal use). */ 123 void *mem; 124 125 /*! Managed memory size (internal use). */ 126 size_t memsize; 127 128 /*! Object flags (internal use). */ 129/* AUTOMATIC FLAG VALUE GENERATION START */ 130#define WT_ITEM_ALIGNED 0x1u 131#define WT_ITEM_INUSE 0x2u 132/* AUTOMATIC FLAG VALUE GENERATION STOP */ 133 uint32_t flags; 134#endif 135}; 136 137/*! 138 * A set of modifications for a value, including a pointer to new data and a 139 * length, plus a target offset in the value and an optional length of data 140 * in the value to be replaced. 141 * 142 * WT_MODIFY structures do not need to be cleared before use. 143 */ 144struct __wt_modify { 145 /*! 146 * New data. The size of the new data may be zero when no new data is 147 * provided. 148 */ 149 WT_ITEM data; 150 151 /*! 152 * The zero-based byte offset in the value where the new data is placed. 153 * 154 * If the offset is past the end of the value, padding bytes are 155 * appended to the value up to the specified offset. If the value is a 156 * string (value format \c S), the padding byte is a space. If the value 157 * is a raw byte array accessed using a WT_ITEM structure (value format 158 * \c u), the padding byte is a nul. 159 */ 160 size_t offset; 161 162 /*! 163 * The number of bytes in the value to be replaced. 164 * 165 * If the size is zero, no bytes from the value are replaced and the new 166 * data is inserted. 167 * 168 * If the offset is past the end of the value, the size is ignored. 169 * 170 * If the offset plus the size overlaps the end of the previous value, 171 * bytes from the offset to the end of the value are replaced and any 172 * remaining new data is appended. 173 */ 174 size_t size; 175}; 176 177/*! 178 * The maximum packed size of a 64-bit integer. The ::wiredtiger_struct_pack 179 * function will pack single long integers into at most this many bytes. 180 */ 181#define WT_INTPACK64_MAXSIZE ((int)sizeof(int64_t) + 1) 182 183/*! 184 * The maximum packed size of a 32-bit integer. The ::wiredtiger_struct_pack 185 * function will pack single integers into at most this many bytes. 186 */ 187#define WT_INTPACK32_MAXSIZE ((int)sizeof(int32_t) + 1) 188 189/*! 190 * A WT_CURSOR handle is the interface to a cursor. 191 * 192 * Cursors allow data to be searched, iterated and modified, implementing the 193 * CRUD (create, read, update and delete) operations. Cursors are opened in 194 * the context of a session. If a transaction is started, cursors operate in 195 * the context of the transaction until the transaction is resolved. 196 * 197 * Raw data is represented by key/value pairs of WT_ITEM structures, but 198 * cursors can also provide access to fields within the key and value if the 199 * formats are described in the WT_SESSION::create method. 200 * 201 * In the common case, a cursor is used to access records in a table. However, 202 * cursors can be used on subsets of tables (such as a single column or a 203 * projection of multiple columns), as an interface to statistics, configuration 204 * data or application-specific data sources. See WT_SESSION::open_cursor for 205 * more information. 206 * 207 * <b>Thread safety:</b> A WT_CURSOR handle is not usually shared between 208 * threads, see @ref threads for more information. 209 */ 210struct __wt_cursor { 211 WT_SESSION *session; /*!< The session handle for this cursor. */ 212 213 /*! 214 * The name of the data source for the cursor, matches the \c uri 215 * parameter to WT_SESSION::open_cursor used to open the cursor. 216 */ 217 const char *uri; 218 219 /*! 220 * The format of the data packed into key items. See @ref packing for 221 * details. If not set, a default value of "u" is assumed, and 222 * applications must use WT_ITEM structures to manipulate untyped byte 223 * arrays. 224 */ 225 const char *key_format; 226 227 /*! 228 * The format of the data packed into value items. See @ref packing 229 * for details. If not set, a default value of "u" is assumed, and 230 * applications must use WT_ITEM structures to manipulate untyped byte 231 * arrays. 232 */ 233 const char *value_format; 234 235 /*! 236 * @name Data access 237 * @{ 238 */ 239 /*! 240 * Get the key for the current record. 241 * 242 * @snippet ex_all.c Get the cursor's string key 243 * 244 * @snippet ex_all.c Get the cursor's record number key 245 * 246 * @param cursor the cursor handle 247 * @param ... pointers to hold key fields corresponding to 248 * WT_CURSOR::key_format. 249 * @errors 250 */ 251 int __F(get_key)(WT_CURSOR *cursor, ...); 252 253 /*! 254 * Get the value for the current record. 255 * 256 * @snippet ex_all.c Get the cursor's string value 257 * 258 * @snippet ex_all.c Get the cursor's raw value 259 * 260 * @param cursor the cursor handle 261 * @param ... pointers to hold value fields corresponding to 262 * WT_CURSOR::value_format. 263 * @errors 264 */ 265 int __F(get_value)(WT_CURSOR *cursor, ...); 266 267 /*! 268 * Set the key for the next operation. 269 * 270 * @snippet ex_all.c Set the cursor's string key 271 * 272 * @snippet ex_all.c Set the cursor's record number key 273 * 274 * @param cursor the cursor handle 275 * @param ... key fields corresponding to WT_CURSOR::key_format. 276 * 277 * If an error occurs during this operation, a flag will be set in the 278 * cursor, and the next operation to access the key will fail. This 279 * simplifies error handling in applications. 280 */ 281 void __F(set_key)(WT_CURSOR *cursor, ...); 282 283 /*! 284 * Set the value for the next operation. 285 * 286 * @snippet ex_all.c Set the cursor's string value 287 * 288 * @snippet ex_all.c Set the cursor's raw value 289 * 290 * @param cursor the cursor handle 291 * @param ... value fields corresponding to WT_CURSOR::value_format. 292 * 293 * If an error occurs during this operation, a flag will be set in the 294 * cursor, and the next operation to access the value will fail. This 295 * simplifies error handling in applications. 296 */ 297 void __F(set_value)(WT_CURSOR *cursor, ...); 298 /*! @} */ 299 300 /*! 301 * @name Cursor positioning 302 * @{ 303 */ 304 /*! 305 * Return the ordering relationship between two cursors: both cursors 306 * must have the same data source and have valid keys. (When testing 307 * only for equality, WT_CURSOR::equals may be faster.) 308 * 309 * @snippet ex_all.c Cursor comparison 310 * 311 * @param cursor the cursor handle 312 * @param other another cursor handle 313 * @param comparep the status of the comparison: < 0 if 314 * <code>cursor</code> refers to a key that appears before 315 * <code>other</code>, 0 if the cursors refer to the same key, 316 * and > 0 if <code>cursor</code> refers to a key that appears after 317 * <code>other</code>. 318 * @errors 319 */ 320 int __F(compare)(WT_CURSOR *cursor, WT_CURSOR *other, int *comparep); 321 322 /*! 323 * Return the ordering relationship between two cursors, testing only 324 * for equality: both cursors must have the same data source and have 325 * valid keys. 326 * 327 * @snippet ex_all.c Cursor equality 328 * 329 * @param cursor the cursor handle 330 * @param other another cursor handle 331 * @param[out] equalp the status of the comparison: 1 if the cursors 332 * refer to the same key, otherwise 0. 333 * @errors 334 */ 335 int __F(equals)(WT_CURSOR *cursor, WT_CURSOR *other, int *equalp); 336 337 /*! 338 * Return the next record. 339 * 340 * @snippet ex_all.c Return the next record 341 * 342 * @param cursor the cursor handle 343 * @errors 344 */ 345 int __F(next)(WT_CURSOR *cursor); 346 347 /*! 348 * Return the previous record. 349 * 350 * @snippet ex_all.c Return the previous record 351 * 352 * @param cursor the cursor handle 353 * @errors 354 */ 355 int __F(prev)(WT_CURSOR *cursor); 356 357 /*! 358 * Reset the cursor. Any resources held by the cursor are released, 359 * and the cursor's key and position are no longer valid. Subsequent 360 * iterations with WT_CURSOR::next will move to the first record, or 361 * with WT_CURSOR::prev will move to the last record. 362 * 363 * In the case of a statistics cursor, resetting the cursor refreshes 364 * the statistics information returned. 365 * 366 * @snippet ex_all.c Reset the cursor 367 * 368 * @param cursor the cursor handle 369 * @errors 370 */ 371 int __F(reset)(WT_CURSOR *cursor); 372 373 /*! 374 * Return the record matching the key. The key must first be set. 375 * 376 * @snippet ex_all.c Search for an exact match 377 * 378 * On success, the cursor ends positioned at the returned record; to 379 * minimize cursor resources, the WT_CURSOR::reset method should be 380 * called as soon as the record has been retrieved and the cursor no 381 * longer needs that position. 382 * 383 * @param cursor the cursor handle 384 * @errors 385 */ 386 int __F(search)(WT_CURSOR *cursor); 387 388 /*! 389 * Return the record matching the key if it exists, or an adjacent 390 * record. An adjacent record is either the smallest record larger 391 * than the key or the largest record smaller than the key (in other 392 * words, a logically adjacent key). 393 * 394 * The key must first be set. 395 * 396 * An example of a search for an exact or adjacent match: 397 * 398 * @snippet ex_all.c Search for an exact or adjacent match 399 * 400 * An example of a forward scan through the table, where all keys 401 * greater than or equal to a specified prefix are included in the 402 * scan: 403 * 404 * @snippet ex_all.c Forward scan greater than or equal 405 * 406 * An example of a backward scan through the table, where all keys 407 * less than a specified prefix are included in the scan: 408 * 409 * @snippet ex_all.c Backward scan less than 410 * 411 * On success, the cursor ends positioned at the returned record; to 412 * minimize cursor resources, the WT_CURSOR::reset method should be 413 * called as soon as the record has been retrieved and the cursor no 414 * longer needs that position. 415 * 416 * @param cursor the cursor handle 417 * @param exactp the status of the search: 0 if an exact match is 418 * found, < 0 if a smaller key is returned, > 0 if a larger key is 419 * returned 420 * @errors 421 */ 422 int __F(search_near)(WT_CURSOR *cursor, int *exactp); 423 /*! @} */ 424 425 /*! 426 * @name Data modification 427 * @{ 428 */ 429 /*! 430 * Insert a record and optionally update an existing record. 431 * 432 * If the cursor was configured with "overwrite=true" (the default), 433 * both the key and value must be set; if the record already exists, 434 * the key's value will be updated, otherwise, the record will be 435 * inserted. 436 * 437 * @snippet ex_all.c Insert a new record or overwrite an existing record 438 * 439 * If the cursor was not configured with "overwrite=true", both the key 440 * and value must be set and the record must not already exist; the 441 * record will be inserted. 442 * 443 * @snippet ex_all.c Insert a new record and fail if the record exists 444 * 445 * If a cursor with record number keys was configured with 446 * "append=true" (not the default), the value must be set; a new record 447 * will be appended and the record number set as the cursor key value. 448 * 449 * @snippet ex_all.c Insert a new record and assign a record number 450 * 451 * The cursor ends with no position, and a subsequent call to the 452 * WT_CURSOR::next (WT_CURSOR::prev) method will iterate from the 453 * beginning (end) of the table. 454 * 455 * If the cursor does not have record number keys or was not configured 456 * with "append=true", the cursor ends with no key set and a subsequent 457 * call to the WT_CURSOR::get_key method will fail. The cursor ends with 458 * no value set and a subsequent call to the WT_CURSOR::get_value method 459 * will fail. 460 * 461 * Inserting a new record after the current maximum record in a 462 * fixed-length bit field column-store (that is, a store with an 463 * 'r' type key and 't' type value) may implicitly create the missing 464 * records as records with a value of 0. 465 * 466 * When loading a large amount of data into a new object, using 467 * a cursor with the \c bulk configuration string enabled and 468 * loading the data in sorted order will be much faster than doing 469 * out-of-order inserts. See @ref tune_bulk_load for more information. 470 * 471 * The maximum length of a single column stored in a table is not fixed 472 * (as it partially depends on the underlying file configuration), but 473 * is always a small number of bytes less than 4GB. 474 * 475 * @param cursor the cursor handle 476 * @errors 477 * In particular, if \c overwrite=false is configured and a record with 478 * the specified key already exists, ::WT_DUPLICATE_KEY is returned. 479 * Also, if \c in_memory is configured for the database and the insert 480 * requires more than the configured cache size to complete, 481 * ::WT_CACHE_FULL is returned. 482 */ 483 int __F(insert)(WT_CURSOR *cursor); 484 485 /*! 486 * Modify an existing record. 487 * 488 * Both the key and value must be set and the record must already exist; 489 * the record will be updated. 490 * 491 * Modifications are specified in WT_MODIFY structures. Modifications 492 * are applied in order and later modifications can update earlier ones. 493 * 494 * The modify method is only supported on strings (value format type 495 * \c S), or raw byte arrays accessed using a WT_ITEM structure (value 496 * format type \c u). 497 * 498 * The WT_CURSOR::modify method can only be called from within an 499 * explicit transaction configured at a higher isolation level than 500 * \c read-uncommitted. Using \c read-committed isolation is allowed, 501 * but requires caution: reading a value, re-positioning the cursor 502 * and then modifying the value based on the initial read could lead 503 * to unexpected results. Using \c snapshot isolation is recommended. 504 * 505 * The WT_CURSOR::modify method stores a change record in cache and 506 * writes a change record to the log instead of the usual complete 507 * values. Note that WT_CURSOR::modify is generally slower than the 508 * WT_CURSOR::update method, and can result in slower reads because 509 * the complete value must be assembled during retrieval. The 510 * WT_CURSOR::modify method is intended for applications modifying 511 * large records where there is cache or I/O pressure, that is, 512 * applications that will benefit when data updates require less cache 513 * and they write less logging information. 514 * 515 * @snippet ex_all.c Modify an existing record 516 * 517 * On success, the cursor ends positioned at the modified record; to 518 * minimize cursor resources, the WT_CURSOR::reset method should be 519 * called as soon as the cursor no longer needs that position. 520 * 521 * The maximum length of a single column stored in a table is not fixed 522 * (as it partially depends on the underlying file configuration), but 523 * is always a small number of bytes less than 4GB. 524 * 525 * @param cursor the cursor handle 526 * @param entries an array of modification data structures 527 * @param nentries the number of modification data structures 528 * @errors 529 * In particular, if \c in_memory is configured for the database and 530 * the modify requires more than the configured cache size to complete, 531 * ::WT_CACHE_FULL is returned. 532 */ 533 int __F(modify)(WT_CURSOR *cursor, WT_MODIFY *entries, int nentries); 534 535 /*! 536 * Update an existing record and optionally insert a record. 537 * 538 * If the cursor was configured with "overwrite=true" (the default), 539 * both the key and value must be set; if the record already exists, the 540 * key's value will be updated, otherwise, the record will be inserted. 541 * 542 * @snippet ex_all.c Update an existing record or insert a new record 543 * 544 * If the cursor was not configured with "overwrite=true", both the key 545 * and value must be set and the record must already exist; the 546 * record will be updated. 547 * 548 * @snippet ex_all.c Update an existing record and fail if DNE 549 * 550 * On success, the cursor ends positioned at the modified record; to 551 * minimize cursor resources, the WT_CURSOR::reset method should be 552 * called as soon as the cursor no longer needs that position. (The 553 * WT_CURSOR::insert method never keeps a cursor position and may be 554 * more efficient for that reason.) 555 * 556 * The maximum length of a single column stored in a table is not fixed 557 * (as it partially depends on the underlying file configuration), but 558 * is always a small number of bytes less than 4GB. 559 * 560 * @param cursor the cursor handle 561 * @errors 562 * In particular, if \c overwrite=false is configured and no record with 563 * the specified key exists, ::WT_NOTFOUND is returned. 564 * Also, if \c in_memory is configured for the database and the update 565 * requires more than the configured cache size to complete, 566 * ::WT_CACHE_FULL is returned. 567 */ 568 int __F(update)(WT_CURSOR *cursor); 569 570 /*! 571 * Remove a record. 572 * 573 * If the cursor was configured with "overwrite=true" (the default), 574 * the key must be set; the key's record will be removed if it exists, 575 * no error will be returned if the record does not exist. 576 * 577 * @snippet ex_all.c Remove a record 578 * 579 * If the cursor was configured with "overwrite=false" (not the 580 * default), the key must be set and the key's record must exist; the 581 * record will be removed. 582 * 583 * Any cursor position does not change: if the cursor was positioned 584 * before the WT_CURSOR::remove call, the cursor remains positioned 585 * at the removed record; to minimize cursor resources, the 586 * WT_CURSOR::reset method should be called as soon as the cursor no 587 * longer needs that position. If the cursor was not positioned before 588 * the WT_CURSOR::remove call, the cursor ends with no position, and a 589 * subsequent call to the WT_CURSOR::next (WT_CURSOR::prev) method will 590 * iterate from the beginning (end) of the table. 591 * 592 * @snippet ex_all.c Remove a record and fail if DNE 593 * 594 * Removing a record in a fixed-length bit field column-store 595 * (that is, a store with an 'r' type key and 't' type value) is 596 * identical to setting the record's value to 0. 597 * 598 * @param cursor the cursor handle 599 * @errors 600 * In particular, if \c overwrite=false is configured and no record 601 * with the specified key exists, ::WT_NOTFOUND is returned. 602 */ 603 int __F(remove)(WT_CURSOR *cursor); 604 605 /*! 606 * Reserve an existing record so a subsequent write is less likely to 607 * fail due to a conflict between concurrent operations. 608 * 609 * The key must first be set and the record must already exist. 610 * 611 * Note that reserve works by doing a special update operation that is 612 * not logged and does not change the value of the record. This update 613 * is aborted when the enclosing transaction ends regardless of whether 614 * it commits or rolls back. Given that, reserve can only be used to 615 * detect conflicts between transactions that execute concurrently. It 616 * cannot detect all logical conflicts between transactions. For that, 617 * some update to the record must be committed. 618 * 619 * @snippet ex_all.c Reserve a record 620 * 621 * On success, the cursor ends positioned at the specified record; to 622 * minimize cursor resources, the WT_CURSOR::reset method should be 623 * called as soon as the cursor no longer needs that position. 624 * 625 * @param cursor the cursor handle 626 * @errors 627 */ 628 int __F(reserve)(WT_CURSOR *cursor); 629 /*! @} */ 630 631 /*! 632 * Close the cursor. 633 * 634 * This releases the resources associated with the cursor handle. 635 * Cursors are closed implicitly by ending the enclosing connection or 636 * closing the session in which they were opened. 637 * 638 * @snippet ex_all.c Close the cursor 639 * 640 * @param cursor the cursor handle 641 * @errors 642 */ 643 int __F(close)(WT_HANDLE_CLOSED(WT_CURSOR) *cursor); 644 645 /*! 646 * Reconfigure the cursor. 647 * 648 * The cursor is reset. 649 * 650 * @snippet ex_all.c Reconfigure a cursor 651 * 652 * @param cursor the cursor handle 653 * @configstart{WT_CURSOR.reconfigure, see dist/api_data.py} 654 * @config{append, append the value as a new record\, creating a new 655 * record number key; valid only for cursors with record number keys., a 656 * boolean flag; default \c false.} 657 * @config{overwrite, configures whether the cursor's insert\, update 658 * and remove methods check the existing state of the record. If \c 659 * overwrite is \c false\, WT_CURSOR::insert fails with 660 * ::WT_DUPLICATE_KEY if the record exists\, WT_CURSOR::update and 661 * WT_CURSOR::remove fail with ::WT_NOTFOUND if the record does not 662 * exist., a boolean flag; default \c true.} 663 * @configend 664 * @errors 665 */ 666 int __F(reconfigure)(WT_CURSOR *cursor, const char *config); 667 668 /* 669 * Protected fields, only to be used by cursor implementations. 670 */ 671#if !defined(SWIG) && !defined(DOXYGEN) 672 int __F(cache)(WT_CURSOR *cursor); /* Cache the cursor */ 673 /* Reopen a cached cursor */ 674 int __F(reopen)(WT_CURSOR *cursor, bool check_only); 675 676 uint64_t uri_hash; /* Hash of URI */ 677 678 /* 679 * !!! 680 * Explicit representations of structures from queue.h. 681 * TAILQ_ENTRY(wt_cursor) q; 682 */ 683 struct { 684 WT_CURSOR *tqe_next; 685 WT_CURSOR **tqe_prev; 686 } q; /* Linked list of WT_CURSORs. */ 687 688 uint64_t recno; /* Record number, normal and raw mode */ 689 uint8_t raw_recno_buf[WT_INTPACK64_MAXSIZE]; 690 691 void *json_private; /* JSON specific storage */ 692 void *lang_private; /* Language specific private storage */ 693 694 WT_ITEM key, value; 695 int saved_err; /* Saved error in set_{key,value}. */ 696 /* 697 * URI used internally, may differ from the URI provided by the 698 * user on open. 699 */ 700 const char *internal_uri; 701 702/* AUTOMATIC FLAG VALUE GENERATION START */ 703#define WT_CURSTD_APPEND 0x00001u 704#define WT_CURSTD_BULK 0x00002u 705#define WT_CURSTD_CACHEABLE 0x00004u 706#define WT_CURSTD_CACHED 0x00008u 707#define WT_CURSTD_DEAD 0x00010u 708#define WT_CURSTD_DUMP_HEX 0x00020u 709#define WT_CURSTD_DUMP_JSON 0x00040u 710#define WT_CURSTD_DUMP_PRINT 0x00080u 711#define WT_CURSTD_JOINED 0x00100u 712#define WT_CURSTD_KEY_EXT 0x00200u /* Key points out of tree. */ 713#define WT_CURSTD_KEY_INT 0x00400u /* Key points into tree. */ 714#define WT_CURSTD_META_INUSE 0x00800u 715#define WT_CURSTD_OPEN 0x01000u 716#define WT_CURSTD_OVERWRITE 0x02000u 717#define WT_CURSTD_RAW 0x04000u 718#define WT_CURSTD_RAW_SEARCH 0x08000u 719#define WT_CURSTD_UPDATE_LOCAL 0x10000u 720#define WT_CURSTD_VALUE_EXT 0x20000u /* Value points out of tree. */ 721#define WT_CURSTD_VALUE_INT 0x40000u /* Value points into tree. */ 722/* AUTOMATIC FLAG VALUE GENERATION STOP */ 723#define WT_CURSTD_KEY_SET (WT_CURSTD_KEY_EXT | WT_CURSTD_KEY_INT) 724#define WT_CURSTD_VALUE_SET (WT_CURSTD_VALUE_EXT | WT_CURSTD_VALUE_INT) 725 uint32_t flags; 726#endif 727}; 728 729/*! Asynchronous operation types. */ 730typedef enum { 731 WT_AOP_NONE=0, /*!< No operation type set */ 732 WT_AOP_COMPACT, /*!< WT_ASYNC_OP::compact */ 733 WT_AOP_INSERT, /*!< WT_ASYNC_OP::insert */ 734 WT_AOP_REMOVE, /*!< WT_ASYNC_OP::remove */ 735 WT_AOP_SEARCH, /*!< WT_ASYNC_OP::search */ 736 WT_AOP_UPDATE /*!< WT_ASYNC_OP::update */ 737} WT_ASYNC_OPTYPE; 738 739/*! 740 * A WT_ASYNC_OP handle is the interface to an asynchronous operation. 741 * 742 * An asynchronous operation describes a data manipulation to be performed 743 * asynchronously by a WiredTiger worker thread. These operations implement 744 * the CRUD (create, read, update and delete) operations. Each operation 745 * is a self-contained work unit. The operation will be performed in the 746 * context of the worker thread's session. Each operation is performed 747 * within the context of a transaction. The application is notified of its 748 * completion with a callback. The transaction is resolved once the callback 749 * returns. 750 * 751 * The table referenced in an operation must already exist. 752 * 753 * Raw data is represented by key/value pairs of WT_ITEM structures, but 754 * operations can also provide access to fields within the key and value if 755 * the formats are described in the WT_SESSION::create method. 756 * 757 * <b>Thread safety:</b> A WT_ASYNC_OP handle may not be shared between 758 * threads, see @ref threads for more information. 759 */ 760struct __wt_async_op { 761 /*! The connection for this operation. */ 762 WT_CONNECTION *connection; 763 764 /*! 765 * The format of the data packed into key items. See @ref packing for 766 * details. If not set, a default value of "u" is assumed, and 767 * applications must use WT_ITEM structures to manipulate untyped byte 768 * arrays. 769 */ 770 const char *key_format; 771 772 /*! 773 * The format of the data packed into value items. See @ref packing 774 * for details. If not set, a default value of "u" is assumed, and 775 * applications must use WT_ITEM structures to manipulate untyped byte 776 * arrays. 777 */ 778 const char *value_format; 779 780 /* 781 * Don't expose app_private to non-C language bindings - they have 782 * their own way to attach data to an operation. 783 */ 784#if !defined(SWIG) 785 /*! 786 * A location for applications to store information that will be 787 * available in the callback from an async operation. 788 */ 789 void *app_private; 790#endif 791 792 /*! 793 * @name Data access 794 * @{ 795 */ 796 /*! 797 * Invoke the underlying WT_CURSOR::get_key method; see that method 798 * for configuration, return and error values. 799 * 800 * @param op the operation handle 801 * @returns as described for WT_CURSOR::get_key 802 */ 803 int __F(get_key)(WT_ASYNC_OP *op, ...); 804 805 /*! 806 * Invoke the underlying WT_CURSOR::get_value method; see that method 807 * for configuration, return and error values. 808 * 809 * @param op the operation handle 810 * @returns as described for WT_CURSOR::get_value 811 */ 812 int __F(get_value)(WT_ASYNC_OP *op, ...); 813 814 /*! 815 * Invoke the underlying WT_CURSOR::set_key method; see that method 816 * for configuration, return and error values. 817 * 818 * @param op the operation handle 819 */ 820 void __F(set_key)(WT_ASYNC_OP *op, ...); 821 822 /*! 823 * Invoke the underlying WT_CURSOR::set_value method; see that method 824 * for configuration, return and error values. 825 * 826 * @param op the operation handle 827 */ 828 void __F(set_value)(WT_ASYNC_OP *op, ...); 829 /*! @} */ 830 831 /*! 832 * @name Positioning 833 * @{ 834 */ 835 /*! 836 * Invoke the underlying WT_CURSOR::search method; see that method 837 * for configuration, return and error values. 838 * 839 * @param op the operation handle 840 * @returns via the callback as described for WT_CURSOR::search 841 */ 842 int __F(search)(WT_ASYNC_OP *op); 843 /*! @} */ 844 845 /*! 846 * @name Data modification 847 * @{ 848 */ 849 /*! 850 * Invoke the underlying WT_CURSOR::insert method; see that method 851 * for configuration, return and error values. 852 * 853 * @param op the operation handle 854 * @returns via the callback as described for WT_CURSOR::insert 855 */ 856 int __F(insert)(WT_ASYNC_OP *op); 857 858 /*! 859 * Invoke the underlying WT_CURSOR::update method; see that method 860 * for configuration, return and error values. 861 * 862 * @param op the operation handle 863 * @returns via the callback as described for WT_CURSOR::update 864 */ 865 int __F(update)(WT_ASYNC_OP *op); 866 867 /*! 868 * Invoke the underlying WT_CURSOR::remove method; see that method 869 * for configuration, return and error values. 870 * 871 * @param op the operation handle 872 * @returns via the callback as described for WT_CURSOR::remove 873 */ 874 int __F(remove)(WT_ASYNC_OP *op); 875 /*! @} */ 876 877 /*! 878 * @name Table operations 879 * @{ 880 */ 881 /*! 882 * Invoke the underlying WT_SESSION::compact method; see that method 883 * for configuration, return and error values. 884 * 885 * @param op the operation handle 886 * @returns via the callback as described for WT_SESSION::compact 887 */ 888 int __F(compact)(WT_ASYNC_OP *op); 889 /*! @} */ 890 891 /*! 892 * Get the unique identifier for this operation. 893 * 894 * @snippet ex_async.c async get identifier 895 * 896 * @param op the operation handle 897 * @returns the id of the operation 898 */ 899 uint64_t __F(get_id)(WT_ASYNC_OP *op); 900 901 /*! 902 * Get the type for this operation. 903 * 904 * @snippet ex_async.c async get type 905 * 906 * @param op the operation handle 907 * @returns the ::WT_ASYNC_OPTYPE of the operation 908 */ 909 WT_ASYNC_OPTYPE __F(get_type)(WT_ASYNC_OP *op); 910 911 /* 912 * Protected fields, only to be used by internal implementation. 913 * Everything we need for maintaining the key/value is part of 914 * a cursor. So, include one here so that we can use the cursor 915 * functions to manage them. 916 */ 917#if !defined(SWIG) && !defined(DOXYGEN) 918 WT_CURSOR c; 919#endif 920}; 921 922/*! 923 * All data operations are performed in the context of a WT_SESSION. This 924 * encapsulates the thread and transactional context of the operation. 925 * 926 * <b>Thread safety:</b> A WT_SESSION handle is not usually shared between 927 * threads, see @ref threads for more information. 928 */ 929struct __wt_session { 930 /*! The connection for this session. */ 931 WT_CONNECTION *connection; 932 933 /* 934 * Don't expose app_private to non-C language bindings - they have 935 * their own way to attach data to an operation. 936 */ 937#if !defined(SWIG) 938 /*! 939 * A location for applications to store information that will be 940 * available in callbacks taking a WT_SESSION handle. 941 */ 942 void *app_private; 943#endif 944 945 /*! 946 * Close the session handle. 947 * 948 * This will release the resources associated with the session handle, 949 * including rolling back any active transactions and closing any 950 * cursors that remain open in the session. 951 * 952 * @snippet ex_all.c Close a session 953 * 954 * @param session the session handle 955 * @configempty{WT_SESSION.close, see dist/api_data.py} 956 * @errors 957 */ 958 int __F(close)(WT_HANDLE_CLOSED(WT_SESSION) *session, 959 const char *config); 960 961 /*! 962 * Reconfigure a session handle. 963 * 964 * @snippet ex_all.c Reconfigure a session 965 * 966 * WT_SESSION::reconfigure will fail if a transaction is in progress 967 * in the session. 968 * 969 * All cursors are reset. 970 * 971 * @param session the session handle 972 * @configstart{WT_SESSION.reconfigure, see dist/api_data.py} 973 * @config{cache_cursors, enable caching of cursors for reuse. Any 974 * calls to WT_CURSOR::close for a cursor created in this session will 975 * mark the cursor as cached and keep it available to be reused for 976 * later calls to WT_SESSION::open_cursor. Cached cursors may be 977 * eventually closed. This value is inherited from ::wiredtiger_open \c 978 * cache_cursors., a boolean flag; default \c true.} 979 * @config{ignore_cache_size, when set\, operations performed by this 980 * session ignore the cache size and are not blocked when the cache is 981 * full. Note that use of this option for operations that create cache 982 * pressure can starve ordinary sessions that obey the cache size., a 983 * boolean flag; default \c false.} 984 * @config{isolation, the default isolation level for operations in this 985 * session., a string\, chosen from the following options: \c 986 * "read-uncommitted"\, \c "read-committed"\, \c "snapshot"; default \c 987 * read-committed.} 988 * @configend 989 * @errors 990 */ 991 int __F(reconfigure)(WT_SESSION *session, const char *config); 992 993 /*! 994 * Return information about an error as a string. 995 * 996 * @snippet ex_all.c Display an error thread safe 997 * 998 * @param session the session handle 999 * @param error a return value from a WiredTiger, ISO C, or POSIX 1000 * standard API 1001 * @returns a string representation of the error 1002 */ 1003 const char *__F(strerror)(WT_SESSION *session, int error); 1004 1005 /*! 1006 * @name Cursor handles 1007 * @{ 1008 */ 1009 1010 /*! 1011 * Open a new cursor on a data source or duplicate an existing cursor. 1012 * 1013 * @snippet ex_all.c Open a cursor 1014 * 1015 * An existing cursor can be duplicated by passing it as the \c to_dup 1016 * parameter and setting the \c uri parameter to \c NULL: 1017 * 1018 * @snippet ex_all.c Duplicate a cursor 1019 * 1020 * Cursors being duplicated must have a key set, and successfully 1021 * duplicated cursors are positioned at the same place in the data 1022 * source as the original. 1023 * 1024 * Cursor handles should be discarded by calling WT_CURSOR::close. 1025 * 1026 * Cursors capable of supporting transactional operations operate in the 1027 * context of the current transaction, if any. 1028 * 1029 * WT_SESSION::rollback_transaction implicitly resets all cursors. 1030 * 1031 * Cursors are relatively light-weight objects but may hold references 1032 * to heavier-weight objects; applications should re-use cursors when 1033 * possible, but instantiating new cursors is not so expensive that 1034 * applications need to cache cursors at all cost. 1035 * 1036 * @param session the session handle 1037 * @param uri the data source on which the cursor operates; cursors 1038 * are usually opened on tables, however, cursors can be opened on 1039 * any data source, regardless of whether it is ultimately stored 1040 * in a table. Some cursor types may have limited functionality 1041 * (for example, they may be read-only or not support transactional 1042 * updates). See @ref data_sources for more information. 1043 * <br> 1044 * @copydoc doc_cursor_types 1045 * @param to_dup a cursor to duplicate or gather statistics on 1046 * @configstart{WT_SESSION.open_cursor, see dist/api_data.py} 1047 * @config{append, append the value as a new record\, creating a new 1048 * record number key; valid only for cursors with record number keys., a 1049 * boolean flag; default \c false.} 1050 * @config{bulk, configure the cursor for bulk-loading\, a fast\, 1051 * initial load path (see @ref tune_bulk_load for more information). 1052 * Bulk-load may only be used for newly created objects and applications 1053 * should use the WT_CURSOR::insert method to insert rows. When 1054 * bulk-loading\, rows must be loaded in sorted order. The value is 1055 * usually a true/false flag; when bulk-loading fixed-length column 1056 * store objects\, the special value \c bitmap allows chunks of a memory 1057 * resident bitmap to be loaded directly into a file by passing a \c 1058 * WT_ITEM to WT_CURSOR::set_value where the \c size field indicates the 1059 * number of records in the bitmap (as specified by the object's \c 1060 * value_format configuration). Bulk-loaded bitmap values must end on a 1061 * byte boundary relative to the bit count (except for the last set of 1062 * values loaded)., a string; default \c false.} 1063 * @config{checkpoint, the name of a checkpoint to open (the reserved 1064 * name "WiredTigerCheckpoint" opens the most recent internal checkpoint 1065 * taken for the object). The cursor does not support data 1066 * modification., a string; default empty.} 1067 * @config{dump, configure the cursor for dump format inputs and 1068 * outputs: "hex" selects a simple hexadecimal format\, "json" selects a 1069 * JSON format with each record formatted as fields named by column 1070 * names if available\, and "print" selects a format where only 1071 * non-printing characters are hexadecimal encoded. These formats are 1072 * compatible with the @ref util_dump and @ref util_load commands., a 1073 * string\, chosen from the following options: \c "hex"\, \c "json"\, \c 1074 * "print"; default empty.} 1075 * @config{next_random, configure the cursor to return a pseudo-random 1076 * record from the object when the WT_CURSOR::next method is called; 1077 * valid only for row-store cursors. See @ref cursor_random for 1078 * details., a boolean flag; default \c false.} 1079 * @config{next_random_sample_size, cursors configured by \c next_random 1080 * to return pseudo-random records from the object randomly select from 1081 * the entire object\, by default. Setting \c next_random_sample_size 1082 * to a non-zero value sets the number of samples the application 1083 * expects to take using the \c next_random cursor. A cursor configured 1084 * with both \c next_random and \c next_random_sample_size attempts to 1085 * divide the object into \c next_random_sample_size equal-sized 1086 * pieces\, and each retrieval returns a record from one of those 1087 * pieces. See @ref cursor_random for details., a string; default \c 1088 * 0.} 1089 * @config{overwrite, configures whether the cursor's insert\, update 1090 * and remove methods check the existing state of the record. If \c 1091 * overwrite is \c false\, WT_CURSOR::insert fails with 1092 * ::WT_DUPLICATE_KEY if the record exists\, WT_CURSOR::update and 1093 * WT_CURSOR::remove fail with ::WT_NOTFOUND if the record does not 1094 * exist., a boolean flag; default \c true.} 1095 * @config{raw, ignore the encodings for the key and value\, manage data 1096 * as if the formats were \c "u". See @ref cursor_raw for details., a 1097 * boolean flag; default \c false.} 1098 * @config{read_once, results that are brought into cache from disk by 1099 * this cursor will be given less priority in the cache., a boolean 1100 * flag; default \c false.} 1101 * @config{readonly, only query operations are supported by this cursor. 1102 * An error is returned if a modification is attempted using the cursor. 1103 * The default is false for all cursor types except for log and metadata 1104 * cursors., a boolean flag; default \c false.} 1105 * @config{statistics, Specify the statistics to be gathered. Choosing 1106 * "all" gathers statistics regardless of cost and may include 1107 * traversing on-disk files; "fast" gathers a subset of relatively 1108 * inexpensive statistics. The selection must agree with the database 1109 * \c statistics configuration specified to ::wiredtiger_open or 1110 * WT_CONNECTION::reconfigure. For example\, "all" or "fast" can be 1111 * configured when the database is configured with "all"\, but the 1112 * cursor open will fail if "all" is specified when the database is 1113 * configured with "fast"\, and the cursor open will fail in all cases 1114 * when the database is configured with "none". If "size" is 1115 * configured\, only the underlying size of the object on disk is filled 1116 * in and the object is not opened. If \c statistics is not 1117 * configured\, the default configuration is the database configuration. 1118 * The "clear" configuration resets statistics after gathering them\, 1119 * where appropriate (for example\, a cache size statistic is not 1120 * cleared\, while the count of cursor insert operations will be 1121 * cleared). See @ref statistics for more information., a list\, with 1122 * values chosen from the following options: \c "all"\, \c 1123 * "cache_walk"\, \c "fast"\, \c "clear"\, \c "size"\, \c "tree_walk"; 1124 * default empty.} 1125 * @config{target, if non-empty\, backup the list of objects; valid only 1126 * for a backup data source., a list of strings; default empty.} 1127 * @configend 1128 * @param[out] cursorp a pointer to the newly opened cursor 1129 * @errors 1130 */ 1131 int __F(open_cursor)(WT_SESSION *session, 1132 const char *uri, WT_HANDLE_NULLABLE(WT_CURSOR) *to_dup, 1133 const char *config, WT_CURSOR **cursorp); 1134 /*! @} */ 1135 1136 /*! 1137 * @name Table operations 1138 * @{ 1139 */ 1140 /*! 1141 * Alter a table. 1142 * 1143 * This will allow modification of some table settings after 1144 * creation. 1145 * 1146 * @exclusive 1147 * 1148 * @snippet ex_all.c Alter a table 1149 * 1150 * @param session the session handle 1151 * @param name the URI of the object to alter, such as \c "table:stock" 1152 * @configstart{WT_SESSION.alter, see dist/api_data.py} 1153 * @config{access_pattern_hint, It is recommended that workloads that 1154 * consist primarily of updates and/or point queries specify \c random. 1155 * Workloads that do many cursor scans through large ranges of data 1156 * specify \c sequential and other workloads specify \c none. The 1157 * option leads to an advisory call to an appropriate operating system 1158 * API where available., a string\, chosen from the following options: 1159 * \c "none"\, \c "random"\, \c "sequential"; default \c none.} 1160 * @config{app_metadata, application-owned metadata for this object., a 1161 * string; default empty.} 1162 * @config{cache_resident, do not ever evict the object's pages from 1163 * cache. Not compatible with LSM tables; see @ref 1164 * tuning_cache_resident for more information., a boolean flag; default 1165 * \c false.} 1166 * @config{log = (, the transaction log configuration for this object. 1167 * Only valid if log is enabled in ::wiredtiger_open., a set of related 1168 * configuration options defined below.} 1169 * @config{ enabled, if false\, this object has 1170 * checkpoint-level durability., a boolean flag; default \c true.} 1171 * @config{ ),,} 1172 * @configend 1173 * @errors 1174 */ 1175 int __F(alter)(WT_SESSION *session, 1176 const char *name, const char *config); 1177 1178 /*! 1179 * Create a table, column group, index or file. 1180 * 1181 * @snippet ex_all.c Create a table 1182 * 1183 * @param session the session handle 1184 * @param name the URI of the object to create, such as 1185 * \c "table:stock". For a description of URI formats 1186 * see @ref data_sources. 1187 * @configstart{WT_SESSION.create, see dist/api_data.py} 1188 * @config{access_pattern_hint, It is recommended that workloads that 1189 * consist primarily of updates and/or point queries specify \c random. 1190 * Workloads that do many cursor scans through large ranges of data 1191 * specify \c sequential and other workloads specify \c none. The 1192 * option leads to an advisory call to an appropriate operating system 1193 * API where available., a string\, chosen from the following options: 1194 * \c "none"\, \c "random"\, \c "sequential"; default \c none.} 1195 * @config{allocation_size, the file unit allocation size\, in bytes\, 1196 * must a power-of-two; smaller values decrease the file space required 1197 * by overflow items\, and the default value of 4KB is a good choice 1198 * absent requirements from the operating system or storage device., an 1199 * integer between 512B and 128MB; default \c 4KB.} 1200 * @config{app_metadata, application-owned metadata for this object., a 1201 * string; default empty.} 1202 * @config{block_allocation, configure block allocation. Permitted 1203 * values are \c "first" or \c "best"; the \c "first" configuration uses 1204 * a first-available algorithm during block allocation\, the \c "best" 1205 * configuration uses a best-fit algorithm., a string\, chosen from the 1206 * following options: \c "first"\, \c "best"; default \c best.} 1207 * @config{block_compressor, configure a compressor for file blocks. 1208 * Permitted values are \c "none" or custom compression engine name 1209 * created with WT_CONNECTION::add_compressor. If WiredTiger has 1210 * builtin support for \c "lz4"\, \c "snappy"\, \c "zlib" or \c "zstd" 1211 * compression\, these names are also available. See @ref compression 1212 * for more information., a string; default \c none.} 1213 * @config{cache_resident, do not ever evict the object's pages from 1214 * cache. Not compatible with LSM tables; see @ref 1215 * tuning_cache_resident for more information., a boolean flag; default 1216 * \c false.} 1217 * @config{checksum, configure block checksums; permitted values are 1218 * <code>on</code> (checksum all blocks)\, <code>off</code> (checksum no 1219 * blocks) and <code>uncompresssed</code> (checksum only blocks which 1220 * are not compressed for any reason). The \c uncompressed setting is 1221 * for applications which can rely on decompression to fail if a block 1222 * has been corrupted., a string\, chosen from the following options: \c 1223 * "on"\, \c "off"\, \c "uncompressed"; default \c uncompressed.} 1224 * @config{colgroups, comma-separated list of names of column groups. 1225 * Each column group is stored separately\, keyed by the primary key of 1226 * the table. If no column groups are specified\, all columns are 1227 * stored together in a single file. All value columns in the table 1228 * must appear in at least one column group. Each column group must be 1229 * created with a separate call to WT_SESSION::create., a list of 1230 * strings; default empty.} 1231 * @config{collator, configure custom collation for keys. Permitted 1232 * values are \c "none" or a custom collator name created with 1233 * WT_CONNECTION::add_collator., a string; default \c none.} 1234 * @config{columns, list of the column names. Comma-separated list of 1235 * the form <code>(column[\,...])</code>. For tables\, the number of 1236 * entries must match the total number of values in \c key_format and \c 1237 * value_format. For colgroups and indices\, all column names must 1238 * appear in the list of columns for the table., a list of strings; 1239 * default empty.} 1240 * @config{dictionary, the maximum number of unique values remembered in 1241 * the Btree row-store leaf page value dictionary; see @ref 1242 * file_formats_compression for more information., an integer greater 1243 * than or equal to 0; default \c 0.} 1244 * @config{encryption = (, configure an encryptor for file blocks. When 1245 * a table is created\, its encryptor is not implicitly used for any 1246 * related indices or column groups., a set of related configuration 1247 * options defined below.} 1248 * @config{ keyid, An 1249 * identifier that identifies a unique instance of the encryptor. It is 1250 * stored in clear text\, and thus is available when the wiredtiger 1251 * database is reopened. On the first use of a (name\, keyid) 1252 * combination\, the WT_ENCRYPTOR::customize function is called with the 1253 * keyid as an argument., a string; default empty.} 1254 * @config{ name, Permitted values are \c "none" 1255 * or custom encryption engine name created with 1256 * WT_CONNECTION::add_encryptor. See @ref encryption for more 1257 * information., a string; default \c none.} 1258 * @config{ ),,} 1259 * @config{exclusive, fail if the object exists. When false (the 1260 * default)\, if the object exists\, check that its settings match the 1261 * specified configuration., a boolean flag; default \c false.} 1262 * @config{extractor, configure custom extractor for indices. Permitted 1263 * values are \c "none" or an extractor name created with 1264 * WT_CONNECTION::add_extractor., a string; default \c none.} 1265 * @config{format, the file format., a string\, chosen from the 1266 * following options: \c "btree"; default \c btree.} 1267 * @config{huffman_key, configure Huffman encoding for keys. Permitted 1268 * values are \c "none"\, \c "english"\, \c "utf8<file>" or \c 1269 * "utf16<file>". See @ref huffman for more information., a string; 1270 * default \c none.} 1271 * @config{huffman_value, configure Huffman encoding for values. 1272 * Permitted values are \c "none"\, \c "english"\, \c "utf8<file>" or \c 1273 * "utf16<file>". See @ref huffman for more information., a string; 1274 * default \c none.} 1275 * @config{ignore_in_memory_cache_size, allow update and insert 1276 * operations to proceed even if the cache is already at capacity. Only 1277 * valid in conjunction with in-memory databases. Should be used with 1278 * caution - this configuration allows WiredTiger to consume memory over 1279 * the configured cache limit., a boolean flag; default \c false.} 1280 * @config{immutable, configure the index to be immutable - that is an 1281 * index is not changed by any update to a record in the table., a 1282 * boolean flag; default \c false.} 1283 * @config{internal_key_max, the largest key stored in an internal 1284 * node\, in bytes. If set\, keys larger than the specified size are 1285 * stored as overflow items (which may require additional I/O to 1286 * access). The default and the maximum allowed value are both one-tenth 1287 * the size of a newly split internal page., an integer greater than or 1288 * equal to 0; default \c 0.} 1289 * @config{internal_key_truncate, configure internal key truncation\, 1290 * discarding unnecessary trailing bytes on internal keys (ignored for 1291 * custom collators)., a boolean flag; default \c true.} 1292 * @config{internal_page_max, the maximum page size for internal nodes\, 1293 * in bytes; the size must be a multiple of the allocation size and is 1294 * significant for applications wanting to avoid excessive L2 cache 1295 * misses while searching the tree. The page maximum is the bytes of 1296 * uncompressed data\, that is\, the limit is applied before any block 1297 * compression is done., an integer between 512B and 512MB; default \c 1298 * 4KB.} 1299 * @config{key_format, the format of the data packed into key items. 1300 * See @ref schema_format_types for details. By default\, the 1301 * key_format is \c 'u' and applications use WT_ITEM structures to 1302 * manipulate raw byte arrays. By default\, records are stored in 1303 * row-store files: keys of type \c 'r' are record numbers and records 1304 * referenced by record number are stored in column-store files., a 1305 * format string; default \c u.} 1306 * @config{leaf_key_max, the largest key stored in a leaf node\, in 1307 * bytes. If set\, keys larger than the specified size are stored as 1308 * overflow items (which may require additional I/O to access). The 1309 * default value is one-tenth the size of a newly split leaf page., an 1310 * integer greater than or equal to 0; default \c 0.} 1311 * @config{leaf_page_max, the maximum page size for leaf nodes\, in 1312 * bytes; the size must be a multiple of the allocation size\, and is 1313 * significant for applications wanting to maximize sequential data 1314 * transfer from a storage device. The page maximum is the bytes of 1315 * uncompressed data\, that is\, the limit is applied before any block 1316 * compression is done., an integer between 512B and 512MB; default \c 1317 * 32KB.} 1318 * @config{leaf_value_max, the largest value stored in a leaf node\, in 1319 * bytes. If set\, values larger than the specified size are stored as 1320 * overflow items (which may require additional I/O to access). If the 1321 * size is larger than the maximum leaf page size\, the page size is 1322 * temporarily ignored when large values are written. The default is 1323 * one-half the size of a newly split leaf page., an integer greater 1324 * than or equal to 0; default \c 0.} 1325 * @config{log = (, the transaction log configuration for this object. 1326 * Only valid if log is enabled in ::wiredtiger_open., a set of related 1327 * configuration options defined below.} 1328 * @config{ enabled, if false\, this object has 1329 * checkpoint-level durability., a boolean flag; default \c true.} 1330 * @config{ ),,} 1331 * @config{lsm = (, options only relevant for LSM data sources., a set 1332 * of related configuration options defined below.} 1333 * @config{ auto_throttle, Throttle inserts into 1334 * LSM trees if flushing to disk isn't keeping up., a boolean flag; 1335 * default \c true.} 1336 * @config{ bloom, create bloom 1337 * filters on LSM tree chunks as they are merged., a boolean flag; 1338 * default \c true.} 1339 * @config{ bloom_bit_count, 1340 * the number of bits used per item for LSM bloom filters., an integer 1341 * between 2 and 1000; default \c 16.} 1342 * @config{ bloom_config, config string used when 1343 * creating Bloom filter files\, passed to WT_SESSION::create., a 1344 * string; default empty.} 1345 * @config{ bloom_hash_count, the number of hash 1346 * values per item used for LSM bloom filters., an integer between 2 and 1347 * 100; default \c 8.} 1348 * @config{ bloom_oldest, 1349 * create a bloom filter on the oldest LSM tree chunk. Only supported 1350 * if bloom filters are enabled., a boolean flag; default \c false.} 1351 * @config{ chunk_count_limit, the maximum number 1352 * of chunks to allow in an LSM tree. This option automatically times 1353 * out old data. As new chunks are added old chunks will be removed. 1354 * Enabling this option disables LSM background merges., an integer; 1355 * default \c 0.} 1356 * @config{ chunk_max, the maximum 1357 * size a single chunk can be. Chunks larger than this size are not 1358 * considered for further merges. This is a soft limit\, and chunks 1359 * larger than this value can be created. Must be larger than 1360 * chunk_size., an integer between 100MB and 10TB; default \c 5GB.} 1361 * @config{ chunk_size, the maximum size of the 1362 * in-memory chunk of an LSM tree. This limit is soft - it is possible 1363 * for chunks to be temporarily larger than this value. This overrides 1364 * the \c memory_page_max setting., an integer between 512K and 500MB; 1365 * default \c 10MB.} 1366 * @config{ merge_custom = (, 1367 * configure the tree to merge into a custom data source., a set of 1368 * related configuration options defined below.} 1369 * @config{ prefix, 1370 * custom data source prefix instead of \c "file"., a string; default 1371 * empty.} 1372 * @config{ start 1373 * _generation, merge generation at which the custom data source is used 1374 * (zero indicates no custom data source)., an integer between 0 and 10; 1375 * default \c 0.} 1376 * @config{ suffix, 1377 * custom data source suffix instead of \c ".lsm"., a string; default 1378 * empty.} 1379 * @config{ ),,} 1380 * @config{ merge_max, the 1381 * maximum number of chunks to include in a merge operation., an integer 1382 * between 2 and 100; default \c 15.} 1383 * @config{ merge_min, the minimum number of 1384 * chunks to include in a merge operation. If set to 0 or 1 half the 1385 * value of merge_max is used., an integer no more than 100; default \c 1386 * 0.} 1387 * @config{ ),,} 1388 * @config{memory_page_image_max, the maximum in-memory page image 1389 * represented by a single storage block. Depending on compression 1390 * efficiency\, compression can create storage blocks which require 1391 * significant resources to re-instantiate in the cache\, penalizing the 1392 * performance of future point updates. The value limits the maximum 1393 * in-memory page image a storage block will need. If set to 0\, a 1394 * default of 4 times \c leaf_page_max is used., an integer greater than 1395 * or equal to 0; default \c 0.} 1396 * @config{memory_page_max, the maximum size a page can grow to in 1397 * memory before being reconciled to disk. The specified size will be 1398 * adjusted to a lower bound of <code>leaf_page_max</code>\, and an 1399 * upper bound of <code>cache_size / 10</code>. This limit is soft - it 1400 * is possible for pages to be temporarily larger than this value. This 1401 * setting is ignored for LSM trees\, see \c chunk_size., an integer 1402 * between 512B and 10TB; default \c 5MB.} 1403 * @config{os_cache_dirty_max, maximum dirty system buffer cache usage\, 1404 * in bytes. If non-zero\, schedule writes for dirty blocks belonging 1405 * to this object in the system buffer cache after that many bytes from 1406 * this object are written into the buffer cache., an integer greater 1407 * than or equal to 0; default \c 0.} 1408 * @config{os_cache_max, maximum system buffer cache usage\, in bytes. 1409 * If non-zero\, evict object blocks from the system buffer cache after 1410 * that many bytes from this object are read or written into the buffer 1411 * cache., an integer greater than or equal to 0; default \c 0.} 1412 * @config{prefix_compression, configure prefix compression on row-store 1413 * leaf pages., a boolean flag; default \c false.} 1414 * @config{prefix_compression_min, minimum gain before prefix 1415 * compression will be used on row-store leaf pages., an integer greater 1416 * than or equal to 0; default \c 4.} 1417 * @config{split_pct, the Btree page split size as a percentage of the 1418 * maximum Btree page size\, that is\, when a Btree page is split\, it 1419 * will be split into smaller pages\, where each page is the specified 1420 * percentage of the maximum Btree page size., an integer between 50 and 1421 * 100; default \c 90.} 1422 * @config{type, set the type of data source used to store a column 1423 * group\, index or simple table. By default\, a \c "file:" URI is 1424 * derived from the object name. The \c type configuration can be used 1425 * to switch to a different data source\, such as LSM or an extension 1426 * configured by the application., a string; default \c file.} 1427 * @config{value_format, the format of the data packed into value items. 1428 * See @ref schema_format_types for details. By default\, the 1429 * value_format is \c 'u' and applications use a WT_ITEM structure to 1430 * manipulate raw byte arrays. Value items of type 't' are bitfields\, 1431 * and when configured with record number type keys\, will be stored 1432 * using a fixed-length store., a format string; default \c u.} 1433 * @configend 1434 * @errors 1435 */ 1436 int __F(create)(WT_SESSION *session, 1437 const char *name, const char *config); 1438 1439 /*! 1440 * Compact a live row- or column-store btree or LSM tree. 1441 * 1442 * @snippet ex_all.c Compact a table 1443 * 1444 * @param session the session handle 1445 * @param name the URI of the object to compact, such as 1446 * \c "table:stock" 1447 * @configstart{WT_SESSION.compact, see dist/api_data.py} 1448 * @config{timeout, maximum amount of time to allow for compact in 1449 * seconds. The actual amount of time spent in compact may exceed the 1450 * configured value. A value of zero disables the timeout., an integer; 1451 * default \c 1200.} 1452 * @configend 1453 * @errors 1454 */ 1455 int __F(compact)(WT_SESSION *session, 1456 const char *name, const char *config); 1457 1458 /*! 1459 * Drop (delete) an object. 1460 * 1461 * @exclusive 1462 * 1463 * @snippet ex_all.c Drop a table 1464 * 1465 * @param session the session handle 1466 * @param name the URI of the object to drop, such as \c "table:stock" 1467 * @configstart{WT_SESSION.drop, see dist/api_data.py} 1468 * @config{force, return success if the object does not exist., a 1469 * boolean flag; default \c false.} 1470 * @config{remove_files, if the underlying files should be removed., a 1471 * boolean flag; default \c true.} 1472 * @configend 1473 * @ebusy_errors 1474 */ 1475 int __F(drop)(WT_SESSION *session, 1476 const char *name, const char *config); 1477 1478 /*! 1479 * Join a join cursor with a reference cursor. 1480 * 1481 * @snippet ex_schema.c Join cursors 1482 * 1483 * @param session the session handle 1484 * @param join_cursor a cursor that was opened using a 1485 * \c "join:" URI. It may not have been used for any operations 1486 * other than other join calls. 1487 * @param ref_cursor an index cursor having the same base table 1488 * as the join_cursor, or a table cursor open on the same base table, 1489 * or another join cursor. Unless the ref_cursor is another join 1490 * cursor, it must be positioned. 1491 * 1492 * The ref_cursor limits the results seen by iterating the 1493 * join_cursor to table items referred to by the key in this 1494 * index. The set of keys referred to is modified by the compare 1495 * config option. 1496 * 1497 * Multiple join calls builds up a set of ref_cursors, and 1498 * by default, the results seen by iteration are the intersection 1499 * of the cursor ranges participating in the join. When configured 1500 * with \c "operation=or", the results seen are the union of 1501 * the participating cursor ranges. 1502 * 1503 * After the join call completes, the ref_cursor cursor may not be 1504 * used for any purpose other than get_key and get_value. Any other 1505 * cursor method (e.g. next, prev,close) will fail. When the 1506 * join_cursor is closed, the ref_cursor is made available for 1507 * general use again. The application should close ref_cursor when 1508 * finished with it, although not before the join_cursor is closed. 1509 * 1510 * @configstart{WT_SESSION.join, see dist/api_data.py} 1511 * @config{bloom_bit_count, the number of bits used per item for the 1512 * bloom filter., an integer between 2 and 1000; default \c 16.} 1513 * @config{bloom_false_positives, return all values that pass the bloom 1514 * filter\, without eliminating any false positives., a boolean flag; 1515 * default \c false.} 1516 * @config{bloom_hash_count, the number of hash values per item for the 1517 * bloom filter., an integer between 2 and 100; default \c 8.} 1518 * @config{compare, modifies the set of items to be returned so that the 1519 * index key satisfies the given comparison relative to the key set in 1520 * this cursor., a string\, chosen from the following options: \c "eq"\, 1521 * \c "ge"\, \c "gt"\, \c "le"\, \c "lt"; default \c "eq".} 1522 * @config{count, set an approximate count of the elements that would be 1523 * included in the join. This is used in sizing the bloom filter\, and 1524 * also influences evaluation order for cursors in the join. When the 1525 * count is equal for multiple bloom filters in a composition of joins\, 1526 * the bloom filter may be shared., an integer; default \c .} 1527 * @config{operation, the operation applied between this and other 1528 * joined cursors. When "operation=and" is specified\, all the 1529 * conditions implied by joins must be satisfied for an entry to be 1530 * returned by the join cursor; when "operation=or" is specified\, only 1531 * one must be satisfied. All cursors joined to a join cursor must have 1532 * matching operations., a string\, chosen from the following options: 1533 * \c "and"\, \c "or"; default \c "and".} 1534 * @config{strategy, when set to bloom\, a bloom filter is created and 1535 * populated for this index. This has an up front cost but may reduce 1536 * the number of accesses to the main table when iterating the joined 1537 * cursor. The bloom setting requires that count be set., a string\, 1538 * chosen from the following options: \c "bloom"\, \c "default"; default 1539 * empty.} 1540 * @configend 1541 * @errors 1542 */ 1543 int __F(join)(WT_SESSION *session, WT_CURSOR *join_cursor, 1544 WT_CURSOR *ref_cursor, const char *config); 1545 1546 /*! 1547 * Flush the log. 1548 * 1549 * @param session the session handle 1550 * @configstart{WT_SESSION.log_flush, see dist/api_data.py} 1551 * @config{sync, forcibly flush the log and wait for it to achieve the 1552 * synchronization level specified. The \c background setting initiates 1553 * a background synchronization intended to be used with a later call to 1554 * WT_SESSION::transaction_sync. The \c off setting forces any buffered 1555 * log records to be written to the file system. The \c on setting 1556 * forces log records to be written to the storage device., a string\, 1557 * chosen from the following options: \c "background"\, \c "off"\, \c 1558 * "on"; default \c on.} 1559 * @configend 1560 * @errors 1561 */ 1562 int __F(log_flush)(WT_SESSION *session, const char *config); 1563 1564 /*! 1565 * Insert a ::WT_LOGREC_MESSAGE type record in the database log files 1566 * (the database must be configured for logging when this method is 1567 * called). 1568 * 1569 * @param session the session handle 1570 * @param format a printf format specifier 1571 * @errors 1572 */ 1573 int __F(log_printf)(WT_SESSION *session, const char *format, ...); 1574 1575 /*! 1576 * Rebalance a table or file, see @ref rebalance. 1577 * 1578 * @exclusive 1579 * 1580 * @snippet ex_all.c Rebalance a table 1581 * 1582 * @param session the session handle 1583 * @param uri the current URI of the object, such as \c "table:mytable" 1584 * @configempty{WT_SESSION.rebalance, see dist/api_data.py} 1585 * @ebusy_errors 1586 */ 1587 int __F(rebalance)( 1588 WT_SESSION *session, const char *uri, const char *config); 1589 1590 /*! 1591 * Rename an object. 1592 * 1593 * @snippet ex_all.c Rename a table 1594 * 1595 * @exclusive 1596 * 1597 * @param session the session handle 1598 * @param uri the current URI of the object, such as \c "table:old" 1599 * @param newuri the new URI of the object, such as \c "table:new" 1600 * @configempty{WT_SESSION.rename, see dist/api_data.py} 1601 * @ebusy_errors 1602 */ 1603 int __F(rename)(WT_SESSION *session, 1604 const char *uri, const char *newuri, const char *config); 1605 1606 /*! 1607 * Reset the session handle. 1608 * 1609 * This method resets all cursors associated with this session and 1610 * discards cached resources. The session can be re-used immediately 1611 * after this call returns. If a transaction is running on this 1612 * session, then this call takes no action and return an error. 1613 * 1614 * @snippet ex_all.c Reset the session 1615 * 1616 * @param session the session handle 1617 * @errors 1618 */ 1619 int __F(reset)(WT_SESSION *session); 1620 1621 /*! 1622 * Salvage a table or file. 1623 * 1624 * Salvage rebuilds the file, or files of which a table is comprised, 1625 * discarding any corrupted file blocks. 1626 * 1627 * Previously deleted records may re-appear, and inserted records may 1628 * disappear, when salvage is done, so salvage should not be run 1629 * unless it is known to be necessary. Normally, salvage should be 1630 * called after a table or file has been corrupted, as reported by the 1631 * WT_SESSION::verify method. 1632 * 1633 * Files are rebuilt in place, the salvage method overwrites the 1634 * existing files. 1635 * 1636 * @exclusive 1637 * 1638 * @snippet ex_all.c Salvage a table 1639 * 1640 * @param session the session handle 1641 * @param name the URI of the table or file to salvage 1642 * @configstart{WT_SESSION.salvage, see dist/api_data.py} 1643 * @config{force, force salvage even of files that do not appear to be 1644 * WiredTiger files., a boolean flag; default \c false.} 1645 * @configend 1646 * @ebusy_errors 1647 */ 1648 int __F(salvage)(WT_SESSION *session, 1649 const char *name, const char *config); 1650 1651 /*! 1652 * Truncate a file, table or cursor range. 1653 * 1654 * Truncate a table or file. 1655 * @snippet ex_all.c Truncate a table 1656 * 1657 * Truncate a cursor range. When truncating based on a cursor position, 1658 * it is not required the cursor reference a record in the object, only 1659 * that the key be set. This allows applications to discard portions of 1660 * the object name space without knowing exactly what records the object 1661 * contains. 1662 * @snippet ex_all.c Truncate a range 1663 * 1664 * Any specified cursors end with no position, and subsequent calls to 1665 * the WT_CURSOR::next (WT_CURSOR::prev) method will iterate from the 1666 * beginning (end) of the table. 1667 * 1668 * When a range truncate is in progress, and another transaction inserts 1669 * a key into that range, the behavior is not well defined - a conflict 1670 * may be detected or both transactions may be permitted to commit. If 1671 * they do commit, and if there is a crash and recovery runs, the result 1672 * may be different than what was in cache before the crash. 1673 * 1674 * @param session the session handle 1675 * @param name the URI of the table or file to truncate 1676 * @param start optional cursor marking the first record discarded; 1677 * if <code>NULL</code>, the truncate starts from the beginning of 1678 * the object 1679 * @param stop optional cursor marking the last record discarded; 1680 * if <code>NULL</code>, the truncate continues to the end of the 1681 * object 1682 * @configempty{WT_SESSION.truncate, see dist/api_data.py} 1683 * @errors 1684 */ 1685 int __F(truncate)(WT_SESSION *session, 1686 const char *name, 1687 WT_HANDLE_NULLABLE(WT_CURSOR) *start, 1688 WT_HANDLE_NULLABLE(WT_CURSOR) *stop, 1689 const char *config); 1690 1691 /*! 1692 * Upgrade a table or file. 1693 * 1694 * Upgrade upgrades a table or file, if upgrade is required. 1695 * 1696 * @exclusive 1697 * 1698 * @snippet ex_all.c Upgrade a table 1699 * 1700 * @param session the session handle 1701 * @param name the URI of the table or file to upgrade 1702 * @configempty{WT_SESSION.upgrade, see dist/api_data.py} 1703 * @ebusy_errors 1704 */ 1705 int __F(upgrade)(WT_SESSION *session, 1706 const char *name, const char *config); 1707 1708 /*! 1709 * Verify a table or file. 1710 * 1711 * Verify reports if a file, or the files of which a table is 1712 * comprised, have been corrupted. The WT_SESSION::salvage method 1713 * can be used to repair a corrupted file, 1714 * 1715 * @snippet ex_all.c Verify a table 1716 * 1717 * @exclusive 1718 * 1719 * @param session the session handle 1720 * @param name the URI of the table or file to verify 1721 * @configstart{WT_SESSION.verify, see dist/api_data.py} 1722 * @config{dump_address, Display addresses and page types as pages are 1723 * verified\, using the application's message handler\, intended for 1724 * debugging., a boolean flag; default \c false.} 1725 * @config{dump_blocks, Display the contents of on-disk blocks as they 1726 * are verified\, using the application's message handler\, intended for 1727 * debugging., a boolean flag; default \c false.} 1728 * @config{dump_layout, Display the layout of the files as they are 1729 * verified\, using the application's message handler\, intended for 1730 * debugging; requires optional support from the block manager., a 1731 * boolean flag; default \c false.} 1732 * @config{dump_offsets, Display the contents of specific on-disk 1733 * blocks\, using the application's message handler\, intended for 1734 * debugging., a list of strings; default empty.} 1735 * @config{dump_pages, Display the contents of in-memory pages as they 1736 * are verified\, using the application's message handler\, intended for 1737 * debugging., a boolean flag; default \c false.} 1738 * @config{strict, Treat any verification problem as an error; by 1739 * default\, verify will warn\, but not fail\, in the case of errors 1740 * that won't affect future behavior (for example\, a leaked block)., a 1741 * boolean flag; default \c false.} 1742 * @configend 1743 * @ebusy_errors 1744 */ 1745 int __F(verify)(WT_SESSION *session, 1746 const char *name, const char *config); 1747 /*! @} */ 1748 1749 /*! 1750 * @name Transactions 1751 * @{ 1752 */ 1753 /*! 1754 * Start a transaction in this session. 1755 * 1756 * The transaction remains active until ended by 1757 * WT_SESSION::commit_transaction or WT_SESSION::rollback_transaction. 1758 * Operations performed on cursors capable of supporting transactional 1759 * operations that are already open in this session, or which are opened 1760 * before the transaction ends, will operate in the context of the 1761 * transaction. 1762 * 1763 * @requires_notransaction 1764 * 1765 * @snippet ex_all.c transaction commit/rollback 1766 * 1767 * @param session the session handle 1768 * @configstart{WT_SESSION.begin_transaction, see dist/api_data.py} 1769 * @config{ignore_prepare, whether to ignore the updates by other 1770 * prepared transactions as part of read operations of this 1771 * transaction., a boolean flag; default \c false.} 1772 * @config{isolation, the isolation level for this transaction; defaults 1773 * to the session's isolation level., a string\, chosen from the 1774 * following options: \c "read-uncommitted"\, \c "read-committed"\, \c 1775 * "snapshot"; default empty.} 1776 * @config{name, name of the transaction for tracing and debugging., a 1777 * string; default empty.} 1778 * @config{priority, priority of the transaction for resolving 1779 * conflicts. Transactions with higher values are less likely to 1780 * abort., an integer between -100 and 100; default \c 0.} 1781 * @config{read_timestamp, read using the specified timestamp. The 1782 * supplied value must not be older than the current oldest timestamp. 1783 * See @ref transaction_timestamps., a string; default empty.} 1784 * @config{round_to_oldest, if read timestamp is earlier than oldest 1785 * timestamp\, read timestamp will be rounded to oldest timestamp., a 1786 * boolean flag; default \c false.} 1787 * @config{snapshot, use a named\, in-memory snapshot\, see @ref 1788 * transaction_named_snapshots., a string; default empty.} 1789 * @config{sync, whether to sync log records when the transaction 1790 * commits\, inherited from ::wiredtiger_open \c transaction_sync., a 1791 * boolean flag; default empty.} 1792 * @configend 1793 * @errors 1794 */ 1795 int __F(begin_transaction)(WT_SESSION *session, const char *config); 1796 1797 /*! 1798 * Commit the current transaction. 1799 * 1800 * A transaction must be in progress when this method is called. 1801 * 1802 * If WT_SESSION::commit_transaction returns an error, the transaction 1803 * was rolled back, not committed. 1804 * 1805 * @requires_transaction 1806 * 1807 * @snippet ex_all.c transaction commit/rollback 1808 * 1809 * @param session the session handle 1810 * @configstart{WT_SESSION.commit_transaction, see dist/api_data.py} 1811 * @config{commit_timestamp, set the commit timestamp for the current 1812 * transaction. The supplied value must not be older than the first 1813 * commit timestamp set for the current transaction. The value must 1814 * also not be older than the current oldest and stable timestamps. See 1815 * @ref transaction_timestamps., a string; default empty.} 1816 * @config{sync, override whether to sync log records when the 1817 * transaction commits\, inherited from ::wiredtiger_open \c 1818 * transaction_sync. The \c background setting initiates a background 1819 * synchronization intended to be used with a later call to 1820 * WT_SESSION::transaction_sync. The \c off setting does not wait for 1821 * record to be written or synchronized. The \c on setting forces log 1822 * records to be written to the storage device., a string\, chosen from 1823 * the following options: \c "background"\, \c "off"\, \c "on"; default 1824 * empty.} 1825 * @configend 1826 * @errors 1827 */ 1828 int __F(commit_transaction)(WT_SESSION *session, const char *config); 1829 1830 /*! 1831 * Prepare the current transaction. 1832 * 1833 * A transaction must be in progress when this method is called. 1834 * 1835 * Preparing a transaction will guarantee a subsequent commit will 1836 * succeed. Only commit and rollback are allowed on a transaction after 1837 * it has been prepared. The transaction prepare API is designed to 1838 * support MongoDB exclusively, and guarantees update conflicts have 1839 * been resolved, but does not guarantee durability. 1840 * 1841 * @requires_transaction 1842 * 1843 * @snippet ex_all.c transaction prepare 1844 * 1845 * @param session the session handle 1846 * @configstart{WT_SESSION.prepare_transaction, see dist/api_data.py} 1847 * @config{prepare_timestamp, set the prepare timestamp for the updates 1848 * of the current transaction. The supplied value must not be older 1849 * than any active read timestamps. This configuration option is 1850 * mandatory. See @ref transaction_timestamps., a string; default 1851 * empty.} 1852 * @configend 1853 * @errors 1854 */ 1855 int __F(prepare_transaction)(WT_SESSION *session, const char *config); 1856 1857 /*! 1858 * Roll back the current transaction. 1859 * 1860 * A transaction must be in progress when this method is called. 1861 * 1862 * All cursors are reset. 1863 * 1864 * @requires_transaction 1865 * 1866 * @snippet ex_all.c transaction commit/rollback 1867 * 1868 * @param session the session handle 1869 * @configempty{WT_SESSION.rollback_transaction, see dist/api_data.py} 1870 * @errors 1871 */ 1872 int __F(rollback_transaction)(WT_SESSION *session, const char *config); 1873 1874 /*! 1875 * Set a timestamp on a transaction. 1876 * 1877 * @snippet ex_all.c transaction timestamp 1878 * 1879 * @requires_transaction 1880 * 1881 * @param session the session handle 1882 * @configstart{WT_SESSION.timestamp_transaction, see dist/api_data.py} 1883 * @config{commit_timestamp, set the commit timestamp for the current 1884 * transaction. The supplied value must not be older than the first 1885 * commit timestamp set for the current transaction. The value must 1886 * also not be older than the current oldest and stable timestamps. See 1887 * @ref transaction_timestamps., a string; default empty.} 1888 * @config{read_timestamp, read using the specified timestamp. The 1889 * supplied value must not be older than the current oldest timestamp. 1890 * This can only be set once for a transaction. @ref 1891 * transaction_timestamps., a string; default empty.} 1892 * @config{round_to_oldest, if read timestamp is earlier than oldest 1893 * timestamp\, read timestamp will be rounded to oldest timestamp., a 1894 * boolean flag; default \c false.} 1895 * @configend 1896 * @errors 1897 */ 1898 int __F(timestamp_transaction)(WT_SESSION *session, const char *config); 1899 1900 /*! 1901 * Query the session's transaction timestamp state. 1902 * 1903 * @param session the session handle 1904 * @param[out] hex_timestamp a buffer that will be set to the 1905 * hexadecimal encoding of the timestamp being queried. Must be large 1906 * enough to hold a hex-encoded timestamp (i.e., double the timestamp 1907 * size plus one byte for NUL termination). 1908 * @configstart{WT_SESSION.query_timestamp, see dist/api_data.py} 1909 * @config{get, specify which timestamp to query: \c commit returns the 1910 * most recently set commit_timestamp. \c first_commit returns the 1911 * first set commit_timestamp. \c prepare returns the timestamp used in 1912 * preparing a transaction. \c read returns the timestamp at which the 1913 * transaction is reading at. See @ref transaction_timestamps., a 1914 * string\, chosen from the following options: \c "commit"\, \c 1915 * "first_commit"\, \c "prepare"\, \c "read"; default \c read.} 1916 * @configend 1917 * @errors 1918 * If the session is not in a transaction ::WT_NOTFOUND will be 1919 * returned. 1920 */ 1921 int __F(query_timestamp)( 1922 WT_SESSION *session, char *hex_timestamp, const char *config); 1923 1924 /*! 1925 * Write a transactionally consistent snapshot of a database or set of 1926 * objects. In the absence of transaction timestamps, the checkpoint 1927 * includes all transactions committed before the checkpoint starts. 1928 * 1929 * When timestamps are in use and a \c stable_timestamp has been set 1930 * via WT_CONNECTION::set_timestamp and the checkpoint runs with 1931 * \c use_timestamp=true (the default), updates committed with a 1932 * timestamp larger than the \c stable_timestamp will not be included 1933 * in the checkpoint for tables configured with \c log=(enabled=false). 1934 * For tables with logging enabled, all committed changes will be 1935 * included in the checkpoint (since recovery would roll them forward 1936 * anyway). 1937 * 1938 * Additionally, existing named checkpoints may optionally be 1939 * discarded. 1940 * 1941 * @requires_notransaction 1942 * 1943 * @snippet ex_all.c Checkpoint examples 1944 * 1945 * @param session the session handle 1946 * @configstart{WT_SESSION.checkpoint, see dist/api_data.py} 1947 * @config{drop, specify a list of checkpoints to drop. The list may 1948 * additionally contain one of the following keys: \c "from=all" to drop 1949 * all checkpoints\, \c "from=<checkpoint>" to drop all checkpoints 1950 * after and including the named checkpoint\, or \c "to=<checkpoint>" to 1951 * drop all checkpoints before and including the named checkpoint. 1952 * Checkpoints cannot be dropped while a hot backup is in progress or if 1953 * open in a cursor., a list of strings; default empty.} 1954 * @config{force, by default\, checkpoints may be skipped if the 1955 * underlying object has not been modified\, this option forces the 1956 * checkpoint., a boolean flag; default \c false.} 1957 * @config{name, if set\, specify a name for the checkpoint (note that 1958 * checkpoints including LSM trees may not be named)., a string; default 1959 * empty.} 1960 * @config{target, if non-empty\, checkpoint the list of objects., a 1961 * list of strings; default empty.} 1962 * @config{use_timestamp, by default\, create the checkpoint as of the 1963 * last stable timestamp if timestamps are in use\, or all current 1964 * updates if there is no stable timestamp set. If false\, this option 1965 * generates a checkpoint with all updates including those later than 1966 * the timestamp., a boolean flag; default \c true.} 1967 * @configend 1968 * @errors 1969 */ 1970 int __F(checkpoint)(WT_SESSION *session, const char *config); 1971 1972 /*! 1973 * Manage named snapshot transactions. Use this API to create and drop 1974 * named snapshots. Named snapshot transactions can be accessed via 1975 * WT_CURSOR::open. See @ref transaction_named_snapshots. 1976 * 1977 * @snippet ex_all.c Snapshot examples 1978 * 1979 * @param session the session handle 1980 * @configstart{WT_SESSION.snapshot, see dist/api_data.py} 1981 * @config{drop = (, if non-empty\, specifies which snapshots to drop. 1982 * Where a group of snapshots are being dropped\, the order is based on 1983 * snapshot creation order not alphanumeric name order., a set of 1984 * related configuration options defined below.} 1985 * @config{ all, drop all named snapshots., a 1986 * boolean flag; default \c false.} 1987 * @config{ before, drop all snapshots up to but 1988 * not including the specified name., a string; default empty.} 1989 * @config{ names, drop specific named 1990 * snapshots., a list of strings; default empty.} 1991 * @config{ to, drop all snapshots up to and 1992 * including the specified name., a string; default empty.} 1993 * @config{ 1994 * ),,} 1995 * @config{include_updates, make updates from the current transaction 1996 * visible to users of the named snapshot. Transactions started with 1997 * such a named snapshot are restricted to being read-only., a boolean 1998 * flag; default \c false.} 1999 * @config{name, specify a name for the snapshot., a string; default 2000 * empty.} 2001 * @configend 2002 * @errors 2003 */ 2004 int __F(snapshot)(WT_SESSION *session, const char *config); 2005 2006 /*! 2007 * Return the transaction ID range pinned by the session handle. 2008 * 2009 * The ID range is approximate and is calculated based on the oldest 2010 * ID needed for the active transaction in this session, compared 2011 * to the newest transaction in the system. 2012 * 2013 * @snippet ex_all.c transaction pinned range 2014 * 2015 * @param session the session handle 2016 * @param[out] range the range of IDs pinned by this session. Zero if 2017 * there is no active transaction. 2018 * @errors 2019 */ 2020 int __F(transaction_pinned_range)(WT_SESSION* session, uint64_t *range); 2021 2022 /*! 2023 * Wait for a transaction to become synchronized. This method is 2024 * only useful when ::wiredtiger_open is configured with the 2025 * \c transaction_sync setting disabled. 2026 * 2027 * @requires_notransaction 2028 * 2029 * @snippet ex_all.c Transaction sync 2030 * 2031 * @param session the session handle 2032 * @configstart{WT_SESSION.transaction_sync, see dist/api_data.py} 2033 * @config{timeout_ms, maximum amount of time to wait for background 2034 * sync to complete in milliseconds. A value of zero disables the 2035 * timeout and returns immediately., an integer; default \c 1200000.} 2036 * @configend 2037 * @errors 2038 */ 2039 int __F(transaction_sync)(WT_SESSION *session, const char *config); 2040 /*! @} */ 2041 2042#ifndef DOXYGEN 2043 /*! 2044 * Call into the library. 2045 * 2046 * This method is used for breakpoints and to set other configuration 2047 * when debugging layers not directly supporting those features. 2048 * 2049 * @param session the session handle 2050 * @errors 2051 */ 2052 int __F(breakpoint)(WT_SESSION *session); 2053#endif 2054}; 2055 2056/*! 2057 * A connection to a WiredTiger database. The connection may be opened within 2058 * the same address space as the caller or accessed over a socket connection. 2059 * 2060 * Most applications will open a single connection to a database for each 2061 * process. The first process to open a connection to a database will access 2062 * the database in its own address space. Subsequent connections (if allowed) 2063 * will communicate with the first process over a socket connection to perform 2064 * their operations. 2065 * 2066 * <b>Thread safety:</b> A WT_CONNECTION handle may be shared between threads, 2067 * see @ref threads for more information. 2068 */ 2069struct __wt_connection { 2070 /*! 2071 * @name Async operation handles 2072 * @{ 2073 */ 2074 /*! 2075 * Wait for all outstanding operations to complete. 2076 * 2077 * @snippet ex_async.c async flush 2078 * 2079 * @param connection the connection handle 2080 * @errors 2081 */ 2082 int __F(async_flush)(WT_CONNECTION *connection); 2083 2084 /*! 2085 * Return an async operation handle 2086 * 2087 * @snippet ex_async.c async handle allocation 2088 * 2089 * @param connection the connection handle 2090 * @param uri the connection handle 2091 * @configstart{WT_CONNECTION.async_new_op, see dist/api_data.py} 2092 * @config{append, append the value as a new record\, creating a new 2093 * record number key; valid only for operations with record number 2094 * keys., a boolean flag; default \c false.} 2095 * @config{overwrite, configures whether the cursor's insert\, update 2096 * and remove methods check the existing state of the record. If \c 2097 * overwrite is \c false\, WT_CURSOR::insert fails with 2098 * ::WT_DUPLICATE_KEY if the record exists\, WT_CURSOR::update and 2099 * WT_CURSOR::remove fail with ::WT_NOTFOUND if the record does not 2100 * exist., a boolean flag; default \c true.} 2101 * @config{raw, ignore the encodings for the key and value\, manage data 2102 * as if the formats were \c "u". See @ref cursor_raw for details., a 2103 * boolean flag; default \c false.} 2104 * @config{timeout, maximum amount of time to allow for compact in 2105 * seconds. The actual amount of time spent in compact may exceed the 2106 * configured value. A value of zero disables the timeout., an integer; 2107 * default \c 1200.} 2108 * @configend 2109 * @param callback the operation callback 2110 * @param[out] asyncopp the new op handle 2111 * @errors 2112 * If there are no available handles, \c EBUSY is returned. 2113 */ 2114 int __F(async_new_op)(WT_CONNECTION *connection, 2115 const char *uri, const char *config, WT_ASYNC_CALLBACK *callback, 2116 WT_ASYNC_OP **asyncopp); 2117 /*! @} */ 2118 2119 /*! 2120 * Close a connection. 2121 * 2122 * Any open sessions will be closed. 2123 * 2124 * @snippet ex_all.c Close a connection 2125 * 2126 * @param connection the connection handle 2127 * @configstart{WT_CONNECTION.close, see dist/api_data.py} 2128 * @config{leak_memory, don't free memory during close., a boolean flag; 2129 * default \c false.} 2130 * @config{use_timestamp, by default\, create the close checkpoint as of 2131 * the last stable timestamp if timestamps are in use\, or all current 2132 * updates if there is no stable timestamp set. If false\, this option 2133 * generates a checkpoint with all updates., a boolean flag; default \c 2134 * true.} 2135 * @configend 2136 * @errors 2137 */ 2138 int __F(close)(WT_HANDLE_CLOSED(WT_CONNECTION) *connection, 2139 const char *config); 2140 2141#ifndef DOXYGEN 2142 /*! 2143 * Output debug information for various subsystems. The output format 2144 * may change over time, gathering the debug information may be 2145 * invasive, and the information reported may not provide a point in 2146 * time view of the system. 2147 * 2148 * @param connection the connection handle 2149 * @configstart{WT_CONNECTION.debug_info, see dist/api_data.py} 2150 * @config{cache, print cache information., a boolean flag; default \c 2151 * false.} 2152 * @config{cursors, print all open cursor information., a boolean flag; 2153 * default \c false.} 2154 * @config{handles, print open handles information., a boolean flag; 2155 * default \c false.} 2156 * @config{log, print log information., a boolean flag; default \c 2157 * false.} 2158 * @config{sessions, print open session information., a boolean flag; 2159 * default \c false.} 2160 * @config{txn, print global txn information., a boolean flag; default 2161 * \c false.} 2162 * @configend 2163 * @errors 2164 */ 2165 int __F(debug_info)(WT_CONNECTION *connection, const char *config); 2166#endif 2167 2168 /*! 2169 * Reconfigure a connection handle. 2170 * 2171 * @snippet ex_all.c Reconfigure a connection 2172 * 2173 * @param connection the connection handle 2174 * @configstart{WT_CONNECTION.reconfigure, see dist/api_data.py} 2175 * @config{async = (, asynchronous operations configuration options., a 2176 * set of related configuration options defined below.} 2177 * @config{ enabled, enable asynchronous 2178 * operation., a boolean flag; default \c false.} 2179 * @config{ ops_max, maximum number of expected 2180 * simultaneous asynchronous operations., an integer between 1 and 4096; 2181 * default \c 1024.} 2182 * @config{ threads, the number 2183 * of worker threads to service asynchronous requests. Each worker 2184 * thread uses a session from the configured session_max., an integer 2185 * between 1 and 20; default \c 2.} 2186 * @config{ ),,} 2187 * @config{cache_max_wait_ms, the maximum number of milliseconds an 2188 * application thread will wait for space to be available in cache 2189 * before giving up. Default will wait forever., an integer greater 2190 * than or equal to 0; default \c 0.} 2191 * @config{cache_overflow = (, cache overflow configuration options., a 2192 * set of related configuration options defined below.} 2193 * @config{ file_max, The maximum number of bytes 2194 * that WiredTiger is allowed to use for its cache overflow mechanism. 2195 * If the cache overflow file exceeds this size\, a panic will be 2196 * triggered. The default value means that the cache overflow file is 2197 * unbounded and may use as much space as the filesystem will 2198 * accommodate. The minimum non-zero setting is 100MB., an integer 2199 * greater than or equal to 0; default \c 0.} 2200 * @config{ ),,} 2201 * @config{cache_overhead, assume the heap allocator overhead is the 2202 * specified percentage\, and adjust the cache usage by that amount (for 2203 * example\, if there is 10GB of data in cache\, a percentage of 10 2204 * means WiredTiger treats this as 11GB). This value is configurable 2205 * because different heap allocators have different overhead and 2206 * different workloads will have different heap allocation sizes and 2207 * patterns\, therefore applications may need to adjust this value based 2208 * on allocator choice and behavior in measured workloads., an integer 2209 * between 0 and 30; default \c 8.} 2210 * @config{cache_size, maximum heap memory to allocate for the cache. A 2211 * database should configure either \c cache_size or \c shared_cache but 2212 * not both., an integer between 1MB and 10TB; default \c 100MB.} 2213 * @config{checkpoint = (, periodically checkpoint the database. 2214 * Enabling the checkpoint server uses a session from the configured 2215 * session_max., a set of related configuration options defined below.} 2216 * @config{ log_size, wait for this amount of log 2217 * record bytes to be written to the log between each checkpoint. If 2218 * non-zero\, this value will use a minimum of the log file size. A 2219 * database can configure both log_size and wait to set an upper bound 2220 * for checkpoints; setting this value above 0 configures periodic 2221 * checkpoints., an integer between 0 and 2GB; default \c 0.} 2222 * @config{ wait, seconds to wait between each 2223 * checkpoint; setting this value above 0 configures periodic 2224 * checkpoints., an integer between 0 and 100000; default \c 0.} 2225 * @config{ ),,} 2226 * @config{compatibility = (, set compatibility version of database. 2227 * Changing the compatibility version requires that there are no active 2228 * operations for the duration of the call., a set of related 2229 * configuration options defined below.} 2230 * @config{ release, compatibility release 2231 * version string., a string; default empty.} 2232 * @config{ ),,} 2233 * @config{error_prefix, prefix string for error messages., a string; 2234 * default empty.} 2235 * @config{eviction = (, eviction configuration options., a set of 2236 * related configuration options defined below.} 2237 * @config{ threads_max, maximum number of 2238 * threads WiredTiger will start to help evict pages from cache. The 2239 * number of threads started will vary depending on the current eviction 2240 * load. Each eviction worker thread uses a session from the configured 2241 * session_max., an integer between 1 and 20; default \c 8.} 2242 * @config{ threads_min, minimum number of 2243 * threads WiredTiger will start to help evict pages from cache. The 2244 * number of threads currently running will vary depending on the 2245 * current eviction load., an integer between 1 and 20; default \c 1.} 2246 * @config{ ),,} 2247 * @config{eviction_checkpoint_target, perform eviction at the beginning 2248 * of checkpoints to bring the dirty content in cache to this level. It 2249 * is a percentage of the cache size if the value is within the range of 2250 * 0 to 100 or an absolute size when greater than 100. The value is not 2251 * allowed to exceed the \c cache_size. Ignored if set to zero or \c 2252 * in_memory is \c true., an integer between 0 and 10TB; default \c 1.} 2253 * @config{eviction_dirty_target, perform eviction in worker threads 2254 * when the cache contains at least this much dirty content. It is a 2255 * percentage of the cache size if the value is within the range of 1 to 2256 * 100 or an absolute size when greater than 100. The value is not 2257 * allowed to exceed the \c cache_size., an integer between 1 and 10TB; 2258 * default \c 5.} 2259 * @config{eviction_dirty_trigger, trigger application threads to 2260 * perform eviction when the cache contains at least this much dirty 2261 * content. It is a percentage of the cache size if the value is within 2262 * the range of 1 to 100 or an absolute size when greater than 100. The 2263 * value is not allowed to exceed the \c cache_size. This setting only 2264 * alters behavior if it is lower than eviction_trigger., an integer 2265 * between 1 and 10TB; default \c 20.} 2266 * @config{eviction_target, perform eviction in worker threads when the 2267 * cache contains at least this much content. It is a percentage of the 2268 * cache size if the value is within the range of 10 to 100 or an 2269 * absolute size when greater than 100. The value is not allowed to 2270 * exceed the \c cache_size., an integer between 10 and 10TB; default \c 2271 * 80.} 2272 * @config{eviction_trigger, trigger application threads to perform 2273 * eviction when the cache contains at least this much content. It is a 2274 * percentage of the cache size if the value is within the range of 10 2275 * to 100 or an absolute size when greater than 100. The value is not 2276 * allowed to exceed the \c cache_size., an integer between 10 and 10TB; 2277 * default \c 95.} 2278 * @config{file_manager = (, control how file handles are managed., a 2279 * set of related configuration options defined below.} 2280 * @config{ close_handle_minimum, number of 2281 * handles open before the file manager will look for handles to close., 2282 * an integer greater than or equal to 0; default \c 250.} 2283 * @config{ close_idle_time, amount of time in 2284 * seconds a file handle needs to be idle before attempting to close it. 2285 * A setting of 0 means that idle handles are not closed., an integer 2286 * between 0 and 100000; default \c 30.} 2287 * @config{ close_scan_interval, interval in 2288 * seconds at which to check for files that are inactive and close 2289 * them., an integer between 1 and 100000; default \c 10.} 2290 * @config{ ),,} 2291 * @config{log = (, enable logging. Enabling logging uses three 2292 * sessions from the configured session_max., a set of related 2293 * configuration options defined below.} 2294 * @config{ archive, automatically archive 2295 * unneeded log files., a boolean flag; default \c true.} 2296 * @config{ prealloc, pre-allocate log files., a 2297 * boolean flag; default \c true.} 2298 * @config{ zero_fill, manually write zeroes into 2299 * log files., a boolean flag; default \c false.} 2300 * @config{ ),,} 2301 * @config{lsm_manager = (, configure database wide options for LSM tree 2302 * management. The LSM manager is started automatically the first time 2303 * an LSM tree is opened. The LSM manager uses a session from the 2304 * configured session_max., a set of related configuration options 2305 * defined below.} 2306 * @config{ merge, merge LSM 2307 * chunks where possible., a boolean flag; default \c true.} 2308 * @config{ worker_thread_max, Configure a set of 2309 * threads to manage merging LSM trees in the database. Each worker 2310 * thread uses a session handle from the configured session_max., an 2311 * integer between 3 and 20; default \c 4.} 2312 * @config{ ),,} 2313 * @config{operation_tracking = (, enable tracking of 2314 * performance-critical functions. See @ref operation_tracking for more 2315 * information., a set of related configuration options defined below.} 2316 * @config{ enabled, enable operation tracking 2317 * subsystem., a boolean flag; default \c false.} 2318 * @config{ path, the name of a directory into 2319 * which operation tracking files are written. The directory must 2320 * already exist. If the value is not an absolute path\, the path is 2321 * relative to the database home (see @ref absolute_path for more 2322 * information)., a string; default \c ".".} 2323 * @config{ ),,} 2324 * @config{shared_cache = (, shared cache configuration options. A 2325 * database should configure either a cache_size or a shared_cache not 2326 * both. Enabling a shared cache uses a session from the configured 2327 * session_max. A shared cache can not have absolute values configured 2328 * for cache eviction settings., a set of related configuration options 2329 * defined below.} 2330 * @config{ chunk, the 2331 * granularity that a shared cache is redistributed., an integer between 2332 * 1MB and 10TB; default \c 10MB.} 2333 * @config{ name, 2334 * the name of a cache that is shared between databases or \c "none" 2335 * when no shared cache is configured., a string; default \c none.} 2336 * @config{ quota, maximum size of cache this 2337 * database can be allocated from the shared cache. Defaults to the 2338 * entire shared cache size., an integer; default \c 0.} 2339 * @config{ reserve, amount of cache this 2340 * database is guaranteed to have available from the shared cache. This 2341 * setting is per database. Defaults to the chunk size., an integer; 2342 * default \c 0.} 2343 * @config{ size, maximum memory 2344 * to allocate for the shared cache. Setting this will update the value 2345 * if one is already set., an integer between 1MB and 10TB; default \c 2346 * 500MB.} 2347 * @config{ ),,} 2348 * @config{statistics, Maintain database statistics\, which may impact 2349 * performance. Choosing "all" maintains all statistics regardless of 2350 * cost\, "fast" maintains a subset of statistics that are relatively 2351 * inexpensive\, "none" turns off all statistics. The "clear" 2352 * configuration resets statistics after they are gathered\, where 2353 * appropriate (for example\, a cache size statistic is not cleared\, 2354 * while the count of cursor insert operations will be cleared). When 2355 * "clear" is configured for the database\, gathered statistics are 2356 * reset each time a statistics cursor is used to gather statistics\, as 2357 * well as each time statistics are logged using the \c statistics_log 2358 * configuration. See @ref statistics for more information., a list\, 2359 * with values chosen from the following options: \c "all"\, \c 2360 * "cache_walk"\, \c "fast"\, \c "none"\, \c "clear"\, \c "tree_walk"; 2361 * default \c none.} 2362 * @config{statistics_log = (, log any statistics the database is 2363 * configured to maintain\, to a file. See @ref statistics for more 2364 * information. Enabling the statistics log server uses a session from 2365 * the configured session_max., a set of related configuration options 2366 * defined below.} 2367 * @config{ json, encode 2368 * statistics in JSON format., a boolean flag; default \c false.} 2369 * @config{ on_close, log statistics on database 2370 * close., a boolean flag; default \c false.} 2371 * @config{ sources, if non-empty\, include 2372 * statistics for the list of data source URIs\, if they are open at the 2373 * time of the statistics logging. The list may include URIs matching a 2374 * single data source ("table:mytable")\, or a URI matching all data 2375 * sources of a particular type ("table:")., a list of strings; default 2376 * empty.} 2377 * @config{ timestamp, a timestamp 2378 * prepended to each log record\, may contain strftime conversion 2379 * specifications\, when \c json is configured\, defaults to \c 2380 * "%FT%Y.000Z"., a string; default \c "%b %d %H:%M:%S".} 2381 * @config{ wait, seconds to wait between each 2382 * write of the log records; setting this value above 0 configures 2383 * statistics logging., an integer between 0 and 100000; default \c 0.} 2384 * @config{ ),,} 2385 * @config{verbose, enable messages for various events. Options are 2386 * given as a list\, such as 2387 * <code>"verbose=[evictserver\,read]"</code>., a list\, with values 2388 * chosen from the following options: \c "api"\, \c "block"\, \c 2389 * "checkpoint"\, \c "checkpoint_progress"\, \c "compact"\, \c 2390 * "error_returns"\, \c "evict"\, \c "evict_stuck"\, \c "evictserver"\, 2391 * \c "fileops"\, \c "handleops"\, \c "log"\, \c "lookaside"\, \c 2392 * "lookaside_activity"\, \c "lsm"\, \c "lsm_manager"\, \c "metadata"\, 2393 * \c "mutex"\, \c "overflow"\, \c "read"\, \c "rebalance"\, \c 2394 * "reconcile"\, \c "recovery"\, \c "recovery_progress"\, \c "salvage"\, 2395 * \c "shared_cache"\, \c "split"\, \c "temporary"\, \c "thread_group"\, 2396 * \c "timestamp"\, \c "transaction"\, \c "verify"\, \c "version"\, \c 2397 * "write"; default empty.} 2398 * @configend 2399 * @errors 2400 */ 2401 int __F(reconfigure)(WT_CONNECTION *connection, const char *config); 2402 2403 /*! 2404 * The home directory of the connection. 2405 * 2406 * @snippet ex_all.c Get the database home directory 2407 * 2408 * @param connection the connection handle 2409 * @returns a pointer to a string naming the home directory 2410 */ 2411 const char *__F(get_home)(WT_CONNECTION *connection); 2412 2413 /*! 2414 * Add configuration options for a method. See 2415 * @ref custom_ds_config_add for more information. 2416 * 2417 * @snippet ex_all.c Configure method configuration 2418 * 2419 * @param connection the connection handle 2420 * @param method the method being configured 2421 * @param uri the object type or NULL for all object types 2422 * @param config the additional configuration's name and default value 2423 * @param type the additional configuration's type (must be one of 2424 * \c "boolean"\, \c "int", \c "list" or \c "string") 2425 * @param check the additional configuration check string, or NULL if 2426 * none 2427 * @errors 2428 */ 2429 int __F(configure_method)(WT_CONNECTION *connection, 2430 const char *method, const char *uri, 2431 const char *config, const char *type, const char *check); 2432 2433 /*! 2434 * Return if opening this handle created the database. 2435 * 2436 * @snippet ex_all.c Check if the database is newly created 2437 * 2438 * @param connection the connection handle 2439 * @returns false (zero) if the connection existed before the call to 2440 * ::wiredtiger_open, true (non-zero) if it was created by opening this 2441 * handle. 2442 */ 2443 int __F(is_new)(WT_CONNECTION *connection); 2444 2445 /*! 2446 * @name Session handles 2447 * @{ 2448 */ 2449 /*! 2450 * Open a session. 2451 * 2452 * @snippet ex_all.c Open a session 2453 * 2454 * @param connection the connection handle 2455 * @param event_handler An event handler. If <code>NULL</code>, the 2456 * connection's event handler is used. See @ref event_message_handling 2457 * for more information. 2458 * @configstart{WT_CONNECTION.open_session, see dist/api_data.py} 2459 * @config{cache_cursors, enable caching of cursors for reuse. Any 2460 * calls to WT_CURSOR::close for a cursor created in this session will 2461 * mark the cursor as cached and keep it available to be reused for 2462 * later calls to WT_SESSION::open_cursor. Cached cursors may be 2463 * eventually closed. This value is inherited from ::wiredtiger_open \c 2464 * cache_cursors., a boolean flag; default \c true.} 2465 * @config{ignore_cache_size, when set\, operations performed by this 2466 * session ignore the cache size and are not blocked when the cache is 2467 * full. Note that use of this option for operations that create cache 2468 * pressure can starve ordinary sessions that obey the cache size., a 2469 * boolean flag; default \c false.} 2470 * @config{isolation, the default isolation level for operations in this 2471 * session., a string\, chosen from the following options: \c 2472 * "read-uncommitted"\, \c "read-committed"\, \c "snapshot"; default \c 2473 * read-committed.} 2474 * @configend 2475 * @param[out] sessionp the new session handle 2476 * @errors 2477 */ 2478 int __F(open_session)(WT_CONNECTION *connection, 2479 WT_EVENT_HANDLER *event_handler, const char *config, 2480 WT_SESSION **sessionp); 2481 /*! @} */ 2482 2483 /*! 2484 * @name Transactions 2485 * @{ 2486 */ 2487 /*! 2488 * Query the global transaction timestamp state. 2489 * 2490 * @snippet ex_all.c query timestamp 2491 * 2492 * @param connection the connection handle 2493 * @param[out] hex_timestamp a buffer that will be set to the 2494 * hexadecimal encoding of the timestamp being queried. Must be large 2495 * enough to hold a hex-encoded timestamp (i.e., double the timestamp 2496 * size plus one byte for NUL termination). 2497 * @configstart{WT_CONNECTION.query_timestamp, see dist/api_data.py} 2498 * @config{get, specify which timestamp to query: \c all_committed 2499 * returns the largest timestamp such that all timestamps up to that 2500 * value have committed\, \c oldest returns the most recent \c 2501 * oldest_timestamp set with WT_CONNECTION::set_timestamp\, \c 2502 * oldest_reader returns the minimum of the read timestamps of all 2503 * active readers \c pinned returns the minimum of the\c 2504 * oldest_timestamp and the read timestamps of all active readers\, and 2505 * \c stable returns the most recent \c stable_timestamp set with 2506 * WT_CONNECTION::set_timestamp. See @ref transaction_timestamps., a 2507 * string\, chosen from the following options: \c "all_committed"\, \c 2508 * "last_checkpoint"\, \c "oldest"\, \c "oldest_reader"\, \c "pinned"\, 2509 * \c "recovery"\, \c "stable"; default \c all_committed.} 2510 * @configend 2511 * @errors 2512 * If there is no matching timestamp (e.g., if this method is called 2513 * before timestamps are used) ::WT_NOTFOUND will be returned. 2514 */ 2515 int __F(query_timestamp)( 2516 WT_CONNECTION *connection, char *hex_timestamp, const char *config); 2517 2518 /*! 2519 * Set a global transaction timestamp. 2520 * 2521 * @snippet ex_all.c set commit timestamp 2522 * 2523 * @snippet ex_all.c set oldest timestamp 2524 * 2525 * @snippet ex_all.c set stable timestamp 2526 * 2527 * @param connection the connection handle 2528 * @configstart{WT_CONNECTION.set_timestamp, see dist/api_data.py} 2529 * @config{commit_timestamp, reset the maximum commit timestamp tracked 2530 * by WiredTiger. This will cause future calls to 2531 * WT_CONNECTION::query_timestamp to ignore commit timestamps greater 2532 * than the specified value until the next commit moves the tracked 2533 * commit timestamp forwards. This is only intended for use where the 2534 * application is rolling back locally committed transactions. The 2535 * supplied value must not be older than the current oldest and stable 2536 * timestamps. See @ref transaction_timestamps., a string; default 2537 * empty.} 2538 * @config{force, set timestamps even if they violate normal ordering 2539 * requirements. For example allow the \c oldest_timestamp to move 2540 * backwards., a boolean flag; default \c false.} 2541 * @config{oldest_timestamp, future commits and queries will be no 2542 * earlier than the specified timestamp. Supplied values must be 2543 * monotonically increasing\, any attempt to set the value to older than 2544 * the current is silently ignored. The supplied value must not be 2545 * newer than the current stable timestamp. See @ref 2546 * transaction_timestamps., a string; default empty.} 2547 * @config{stable_timestamp, checkpoints will not include commits that 2548 * are newer than the specified timestamp in tables configured with \c 2549 * log=(enabled=false). Supplied values must be monotonically 2550 * increasing\, any attempt to set the value to older than the current 2551 * is silently ignored. The supplied value must not be older than the 2552 * current oldest timestamp. See @ref transaction_timestamps., a 2553 * string; default empty.} 2554 * @configend 2555 * @errors 2556 */ 2557 int __F(set_timestamp)( 2558 WT_CONNECTION *connection, const char *config); 2559 2560 /*! 2561 * Rollback in-memory non-logged state to an earlier point in time. 2562 * 2563 * This method uses a timestamp to define the rollback point, and thus 2564 * requires that the application uses timestamps and that the 2565 * stable_timestamp must have been set via a call to 2566 * WT_CONNECTION::set_timestamp. Any updates to checkpoint durable 2567 * tables that are more recent than the stable timestamp are removed. 2568 * 2569 * This method requires that there are no active operations for the 2570 * duration of the call. 2571 * 2572 * Any updates made to logged tables will not be rolled back. Any 2573 * updates made without an associated timestamp will not be rolled 2574 * back. See @ref transaction_timestamps. 2575 * 2576 * @snippet ex_all.c rollback to stable 2577 * 2578 * @param connection the connection handle 2579 * @configempty{WT_CONNECTION.rollback_to_stable, see dist/api_data.py} 2580 * @errors 2581 */ 2582 int __F(rollback_to_stable)( 2583 WT_CONNECTION *connection, const char *config); 2584 2585 /*! @} */ 2586 2587 /*! 2588 * @name Extensions 2589 * @{ 2590 */ 2591 /*! 2592 * Load an extension. 2593 * 2594 * @snippet ex_all.c Load an extension 2595 * 2596 * @param connection the connection handle 2597 * @param path the filename of the extension module, or \c "local" to 2598 * search the current application binary for the initialization 2599 * function, see @ref extensions for more details. 2600 * @configstart{WT_CONNECTION.load_extension, see dist/api_data.py} 2601 * @config{config, configuration string passed to the entry point of the 2602 * extension as its WT_CONFIG_ARG argument., a string; default empty.} 2603 * @config{early_load, whether this extension should be loaded at the 2604 * beginning of ::wiredtiger_open. Only applicable to extensions loaded 2605 * via the wiredtiger_open configurations string., a boolean flag; 2606 * default \c false.} 2607 * @config{entry, the entry point of the extension\, called to 2608 * initialize the extension when it is loaded. The signature of the 2609 * function must match ::wiredtiger_extension_init., a string; default 2610 * \c wiredtiger_extension_init.} 2611 * @config{terminate, an optional function in the extension that is 2612 * called before the extension is unloaded during WT_CONNECTION::close. 2613 * The signature of the function must match 2614 * ::wiredtiger_extension_terminate., a string; default \c 2615 * wiredtiger_extension_terminate.} 2616 * @configend 2617 * @errors 2618 */ 2619 int __F(load_extension)(WT_CONNECTION *connection, 2620 const char *path, const char *config); 2621 2622 /*! 2623 * Add a custom data source. See @ref custom_data_sources for more 2624 * information. 2625 * 2626 * The application must first implement the WT_DATA_SOURCE interface 2627 * and then register the implementation with WiredTiger: 2628 * 2629 * @snippet ex_data_source.c WT_DATA_SOURCE register 2630 * 2631 * @param connection the connection handle 2632 * @param prefix the URI prefix for this data source, e.g., "file:" 2633 * @param data_source the application-supplied implementation of 2634 * WT_DATA_SOURCE to manage this data source. 2635 * @configempty{WT_CONNECTION.add_data_source, see dist/api_data.py} 2636 * @errors 2637 */ 2638 int __F(add_data_source)(WT_CONNECTION *connection, const char *prefix, 2639 WT_DATA_SOURCE *data_source, const char *config); 2640 2641 /*! 2642 * Add a custom collation function. 2643 * 2644 * The application must first implement the WT_COLLATOR interface and 2645 * then register the implementation with WiredTiger: 2646 * 2647 * @snippet ex_all.c WT_COLLATOR register 2648 * 2649 * @param connection the connection handle 2650 * @param name the name of the collation to be used in calls to 2651 * WT_SESSION::create, may not be \c "none" 2652 * @param collator the application-supplied collation handler 2653 * @configempty{WT_CONNECTION.add_collator, see dist/api_data.py} 2654 * @errors 2655 */ 2656 int __F(add_collator)(WT_CONNECTION *connection, 2657 const char *name, WT_COLLATOR *collator, const char *config); 2658 2659 /*! 2660 * Add a compression function. 2661 * 2662 * The application must first implement the WT_COMPRESSOR interface 2663 * and then register the implementation with WiredTiger: 2664 * 2665 * @snippet nop_compress.c WT_COMPRESSOR initialization structure 2666 * 2667 * @snippet nop_compress.c WT_COMPRESSOR initialization function 2668 * 2669 * @param connection the connection handle 2670 * @param name the name of the compression function to be used in calls 2671 * to WT_SESSION::create, may not be \c "none" 2672 * @param compressor the application-supplied compression handler 2673 * @configempty{WT_CONNECTION.add_compressor, see dist/api_data.py} 2674 * @errors 2675 */ 2676 int __F(add_compressor)(WT_CONNECTION *connection, 2677 const char *name, WT_COMPRESSOR *compressor, const char *config); 2678 2679 /*! 2680 * Add an encryption function. 2681 * 2682 * The application must first implement the WT_ENCRYPTOR interface 2683 * and then register the implementation with WiredTiger: 2684 * 2685 * @snippet nop_encrypt.c WT_ENCRYPTOR initialization structure 2686 * 2687 * @snippet nop_encrypt.c WT_ENCRYPTOR initialization function 2688 * 2689 * @param connection the connection handle 2690 * @param name the name of the encryption function to be used in calls 2691 * to WT_SESSION::create, may not be \c "none" 2692 * @param encryptor the application-supplied encryption handler 2693 * @configempty{WT_CONNECTION.add_encryptor, see dist/api_data.py} 2694 * @errors 2695 */ 2696 int __F(add_encryptor)(WT_CONNECTION *connection, 2697 const char *name, WT_ENCRYPTOR *encryptor, const char *config); 2698 2699 /*! 2700 * Add a custom extractor for index keys or column groups. 2701 * 2702 * The application must first implement the WT_EXTRACTOR interface and 2703 * then register the implementation with WiredTiger: 2704 * 2705 * @snippet ex_all.c WT_EXTRACTOR register 2706 * 2707 * @param connection the connection handle 2708 * @param name the name of the extractor to be used in calls to 2709 * WT_SESSION::create, may not be \c "none" 2710 * @param extractor the application-supplied extractor 2711 * @configempty{WT_CONNECTION.add_extractor, see dist/api_data.py} 2712 * @errors 2713 */ 2714 int __F(add_extractor)(WT_CONNECTION *connection, const char *name, 2715 WT_EXTRACTOR *extractor, const char *config); 2716 2717 /*! 2718 * Configure a custom file system. 2719 * 2720 * This method can only be called from an early loaded extension 2721 * module. The application must first implement the WT_FILE_SYSTEM 2722 * interface and then register the implementation with WiredTiger: 2723 * 2724 * @snippet ex_file_system.c WT_FILE_SYSTEM register 2725 * 2726 * @param connection the connection handle 2727 * @param fs the populated file system structure 2728 * @configempty{WT_CONNECTION.set_file_system, see dist/api_data.py} 2729 * @errors 2730 */ 2731 int __F(set_file_system)( 2732 WT_CONNECTION *connection, WT_FILE_SYSTEM *fs, const char *config); 2733 2734 /*! 2735 * Return a reference to the WiredTiger extension functions. 2736 * 2737 * @snippet ex_data_source.c WT_EXTENSION_API declaration 2738 * 2739 * @param wt_conn the WT_CONNECTION handle 2740 * @returns a reference to a WT_EXTENSION_API structure. 2741 */ 2742 WT_EXTENSION_API *__F(get_extension_api)(WT_CONNECTION *wt_conn); 2743 /*! @} */ 2744}; 2745 2746/*! 2747 * Open a connection to a database. 2748 * 2749 * @snippet ex_all.c Open a connection 2750 * 2751 * @param home The path to the database home directory. See @ref home 2752 * for more information. 2753 * @param event_handler An event handler. If <code>NULL</code>, a default 2754 * event handler is installed that writes error messages to stderr. See 2755 * @ref event_message_handling for more information. 2756 * @configstart{wiredtiger_open, see dist/api_data.py} 2757 * @config{async = (, asynchronous operations configuration options., a set of 2758 * related configuration options defined below.} 2759 * @config{ enabled, enable asynchronous operation., a 2760 * boolean flag; default \c false.} 2761 * @config{ ops_max, 2762 * maximum number of expected simultaneous asynchronous operations., an integer 2763 * between 1 and 4096; default \c 1024.} 2764 * @config{ threads, the number of worker threads to 2765 * service asynchronous requests. Each worker thread uses a session from the 2766 * configured session_max., an integer between 1 and 20; default \c 2.} 2767 * @config{ 2768 * ),,} 2769 * @config{buffer_alignment, in-memory alignment (in bytes) for buffers used for 2770 * I/O. The default value of -1 indicates a platform-specific alignment value 2771 * should be used (4KB on Linux systems when direct I/O is configured\, zero 2772 * elsewhere)., an integer between -1 and 1MB; default \c -1.} 2773 * @config{builtin_extension_config, A structure where the keys are the names of 2774 * builtin extensions and the values are passed to WT_CONNECTION::load_extension 2775 * as the \c config parameter (for example\, 2776 * <code>builtin_extension_config={zlib={compression_level=3}}</code>)., a 2777 * string; default empty.} 2778 * @config{cache_cursors, enable caching of cursors for reuse. This is the 2779 * default value for any sessions created\, and can be overridden in configuring 2780 * \c cache_cursors in WT_CONNECTION.open_session., a boolean flag; default \c 2781 * true.} 2782 * @config{cache_max_wait_ms, the maximum number of milliseconds an application 2783 * thread will wait for space to be available in cache before giving up. 2784 * Default will wait forever., an integer greater than or equal to 0; default \c 2785 * 0.} 2786 * @config{cache_overflow = (, cache overflow configuration options., a set of 2787 * related configuration options defined below.} 2788 * @config{ file_max, The maximum number of bytes that 2789 * WiredTiger is allowed to use for its cache overflow mechanism. If the cache 2790 * overflow file exceeds this size\, a panic will be triggered. The default 2791 * value means that the cache overflow file is unbounded and may use as much 2792 * space as the filesystem will accommodate. The minimum non-zero setting is 2793 * 100MB., an integer greater than or equal to 0; default \c 0.} 2794 * @config{ ),,} 2795 * @config{cache_overhead, assume the heap allocator overhead is the specified 2796 * percentage\, and adjust the cache usage by that amount (for example\, if 2797 * there is 10GB of data in cache\, a percentage of 10 means WiredTiger treats 2798 * this as 11GB). This value is configurable because different heap allocators 2799 * have different overhead and different workloads will have different heap 2800 * allocation sizes and patterns\, therefore applications may need to adjust 2801 * this value based on allocator choice and behavior in measured workloads., an 2802 * integer between 0 and 30; default \c 8.} 2803 * @config{cache_size, maximum heap memory to allocate for the cache. A 2804 * database should configure either \c cache_size or \c shared_cache but not 2805 * both., an integer between 1MB and 10TB; default \c 100MB.} 2806 * @config{checkpoint = (, periodically checkpoint the database. Enabling the 2807 * checkpoint server uses a session from the configured session_max., a set of 2808 * related configuration options defined below.} 2809 * @config{ log_size, wait for this amount of log record 2810 * bytes to be written to the log between each checkpoint. If non-zero\, this 2811 * value will use a minimum of the log file size. A database can configure both 2812 * log_size and wait to set an upper bound for checkpoints; setting this value 2813 * above 0 configures periodic checkpoints., an integer between 0 and 2GB; 2814 * default \c 0.} 2815 * @config{ wait, seconds to wait between 2816 * each checkpoint; setting this value above 0 configures periodic checkpoints., 2817 * an integer between 0 and 100000; default \c 0.} 2818 * @config{ ),,} 2819 * @config{checkpoint_sync, flush files to stable storage when closing or 2820 * writing checkpoints., a boolean flag; default \c true.} 2821 * @config{compatibility = (, set compatibility version of database. Changing 2822 * the compatibility version requires that there are no active operations for 2823 * the duration of the call., a set of related configuration options defined 2824 * below.} 2825 * @config{ release, compatibility release 2826 * version string., a string; default empty.} 2827 * @config{ require_max, required maximum compatibility 2828 * version of existing data files. Must be greater than or equal to any release 2829 * version set in the \c release setting. Has no effect if creating the 2830 * database., a string; default empty.} 2831 * @config{ require_min, required minimum compatibility 2832 * version of existing data files. Must be less than or equal to any release 2833 * version set in the \c release setting. Has no effect if creating the 2834 * database., a string; default empty.} 2835 * @config{ ),,} 2836 * @config{config_base, write the base configuration file if creating the 2837 * database. If \c false in the config passed directly to ::wiredtiger_open\, 2838 * will ignore any existing base configuration file in addition to not creating 2839 * one. See @ref config_base for more information., a boolean flag; default \c 2840 * true.} 2841 * @config{create, create the database if it does not exist., a boolean flag; 2842 * default \c false.} 2843 * @config{direct_io, Use \c O_DIRECT on POSIX systems\, and \c 2844 * FILE_FLAG_NO_BUFFERING on Windows to access files. Options are given as a 2845 * list\, such as <code>"direct_io=[data]"</code>. Configuring \c direct_io 2846 * requires care\, see @ref tuning_system_buffer_cache_direct_io for important 2847 * warnings. Including \c "data" will cause WiredTiger data files to use direct 2848 * I/O\, including \c "log" will cause WiredTiger log files to use direct I/O\, 2849 * and including \c "checkpoint" will cause WiredTiger data files opened at a 2850 * checkpoint (i.e: read only) to use direct I/O. \c direct_io should be 2851 * combined with \c write_through to get the equivalent of \c O_DIRECT on 2852 * Windows., a list\, with values chosen from the following options: \c 2853 * "checkpoint"\, \c "data"\, \c "log"; default empty.} 2854 * @config{encryption = (, configure an encryptor for system wide metadata and 2855 * logs. If a system wide encryptor is set\, it is also used for encrypting 2856 * data files and tables\, unless encryption configuration is explicitly set for 2857 * them when they are created with WT_SESSION::create., a set of related 2858 * configuration options defined below.} 2859 * @config{ keyid, 2860 * An identifier that identifies a unique instance of the encryptor. It is 2861 * stored in clear text\, and thus is available when the wiredtiger database is 2862 * reopened. On the first use of a (name\, keyid) combination\, the 2863 * WT_ENCRYPTOR::customize function is called with the keyid as an argument., a 2864 * string; default empty.} 2865 * @config{ name, Permitted 2866 * values are \c "none" or custom encryption engine name created with 2867 * WT_CONNECTION::add_encryptor. See @ref encryption for more information., a 2868 * string; default \c none.} 2869 * @config{ secretkey, A string 2870 * that is passed to the WT_ENCRYPTOR::customize function. It is never stored 2871 * in clear text\, so must be given to any subsequent ::wiredtiger_open calls to 2872 * reopen the database. It must also be provided to any "wt" commands used with 2873 * this database., a string; default empty.} 2874 * @config{ ),,} 2875 * @config{error_prefix, prefix string for error messages., a string; default 2876 * empty.} 2877 * @config{eviction = (, eviction configuration options., a set of related 2878 * configuration options defined below.} 2879 * @config{ threads_max, maximum number of threads 2880 * WiredTiger will start to help evict pages from cache. The number of threads 2881 * started will vary depending on the current eviction load. Each eviction 2882 * worker thread uses a session from the configured session_max., an integer 2883 * between 1 and 20; default \c 8.} 2884 * @config{ threads_min, 2885 * minimum number of threads WiredTiger will start to help evict pages from 2886 * cache. The number of threads currently running will vary depending on the 2887 * current eviction load., an integer between 1 and 20; default \c 1.} 2888 * @config{ 2889 * ),,} 2890 * @config{eviction_checkpoint_target, perform eviction at the beginning of 2891 * checkpoints to bring the dirty content in cache to this level. It is a 2892 * percentage of the cache size if the value is within the range of 0 to 100 or 2893 * an absolute size when greater than 100. The value is not allowed to exceed 2894 * the \c cache_size. Ignored if set to zero or \c in_memory is \c true., an 2895 * integer between 0 and 10TB; default \c 1.} 2896 * @config{eviction_dirty_target, perform eviction in worker threads when the 2897 * cache contains at least this much dirty content. It is a percentage of the 2898 * cache size if the value is within the range of 1 to 100 or an absolute size 2899 * when greater than 100. The value is not allowed to exceed the \c cache_size., 2900 * an integer between 1 and 10TB; default \c 5.} 2901 * @config{eviction_dirty_trigger, trigger application threads to perform 2902 * eviction when the cache contains at least this much dirty content. It is a 2903 * percentage of the cache size if the value is within the range of 1 to 100 or 2904 * an absolute size when greater than 100. The value is not allowed to exceed 2905 * the \c cache_size. This setting only alters behavior if it is lower than 2906 * eviction_trigger., an integer between 1 and 10TB; default \c 20.} 2907 * @config{eviction_target, perform eviction in worker threads when the cache 2908 * contains at least this much content. It is a percentage of the cache size if 2909 * the value is within the range of 10 to 100 or an absolute size when greater 2910 * than 100. The value is not allowed to exceed the \c cache_size., an integer 2911 * between 10 and 10TB; default \c 80.} 2912 * @config{eviction_trigger, trigger application threads to perform eviction 2913 * when the cache contains at least this much content. It is a percentage of 2914 * the cache size if the value is within the range of 10 to 100 or an absolute 2915 * size when greater than 100. The value is not allowed to exceed the \c 2916 * cache_size., an integer between 10 and 10TB; default \c 95.} 2917 * @config{exclusive, fail if the database already exists\, generally used with 2918 * the \c create option., a boolean flag; default \c false.} 2919 * @config{extensions, list of shared library extensions to load (using dlopen). 2920 * Any values specified to a library extension are passed to 2921 * WT_CONNECTION::load_extension as the \c config parameter (for example\, 2922 * <code>extensions=(/path/ext.so={entry=my_entry})</code>)., a list of strings; 2923 * default empty.} 2924 * @config{file_extend, file extension configuration. If set\, extend files of 2925 * the set type in allocations of the set size\, instead of a block at a time as 2926 * each new block is written. For example\, 2927 * <code>file_extend=(data=16MB)</code>. If set to 0\, disable the file 2928 * extension for the set type. For log files\, the allowed range is between 2929 * 100KB and 2GB; values larger than the configured maximum log size and the 2930 * default config would extend log files in allocations of the maximum log file 2931 * size., a list\, with values chosen from the following options: \c "data"\, \c 2932 * "log"; default empty.} 2933 * @config{file_manager = (, control how file handles are managed., a set of 2934 * related configuration options defined below.} 2935 * @config{ close_handle_minimum, number of handles open 2936 * before the file manager will look for handles to close., an integer greater 2937 * than or equal to 0; default \c 250.} 2938 * @config{ close_idle_time, amount of time in seconds a 2939 * file handle needs to be idle before attempting to close it. A setting of 0 2940 * means that idle handles are not closed., an integer between 0 and 100000; 2941 * default \c 30.} 2942 * @config{ close_scan_interval, interval 2943 * in seconds at which to check for files that are inactive and close them., an 2944 * integer between 1 and 100000; default \c 10.} 2945 * @config{ ),,} 2946 * @config{in_memory, keep data in-memory only. See @ref in_memory for more 2947 * information., a boolean flag; default \c false.} 2948 * @config{log = (, enable logging. Enabling logging uses three sessions from 2949 * the configured session_max., a set of related configuration options defined 2950 * below.} 2951 * @config{ archive, automatically archive 2952 * unneeded log files., a boolean flag; default \c true.} 2953 * @config{ compressor, configure a compressor for log 2954 * records. Permitted values are \c "none" or custom compression engine name 2955 * created with WT_CONNECTION::add_compressor. If WiredTiger has builtin 2956 * support for \c "lz4"\, \c "snappy"\, \c "zlib" or \c "zstd" compression\, 2957 * these names are also available. See @ref compression for more information., 2958 * a string; default \c none.} 2959 * @config{ enabled, enable 2960 * logging subsystem., a boolean flag; default \c false.} 2961 * @config{ file_max, the maximum size of log files., an 2962 * integer between 100KB and 2GB; default \c 100MB.} 2963 * @config{ path, the name of a directory into which log 2964 * files are written. The directory must already exist. If the value is not an 2965 * absolute path\, the path is relative to the database home (see @ref 2966 * absolute_path for more information)., a string; default \c ".".} 2967 * @config{ prealloc, pre-allocate log files., a boolean 2968 * flag; default \c true.} 2969 * @config{ recover, run recovery 2970 * or error if recovery needs to run after an unclean shutdown., a string\, 2971 * chosen from the following options: \c "error"\, \c "on"; default \c on.} 2972 * @config{ zero_fill, manually write zeroes into log 2973 * files., a boolean flag; default \c false.} 2974 * @config{ ),,} 2975 * @config{lsm_manager = (, configure database wide options for LSM tree 2976 * management. The LSM manager is started automatically the first time an LSM 2977 * tree is opened. The LSM manager uses a session from the configured 2978 * session_max., a set of related configuration options defined below.} 2979 * @config{ merge, merge LSM chunks where possible., a 2980 * boolean flag; default \c true.} 2981 * @config{ worker_thread_max, Configure a set of threads 2982 * to manage merging LSM trees in the database. Each worker thread uses a 2983 * session handle from the configured session_max., an integer between 3 and 20; 2984 * default \c 4.} 2985 * @config{ ),,} 2986 * @config{mmap, Use memory mapping to access files when possible., a boolean 2987 * flag; default \c true.} 2988 * @config{multiprocess, permit sharing between processes (will automatically 2989 * start an RPC server for primary processes and use RPC for secondary 2990 * processes). <b>Not yet supported in WiredTiger</b>., a boolean flag; default 2991 * \c false.} 2992 * @config{operation_tracking = (, enable tracking of performance-critical 2993 * functions. See @ref operation_tracking for more information., a set of 2994 * related configuration options defined below.} 2995 * @config{ enabled, enable operation tracking 2996 * subsystem., a boolean flag; default \c false.} 2997 * @config{ path, the name of a directory into which 2998 * operation tracking files are written. The directory must already exist. If 2999 * the value is not an absolute path\, the path is relative to the database home 3000 * (see @ref absolute_path for more information)., a string; default \c ".".} 3001 * @config{ ),,} 3002 * @config{readonly, open connection in read-only mode. The database must 3003 * exist. All methods that may modify a database are disabled. See @ref 3004 * readonly for more information., a boolean flag; default \c false.} 3005 * @config{salvage, open connection and salvage any WiredTiger-owned database 3006 * and log files that it detects as corrupted. This API should only be used 3007 * after getting an error return of WT_TRY_SALVAGE. Salvage rebuilds files in 3008 * place\, overwriting existing files. We recommend making a backup copy of all 3009 * files with the WiredTiger prefix prior to passing this flag., a boolean flag; 3010 * default \c false.} 3011 * @config{session_max, maximum expected number of sessions (including server 3012 * threads)., an integer greater than or equal to 1; default \c 100.} 3013 * @config{shared_cache = (, shared cache configuration options. A database 3014 * should configure either a cache_size or a shared_cache not both. Enabling a 3015 * shared cache uses a session from the configured session_max. A shared cache 3016 * can not have absolute values configured for cache eviction settings., a set 3017 * of related configuration options defined below.} 3018 * @config{ chunk, the granularity that a shared cache is 3019 * redistributed., an integer between 1MB and 10TB; default \c 10MB.} 3020 * @config{ name, the name of a cache that is shared 3021 * between databases or \c "none" when no shared cache is configured., a string; 3022 * default \c none.} 3023 * @config{ quota, maximum size of 3024 * cache this database can be allocated from the shared cache. Defaults to the 3025 * entire shared cache size., an integer; default \c 0.} 3026 * @config{ reserve, amount of cache this database is 3027 * guaranteed to have available from the shared cache. This setting is per 3028 * database. Defaults to the chunk size., an integer; default \c 0.} 3029 * @config{ size, maximum memory to allocate for the 3030 * shared cache. Setting this will update the value if one is already set., an 3031 * integer between 1MB and 10TB; default \c 500MB.} 3032 * @config{ ),,} 3033 * @config{statistics, Maintain database statistics\, which may impact 3034 * performance. Choosing "all" maintains all statistics regardless of cost\, 3035 * "fast" maintains a subset of statistics that are relatively inexpensive\, 3036 * "none" turns off all statistics. The "clear" configuration resets statistics 3037 * after they are gathered\, where appropriate (for example\, a cache size 3038 * statistic is not cleared\, while the count of cursor insert operations will 3039 * be cleared). When "clear" is configured for the database\, gathered 3040 * statistics are reset each time a statistics cursor is used to gather 3041 * statistics\, as well as each time statistics are logged using the \c 3042 * statistics_log configuration. See @ref statistics for more information., a 3043 * list\, with values chosen from the following options: \c "all"\, \c 3044 * "cache_walk"\, \c "fast"\, \c "none"\, \c "clear"\, \c "tree_walk"; default 3045 * \c none.} 3046 * @config{statistics_log = (, log any statistics the database is configured to 3047 * maintain\, to a file. See @ref statistics for more information. Enabling 3048 * the statistics log server uses a session from the configured session_max., a 3049 * set of related configuration options defined below.} 3050 * @config{ json, encode statistics in JSON format., a 3051 * boolean flag; default \c false.} 3052 * @config{ on_close, 3053 * log statistics on database close., a boolean flag; default \c false.} 3054 * @config{ path, the name of a directory into which 3055 * statistics files are written. The directory must already exist. If the 3056 * value is not an absolute path\, the path is relative to the database home 3057 * (see @ref absolute_path for more information)., a string; default \c ".".} 3058 * @config{ sources, if non-empty\, include statistics 3059 * for the list of data source URIs\, if they are open at the time of the 3060 * statistics logging. The list may include URIs matching a single data source 3061 * ("table:mytable")\, or a URI matching all data sources of a particular type 3062 * ("table:")., a list of strings; default empty.} 3063 * @config{ timestamp, a timestamp prepended to each log 3064 * record\, may contain strftime conversion specifications\, when \c json is 3065 * configured\, defaults to \c "%FT%Y.000Z"., a string; default \c "%b %d 3066 * %H:%M:%S".} 3067 * @config{ wait, seconds to wait between 3068 * each write of the log records; setting this value above 0 configures 3069 * statistics logging., an integer between 0 and 100000; default \c 0.} 3070 * @config{ 3071 * ),,} 3072 * @config{transaction_sync = (, how to sync log records when the transaction 3073 * commits., a set of related configuration options defined below.} 3074 * @config{ enabled, whether to sync the log on every 3075 * commit by default\, can be overridden by the \c sync setting to 3076 * WT_SESSION::commit_transaction., a boolean flag; default \c false.} 3077 * @config{ method, the method used to ensure log records 3078 * are stable on disk\, see @ref tune_durability for more information., a 3079 * string\, chosen from the following options: \c "dsync"\, \c "fsync"\, \c 3080 * "none"; default \c fsync.} 3081 * @config{ ),,} 3082 * @config{use_environment, use the \c WIREDTIGER_CONFIG and \c WIREDTIGER_HOME 3083 * environment variables if the process is not running with special privileges. 3084 * See @ref home for more information., a boolean flag; default \c true.} 3085 * @config{use_environment_priv, use the \c WIREDTIGER_CONFIG and \c 3086 * WIREDTIGER_HOME environment variables even if the process is running with 3087 * special privileges. See @ref home for more information., a boolean flag; 3088 * default \c false.} 3089 * @config{verbose, enable messages for various events. Options are given as a 3090 * list\, such as <code>"verbose=[evictserver\,read]"</code>., a list\, with 3091 * values chosen from the following options: \c "api"\, \c "block"\, \c 3092 * "checkpoint"\, \c "checkpoint_progress"\, \c "compact"\, \c "error_returns"\, 3093 * \c "evict"\, \c "evict_stuck"\, \c "evictserver"\, \c "fileops"\, \c 3094 * "handleops"\, \c "log"\, \c "lookaside"\, \c "lookaside_activity"\, \c 3095 * "lsm"\, \c "lsm_manager"\, \c "metadata"\, \c "mutex"\, \c "overflow"\, \c 3096 * "read"\, \c "rebalance"\, \c "reconcile"\, \c "recovery"\, \c 3097 * "recovery_progress"\, \c "salvage"\, \c "shared_cache"\, \c "split"\, \c 3098 * "temporary"\, \c "thread_group"\, \c "timestamp"\, \c "transaction"\, \c 3099 * "verify"\, \c "version"\, \c "write"; default empty.} 3100 * @config{write_through, Use \c FILE_FLAG_WRITE_THROUGH on Windows to write to 3101 * files. Ignored on non-Windows systems. Options are given as a list\, such 3102 * as <code>"write_through=[data]"</code>. Configuring \c write_through requires 3103 * care\, see @ref tuning_system_buffer_cache_direct_io for important warnings. 3104 * Including \c "data" will cause WiredTiger data files to write through cache\, 3105 * including \c "log" will cause WiredTiger log files to write through cache. 3106 * \c write_through should be combined with \c direct_io to get the equivalent 3107 * of POSIX \c O_DIRECT on Windows., a list\, with values chosen from the 3108 * following options: \c "data"\, \c "log"; default empty.} 3109 * @configend 3110 * Additionally, if files named \c WiredTiger.config or \c WiredTiger.basecfg 3111 * appear in the WiredTiger home directory, they are read for configuration 3112 * values (see @ref config_file and @ref config_base for details). 3113 * See @ref config_order for ordering of the configuration mechanisms. 3114 * @param[out] connectionp A pointer to the newly opened connection handle 3115 * @errors 3116 */ 3117int wiredtiger_open(const char *home, 3118 WT_EVENT_HANDLER *event_handler, const char *config, 3119 WT_CONNECTION **connectionp) WT_ATTRIBUTE_LIBRARY_VISIBLE; 3120 3121/*! 3122 * Return information about a WiredTiger error as a string (see 3123 * WT_SESSION::strerror for a thread-safe API). 3124 * 3125 * @snippet ex_all.c Display an error 3126 * 3127 * @param error a return value from a WiredTiger, ISO C, or POSIX standard API 3128 * @returns a string representation of the error 3129 */ 3130const char *wiredtiger_strerror(int error) WT_ATTRIBUTE_LIBRARY_VISIBLE; 3131 3132#if !defined(SWIG) 3133/*! 3134 * The interface implemented by applications to accept notifications 3135 * of the completion of asynchronous operations. 3136 * 3137 * Applications register their implementation with WiredTiger by calling 3138 * WT_CONNECTION::async_new_op. 3139 * 3140 * @snippet ex_async.c async handle allocation 3141 */ 3142struct __wt_async_callback { 3143 /*! 3144 * Callback to receive completion notification. 3145 * 3146 * @param[in] op the operation handle 3147 * @param[in] op_ret the result of the async operation 3148 * @param[in] flags currently unused 3149 * @returns zero for success, non-zero to indicate an error. 3150 * 3151 * @snippet ex_async.c async example callback implementation 3152 */ 3153 int (*notify)(WT_ASYNC_CALLBACK *cb, WT_ASYNC_OP *op, 3154 int op_ret, uint32_t flags); 3155}; 3156#endif 3157 3158/*! 3159 * The interface implemented by applications to handle error, informational and 3160 * progress messages. Entries set to NULL are ignored and the default handlers 3161 * will continue to be used. 3162 */ 3163struct __wt_event_handler { 3164 /*! 3165 * Callback to handle error messages; by default, error messages are 3166 * written to the stderr stream. See @ref event_message_handling for 3167 * more information. 3168 * 3169 * Errors that require the application to exit and restart will have 3170 * their \c error value set to \c WT_PANIC. The application can exit 3171 * immediately when \c WT_PANIC is passed to an event handler, there 3172 * is no reason to return into WiredTiger. 3173 * 3174 * Event handler returns are not ignored: if the handler returns 3175 * non-zero, the error may cause the WiredTiger function posting the 3176 * event to fail, and may even cause operation or library failure. 3177 * 3178 * @param session the WiredTiger session handle in use when the error 3179 * was generated. The handle may have been created by the application 3180 * or automatically by WiredTiger. 3181 * @param error a return value from a WiredTiger, ISO C, or 3182 * POSIX standard API, which can be converted to a string using 3183 * WT_SESSION::strerror 3184 * @param message an error string 3185 */ 3186 int (*handle_error)(WT_EVENT_HANDLER *handler, 3187 WT_SESSION *session, int error, const char *message); 3188 3189 /*! 3190 * Callback to handle informational messages; by default, informational 3191 * messages are written to the stdout stream. See 3192 * @ref event_message_handling for more information. 3193 * 3194 * Message handler returns are not ignored: if the handler returns 3195 * non-zero, the error may cause the WiredTiger function posting the 3196 * event to fail, and may even cause operation or library failure. 3197 * 3198 * @param session the WiredTiger session handle in use when the message 3199 * was generated. The handle may have been created by the application 3200 * or automatically by WiredTiger. 3201 * @param message an informational string 3202 */ 3203 int (*handle_message)(WT_EVENT_HANDLER *handler, 3204 WT_SESSION *session, const char *message); 3205 3206 /*! 3207 * Callback to handle progress messages; by default, progress messages 3208 * are not written. See @ref event_message_handling for more 3209 * information. 3210 * 3211 * Progress handler returns are not ignored: if the handler returns 3212 * non-zero, the error may cause the WiredTiger function posting the 3213 * event to fail, and may even cause operation or library failure. 3214 * 3215 * @param session the WiredTiger session handle in use when the 3216 * progress message was generated. The handle may have been created by 3217 * the application or automatically by WiredTiger. 3218 * @param operation a string representation of the operation 3219 * @param progress a counter 3220 */ 3221 int (*handle_progress)(WT_EVENT_HANDLER *handler, 3222 WT_SESSION *session, const char *operation, uint64_t progress); 3223 3224 /*! 3225 * Callback to handle automatic close of a WiredTiger handle. 3226 * 3227 * Close handler returns are not ignored: if the handler returns 3228 * non-zero, the error may cause the WiredTiger function posting the 3229 * event to fail, and may even cause operation or library failure. 3230 * 3231 * @param session The session handle that is being closed if the 3232 * cursor parameter is NULL. 3233 * @param cursor The cursor handle that is being closed, or NULL if 3234 * it is a session handle being closed. 3235 */ 3236 int (*handle_close)(WT_EVENT_HANDLER *handler, 3237 WT_SESSION *session, WT_CURSOR *cursor); 3238}; 3239 3240/*! 3241 * @name Data packing and unpacking 3242 * @{ 3243 */ 3244 3245/*! 3246 * Pack a structure into a buffer. 3247 * 3248 * See @ref packing for a description of the permitted format strings. 3249 * 3250 * @section pack_examples Packing Examples 3251 * 3252 * For example, the string <code>"iSh"</code> will pack a 32-bit integer 3253 * followed by a NUL-terminated string, followed by a 16-bit integer. The 3254 * default, big-endian encoding will be used, with no alignment. This could be 3255 * used in C as follows: 3256 * 3257 * @snippet ex_all.c Pack fields into a buffer 3258 * 3259 * Then later, the values can be unpacked as follows: 3260 * 3261 * @snippet ex_all.c Unpack fields from a buffer 3262 * 3263 * @param session the session handle 3264 * @param buffer a pointer to a packed byte array 3265 * @param len the number of valid bytes in the buffer 3266 * @param format the data format, see @ref packing 3267 * @errors 3268 */ 3269int wiredtiger_struct_pack(WT_SESSION *session, 3270 void *buffer, size_t len, const char *format, ...) 3271 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3272 3273/*! 3274 * Calculate the size required to pack a structure. 3275 * 3276 * Note that for variable-sized fields including variable-sized strings and 3277 * integers, the calculated sized merely reflects the expected sizes specified 3278 * in the format string itself. 3279 * 3280 * @snippet ex_all.c Get the packed size 3281 * 3282 * @param session the session handle 3283 * @param lenp a location where the number of bytes needed for the 3284 * matching call to ::wiredtiger_struct_pack is returned 3285 * @param format the data format, see @ref packing 3286 * @errors 3287 */ 3288int wiredtiger_struct_size(WT_SESSION *session, 3289 size_t *lenp, const char *format, ...) WT_ATTRIBUTE_LIBRARY_VISIBLE; 3290 3291/*! 3292 * Unpack a structure from a buffer. 3293 * 3294 * Reverse of ::wiredtiger_struct_pack: gets values out of a 3295 * packed byte string. 3296 * 3297 * @snippet ex_all.c Unpack fields from a buffer 3298 * 3299 * @param session the session handle 3300 * @param buffer a pointer to a packed byte array 3301 * @param len the number of valid bytes in the buffer 3302 * @param format the data format, see @ref packing 3303 * @errors 3304 */ 3305int wiredtiger_struct_unpack(WT_SESSION *session, 3306 const void *buffer, size_t len, const char *format, ...) 3307 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3308 3309#if !defined(SWIG) 3310 3311/*! 3312 * Streaming interface to packing. 3313 * 3314 * This allows applications to pack or unpack records one field at a time. 3315 * This is an opaque handle returned by ::wiredtiger_pack_start or 3316 * ::wiredtiger_unpack_start. It must be closed with ::wiredtiger_pack_close. 3317 */ 3318typedef struct __wt_pack_stream WT_PACK_STREAM; 3319 3320/*! 3321 * Start a packing operation into a buffer with the given format string. This 3322 * should be followed by a series of calls to ::wiredtiger_pack_item, 3323 * ::wiredtiger_pack_int, ::wiredtiger_pack_str or ::wiredtiger_pack_uint 3324 * to fill in the values. 3325 * 3326 * @param session the session handle 3327 * @param format the data format, see @ref packing 3328 * @param buffer a pointer to memory to hold the packed data 3329 * @param size the size of the buffer 3330 * @param[out] psp the new packing stream handle 3331 * @errors 3332 */ 3333int wiredtiger_pack_start(WT_SESSION *session, 3334 const char *format, void *buffer, size_t size, WT_PACK_STREAM **psp) 3335 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3336 3337/*! 3338 * Start an unpacking operation from a buffer with the given format string. 3339 * This should be followed by a series of calls to ::wiredtiger_unpack_item, 3340 * ::wiredtiger_unpack_int, ::wiredtiger_unpack_str or ::wiredtiger_unpack_uint 3341 * to retrieve the packed values. 3342 * 3343 * @param session the session handle 3344 * @param format the data format, see @ref packing 3345 * @param buffer a pointer to memory holding the packed data 3346 * @param size the size of the buffer 3347 * @param[out] psp the new packing stream handle 3348 * @errors 3349 */ 3350int wiredtiger_unpack_start(WT_SESSION *session, 3351 const char *format, const void *buffer, size_t size, WT_PACK_STREAM **psp) 3352 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3353 3354/*! 3355 * Close a packing stream. 3356 * 3357 * @param ps the packing stream handle 3358 * @param[out] usedp the number of bytes in the buffer used by the stream 3359 * @errors 3360 */ 3361int wiredtiger_pack_close(WT_PACK_STREAM *ps, size_t *usedp) 3362 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3363 3364/*! 3365 * Pack an item into a packing stream. 3366 * 3367 * @param ps the packing stream handle 3368 * @param item an item to pack 3369 * @errors 3370 */ 3371int wiredtiger_pack_item(WT_PACK_STREAM *ps, WT_ITEM *item) 3372 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3373 3374/*! 3375 * Pack a signed integer into a packing stream. 3376 * 3377 * @param ps the packing stream handle 3378 * @param i a signed integer to pack 3379 * @errors 3380 */ 3381int wiredtiger_pack_int(WT_PACK_STREAM *ps, int64_t i) 3382 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3383 3384/*! 3385 * Pack a string into a packing stream. 3386 * 3387 * @param ps the packing stream handle 3388 * @param s a string to pack 3389 * @errors 3390 */ 3391int wiredtiger_pack_str(WT_PACK_STREAM *ps, const char *s) 3392 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3393 3394/*! 3395 * Pack an unsigned integer into a packing stream. 3396 * 3397 * @param ps the packing stream handle 3398 * @param u an unsigned integer to pack 3399 * @errors 3400 */ 3401int wiredtiger_pack_uint(WT_PACK_STREAM *ps, uint64_t u) 3402 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3403 3404/*! 3405 * Unpack an item from a packing stream. 3406 * 3407 * @param ps the packing stream handle 3408 * @param item an item to unpack 3409 * @errors 3410 */ 3411int wiredtiger_unpack_item(WT_PACK_STREAM *ps, WT_ITEM *item) 3412 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3413 3414/*! 3415 * Unpack a signed integer from a packing stream. 3416 * 3417 * @param ps the packing stream handle 3418 * @param[out] ip the unpacked signed integer 3419 * @errors 3420 */ 3421int wiredtiger_unpack_int(WT_PACK_STREAM *ps, int64_t *ip) 3422 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3423 3424/*! 3425 * Unpack a string from a packing stream. 3426 * 3427 * @param ps the packing stream handle 3428 * @param[out] sp the unpacked string 3429 * @errors 3430 */ 3431int wiredtiger_unpack_str(WT_PACK_STREAM *ps, const char **sp) 3432 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3433 3434/*! 3435 * Unpack an unsigned integer from a packing stream. 3436 * 3437 * @param ps the packing stream handle 3438 * @param[out] up the unpacked unsigned integer 3439 * @errors 3440 */ 3441int wiredtiger_unpack_uint(WT_PACK_STREAM *ps, uint64_t *up) 3442 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3443/*! @} */ 3444 3445/*! 3446 * @name Configuration strings 3447 * @{ 3448 */ 3449 3450/*! 3451 * The configuration information returned by the WiredTiger configuration 3452 * parsing functions in the WT_EXTENSION_API and the public API. 3453 */ 3454struct __wt_config_item { 3455 /*! 3456 * The value of a configuration string. 3457 * 3458 * Regardless of the type of the configuration string (boolean, int, 3459 * list or string), the \c str field will reference the value of the 3460 * configuration string. 3461 * 3462 * The bytes referenced by \c str are <b>not</b> nul-terminated, 3463 * use the \c len field instead of a terminating nul byte. 3464 */ 3465 const char *str; 3466 3467 /*! The number of bytes in the value referenced by \c str. */ 3468 size_t len; 3469 3470 /*! 3471 * The numeric value of a configuration boolean or integer. 3472 * 3473 * If the configuration string's value is "true" or "false", the 3474 * \c val field will be set to 1 (true), or 0 (false). 3475 * 3476 * If the configuration string can be legally interpreted as an integer, 3477 * using the strtoll function rules as specified in ISO/IEC 9899:1990 3478 * ("ISO C90"), that integer will be stored in the \c val field. 3479 */ 3480 int64_t val; 3481 3482 /*! Permitted values of the \c type field. */ 3483 enum { 3484 /*! A string value with quotes stripped. */ 3485 WT_CONFIG_ITEM_STRING, 3486 /*! A boolean literal ("true" or "false"). */ 3487 WT_CONFIG_ITEM_BOOL, 3488 /*! An unquoted identifier: a string value without quotes. */ 3489 WT_CONFIG_ITEM_ID, 3490 /*! A numeric value. */ 3491 WT_CONFIG_ITEM_NUM, 3492 /*! A nested structure or list, including brackets. */ 3493 WT_CONFIG_ITEM_STRUCT 3494 } 3495 /*! 3496 * The type of value determined by the parser. In all cases, 3497 * the \c str and \c len fields are set. 3498 */ 3499 type; 3500}; 3501 3502#if !defined(SWIG) && !defined(DOXYGEN) 3503/*! 3504 * Validate a configuration string for a WiredTiger API. 3505 * This API is outside the scope of a WiredTiger connection handle, since 3506 * applications may need to validate configuration strings prior to calling 3507 * ::wiredtiger_open. 3508 * @param session the session handle (may be \c NULL if the database not yet 3509 * opened). 3510 * @param event_handler An event handler (used if \c session is \c NULL; if both 3511 * \c session and \c event_handler are \c NULL, error messages will be written 3512 * to stderr). 3513 * @param name the WiredTiger function or method to validate. 3514 * @param config the configuration string being parsed. 3515 * @returns zero for success, non-zero to indicate an error. 3516 * 3517 * @snippet ex_all.c Validate a configuration string 3518 */ 3519int wiredtiger_config_validate(WT_SESSION *session, 3520 WT_EVENT_HANDLER *event_handler, const char *name, const char *config) 3521 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3522#endif 3523 3524/*! 3525 * Create a handle that can be used to parse or create configuration strings 3526 * compatible with WiredTiger APIs. 3527 * This API is outside the scope of a WiredTiger connection handle, since 3528 * applications may need to generate configuration strings prior to calling 3529 * ::wiredtiger_open. 3530 * @param session the session handle to be used for error reporting (if NULL, 3531 * error messages will be written to stderr). 3532 * @param config the configuration string being parsed. The string must 3533 * remain valid for the lifetime of the parser handle. 3534 * @param len the number of valid bytes in \c config 3535 * @param[out] config_parserp A pointer to the newly opened handle 3536 * @errors 3537 * 3538 * @snippet ex_config_parse.c Create a configuration parser 3539 */ 3540int wiredtiger_config_parser_open(WT_SESSION *session, 3541 const char *config, size_t len, WT_CONFIG_PARSER **config_parserp) 3542 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3543 3544/*! 3545 * A handle that can be used to search and traverse configuration strings 3546 * compatible with WiredTiger APIs. 3547 * To parse the contents of a list or nested configuration string use a new 3548 * configuration parser handle based on the content of the ::WT_CONFIG_ITEM 3549 * retrieved from the parent configuration string. 3550 * 3551 * @section config_parse_examples Configuration String Parsing examples 3552 * 3553 * This could be used in C to create a configuration parser as follows: 3554 * 3555 * @snippet ex_config_parse.c Create a configuration parser 3556 * 3557 * Once the parser has been created the content can be queried directly: 3558 * 3559 * @snippet ex_config_parse.c get 3560 * 3561 * Or the content can be traversed linearly: 3562 * 3563 * @snippet ex_config_parse.c next 3564 * 3565 * Nested configuration values can be queried using a shorthand notation: 3566 * 3567 * @snippet ex_config_parse.c nested get 3568 * 3569 * Nested configuration values can be traversed using multiple 3570 * ::WT_CONFIG_PARSER handles: 3571 * 3572 * @snippet ex_config_parse.c nested traverse 3573 */ 3574struct __wt_config_parser { 3575 3576 /*! 3577 * Close the configuration scanner releasing any resources. 3578 * 3579 * @param config_parser the configuration parser handle 3580 * @errors 3581 * 3582 */ 3583 int __F(close)(WT_CONFIG_PARSER *config_parser); 3584 3585 /*! 3586 * Return the next key/value pair. 3587 * 3588 * If an item has no explicitly assigned value, the item will be 3589 * returned in \c key and the \c value will be set to the boolean 3590 * \c "true" value. 3591 * 3592 * @param config_parser the configuration parser handle 3593 * @param key the returned key 3594 * @param value the returned value 3595 * @errors 3596 * When iteration would pass the end of the configuration string 3597 * ::WT_NOTFOUND will be returned. 3598 */ 3599 int __F(next)(WT_CONFIG_PARSER *config_parser, 3600 WT_CONFIG_ITEM *key, WT_CONFIG_ITEM *value); 3601 3602 /*! 3603 * Return the value of an item in the configuration string. 3604 * 3605 * @param config_parser the configuration parser handle 3606 * @param key configuration key string 3607 * @param value the returned value 3608 * @errors 3609 * 3610 */ 3611 int __F(get)(WT_CONFIG_PARSER *config_parser, 3612 const char *key, WT_CONFIG_ITEM *value); 3613}; 3614 3615/*! @} */ 3616 3617/*! 3618 * @name Support functions 3619 * @anchor support_functions 3620 * @{ 3621 */ 3622 3623/*! 3624 * Return a pointer to a function that calculates a CRC32C checksum. 3625 * 3626 * The WiredTiger library CRC32C checksum function uses hardware support where 3627 * available, else it falls back to a software implementation. 3628 * 3629 * @snippet ex_all.c Checksum a buffer 3630 * 3631 * @returns a pointer to a function that takes a buffer and length and returns 3632 * the CRC32C checksum 3633 */ 3634uint32_t (*wiredtiger_crc32c_func(void))(const void *, size_t) 3635 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3636 3637#endif /* !defined(SWIG) */ 3638 3639/*! 3640 * Calculate a set of WT_MODIFY operations to represent an update. 3641 * This call will calculate a set of modifications to an old value that produce 3642 * the new value. If more modifications are required than fit in the array 3643 * passed in by the caller, or if more bytes have changed than the \c maxdiff 3644 * parameter, the call will fail. The matching algorithm is approximate, so it 3645 * may fail and return WT_NOTFOUND if a matching set of WT_MODIFY operations 3646 * is not found. 3647 * 3648 * The \c maxdiff parameter bounds how much work will be done searching for a 3649 * match: to ensure a match is found, it may need to be set larger than actual 3650 * number of bytes that differ between the old and new values. In particular, 3651 * repeated patterns of bytes in the values can lead to suboptimal matching, 3652 * and matching ranges less than 64 bytes long will not be detected. 3653 * 3654 * If the call succeeds, the WT_MODIFY operations will point into \c newv, 3655 * which must remain valid until WT_CURSOR::modify is called. 3656 * 3657 * @snippet ex_all.c Calculate a modify operation 3658 * 3659 * @param session the current WiredTiger session (may be NULL) 3660 * @param oldv old value 3661 * @param newv new value 3662 * @param maxdiff maximum bytes difference 3663 * @param[out] entries array of modifications producing the new value 3664 * @param[in,out] nentriesp size of \c entries array passed in, 3665 * set to the number of entries used 3666 * @errors 3667 */ 3668int wiredtiger_calc_modify(WT_SESSION *session, 3669 const WT_ITEM *oldv, const WT_ITEM *newv, 3670 size_t maxdiff, WT_MODIFY *entries, int *nentriesp) 3671 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3672 3673/*! 3674 * Get version information. 3675 * 3676 * @snippet ex_all.c Get the WiredTiger library version #1 3677 * @snippet ex_all.c Get the WiredTiger library version #2 3678 * 3679 * @param majorp a location where the major version number is returned 3680 * @param minorp a location where the minor version number is returned 3681 * @param patchp a location where the patch version number is returned 3682 * @returns a string representation of the version 3683 */ 3684const char *wiredtiger_version(int *majorp, int *minorp, int *patchp) 3685 WT_ATTRIBUTE_LIBRARY_VISIBLE; 3686 3687/*! @} */ 3688 3689/******************************************* 3690 * Error returns 3691 *******************************************/ 3692/*! 3693 * @name Error returns 3694 * Most functions and methods in WiredTiger return an integer code indicating 3695 * whether the operation succeeded or failed. A return of zero indicates 3696 * success, all non-zero return values indicate some kind of failure. 3697 * 3698 * WiredTiger reserves all values from -31,800 to -31,999 as possible error 3699 * return values. WiredTiger may also return C99/POSIX error codes such as 3700 * \c ENOMEM, \c EINVAL and \c ENOTSUP, with the usual meanings. 3701 * 3702 * The following are all of the WiredTiger-specific error returns: 3703 * @{ 3704 */ 3705/* 3706 * DO NOT EDIT: automatically built by dist/api_err.py. 3707 * Error return section: BEGIN 3708 */ 3709/*! 3710 * Conflict between concurrent operations. 3711 * This error is generated when an operation cannot be completed due to a 3712 * conflict with concurrent operations. The operation may be retried; if a 3713 * transaction is in progress, it should be rolled back and the operation 3714 * retried in a new transaction. 3715 */ 3716#define WT_ROLLBACK (-31800) 3717/*! 3718 * Attempt to insert an existing key. 3719 * This error is generated when the application attempts to insert a record with 3720 * the same key as an existing record without the 'overwrite' configuration to 3721 * WT_SESSION::open_cursor. 3722 */ 3723#define WT_DUPLICATE_KEY (-31801) 3724/*! 3725 * Non-specific WiredTiger error. 3726 * This error is returned when an error is not covered by a specific error 3727 * return. 3728 */ 3729#define WT_ERROR (-31802) 3730/*! 3731 * Item not found. 3732 * This error indicates an operation did not find a value to return. This 3733 * includes cursor search and other operations where no record matched the 3734 * cursor's search key such as WT_CURSOR::update or WT_CURSOR::remove. 3735 */ 3736#define WT_NOTFOUND (-31803) 3737/*! 3738 * WiredTiger library panic. 3739 * This error indicates an underlying problem that requires a database restart. 3740 * The application may exit immediately, no further WiredTiger calls are 3741 * required (and further calls will themselves immediately fail). 3742 */ 3743#define WT_PANIC (-31804) 3744/*! @cond internal */ 3745/*! Restart the operation (internal). */ 3746#define WT_RESTART (-31805) 3747/*! @endcond */ 3748/*! 3749 * Recovery must be run to continue. 3750 * This error is generated when wiredtiger_open is configured to return an error 3751 * if recovery is required to use the database. 3752 */ 3753#define WT_RUN_RECOVERY (-31806) 3754/*! 3755 * Operation would overflow cache. 3756 * This error is only generated when wiredtiger_open is configured to run in- 3757 * memory, and an insert or update operation requires more than the configured 3758 * cache size to complete. The operation may be retried; if a transaction is in 3759 * progress, it should be rolled back and the operation retried in a new 3760 * transaction. 3761 */ 3762#define WT_CACHE_FULL (-31807) 3763/*! 3764 * Conflict with a prepared update. 3765 * This error is generated when the application attempts to update an already 3766 * updated record which is in prepared state. An updated record will be in 3767 * prepared state, when the transaction that performed the update is in prepared 3768 * state. 3769 */ 3770#define WT_PREPARE_CONFLICT (-31808) 3771/*! 3772 * Database corruption detected. 3773 * This error is generated when corruption is detected in an on-disk file. The 3774 * application may choose to salvage the file or retry wiredtiger_open with the 3775 * 'salvage=true' configuration setting. 3776 */ 3777#define WT_TRY_SALVAGE (-31809) 3778/* 3779 * Error return section: END 3780 * DO NOT EDIT: automatically built by dist/api_err.py. 3781 */ 3782/*! @} */ 3783 3784#ifndef DOXYGEN 3785#define WT_DEADLOCK WT_ROLLBACK /* Backward compatibility */ 3786#endif 3787 3788/*! @} */ 3789 3790/*! 3791 * @defgroup wt_ext WiredTiger Extension API 3792 * The functions and interfaces applications use to customize and extend the 3793 * behavior of WiredTiger. 3794 * @{ 3795 */ 3796 3797/******************************************* 3798 * Forward structure declarations for the extension API 3799 *******************************************/ 3800struct __wt_config_arg; typedef struct __wt_config_arg WT_CONFIG_ARG; 3801 3802/*! 3803 * The interface implemented by applications to provide custom ordering of 3804 * records. 3805 * 3806 * Applications register their implementation with WiredTiger by calling 3807 * WT_CONNECTION::add_collator. See @ref custom_collators for more 3808 * information. 3809 * 3810 * @snippet ex_extending.c add collator nocase 3811 * 3812 * @snippet ex_extending.c add collator prefix10 3813 */ 3814struct __wt_collator { 3815 /*! 3816 * Callback to compare keys. 3817 * 3818 * @param[out] cmp set to -1 if <code>key1 < key2</code>, 3819 * 0 if <code>key1 == key2</code>, 3820 * 1 if <code>key1 > key2</code>. 3821 * @returns zero for success, non-zero to indicate an error. 3822 * 3823 * @snippet ex_all.c Implement WT_COLLATOR 3824 * 3825 * @snippet ex_extending.c case insensitive comparator 3826 * 3827 * @snippet ex_extending.c n character comparator 3828 */ 3829 int (*compare)(WT_COLLATOR *collator, WT_SESSION *session, 3830 const WT_ITEM *key1, const WT_ITEM *key2, int *cmp); 3831 3832 /*! 3833 * If non-NULL, this callback is called to customize the collator 3834 * for each data source. If the callback returns a non-NULL 3835 * collator, that instance is used instead of this one for all 3836 * comparisons. 3837 */ 3838 int (*customize)(WT_COLLATOR *collator, WT_SESSION *session, 3839 const char *uri, WT_CONFIG_ITEM *passcfg, WT_COLLATOR **customp); 3840 3841 /*! 3842 * If non-NULL a callback performed when the data source is closed 3843 * for customized extractors otherwise when the database is closed. 3844 * 3845 * The WT_COLLATOR::terminate callback is intended to allow cleanup, 3846 * the handle will not be subsequently accessed by WiredTiger. 3847 */ 3848 int (*terminate)(WT_COLLATOR *collator, WT_SESSION *session); 3849}; 3850 3851/*! 3852 * The interface implemented by applications to provide custom compression. 3853 * 3854 * Compressors must implement the WT_COMPRESSOR interface: the 3855 * WT_COMPRESSOR::compress and WT_COMPRESSOR::decompress callbacks must be 3856 * specified, and WT_COMPRESSOR::pre_size is optional. To build your own 3857 * compressor, use one of the compressors in \c ext/compressors as a template: 3858 * \c ext/nop_compress is a simple compressor that passes through data 3859 * unchanged, and is a reasonable starting point. 3860 * 3861 * Applications register their implementation with WiredTiger by calling 3862 * WT_CONNECTION::add_compressor. 3863 * 3864 * @snippet nop_compress.c WT_COMPRESSOR initialization structure 3865 * @snippet nop_compress.c WT_COMPRESSOR initialization function 3866 */ 3867struct __wt_compressor { 3868 /*! 3869 * Callback to compress a chunk of data. 3870 * 3871 * WT_COMPRESSOR::compress takes a source buffer and a destination 3872 * buffer, by default of the same size. If the callback can compress 3873 * the buffer to a smaller size in the destination, it does so, sets 3874 * the \c compression_failed return to 0 and returns 0. If compression 3875 * does not produce a smaller result, the callback sets the 3876 * \c compression_failed return to 1 and returns 0. If another 3877 * error occurs, it returns an errno or WiredTiger error code. 3878 * 3879 * On entry, \c src will point to memory, with the length of the memory 3880 * in \c src_len. After successful completion, the callback should 3881 * return \c 0 and set \c result_lenp to the number of bytes required 3882 * for the compressed representation. 3883 * 3884 * On entry, \c dst points to the destination buffer with a length 3885 * of \c dst_len. If the WT_COMPRESSOR::pre_size method is specified, 3886 * the destination buffer will be at least the size returned by that 3887 * method; otherwise, the destination buffer will be at least as large 3888 * as the length of the data to compress. 3889 * 3890 * If compression would not shrink the data or the \c dst buffer is not 3891 * large enough to hold the compressed data, the callback should set 3892 * \c compression_failed to a non-zero value and return 0. 3893 * 3894 * @param[in] src the data to compress 3895 * @param[in] src_len the length of the data to compress 3896 * @param[in] dst the destination buffer 3897 * @param[in] dst_len the length of the destination buffer 3898 * @param[out] result_lenp the length of the compressed data 3899 * @param[out] compression_failed non-zero if compression did not 3900 * decrease the length of the data (compression may not have completed) 3901 * @returns zero for success, non-zero to indicate an error. 3902 * 3903 * @snippet nop_compress.c WT_COMPRESSOR compress 3904 */ 3905 int (*compress)(WT_COMPRESSOR *compressor, WT_SESSION *session, 3906 uint8_t *src, size_t src_len, 3907 uint8_t *dst, size_t dst_len, 3908 size_t *result_lenp, int *compression_failed); 3909 3910 /*! 3911 * Callback to compress a list of byte strings. 3912 * 3913 * WT_COMPRESSOR::compress_raw gives applications fine-grained control 3914 * over disk block size when writing row-store or variable-length 3915 * column-store pages. Where this level of control is not required by 3916 * the underlying storage device, set the WT_COMPRESSOR::compress_raw 3917 * callback to \c NULL and WiredTiger will internally split each page 3918 * into blocks, each block then compressed by WT_COMPRESSOR::compress. 3919 * 3920 * WT_COMPRESSOR::compress_raw takes a source buffer and an array of 3921 * 0-based offsets of byte strings in that buffer. The callback then 3922 * encodes none, some or all of the byte strings and copies the encoded 3923 * representation into a destination buffer. The callback returns the 3924 * number of byte strings encoded and the bytes needed for the encoded 3925 * representation. The encoded representation has header information 3926 * prepended and is written as a block to the underlying file object. 3927 * 3928 * On entry, \c page_max is the configured maximum size for objects of 3929 * this type. (This value is provided for convenience, and will be 3930 * either the \c internal_page_max or \c leaf_page_max value specified 3931 * to WT_SESSION::create when the object was created.) 3932 * 3933 * On entry, \c split_pct is the configured Btree page split size for 3934 * this object. (This value is provided for convenience, and will be 3935 * the \c split_pct value specified to WT_SESSION::create when the 3936 * object was created.) 3937 * 3938 * On entry, \c extra is a count of additional bytes that will be added 3939 * to the encoded representation before it is written. In other words, 3940 * if the target write size is 8KB, the returned encoded representation 3941 * should be less than or equal to (8KB - \c extra). The method does 3942 * not need to skip bytes in the destination buffer based on \c extra, 3943 * the method should only use \c extra to decide how many bytes to store 3944 * into the destination buffer for its ideal block size. 3945 * 3946 * On entry, \c src points to the source buffer; \c offsets is an array 3947 * of \c slots 0-based offsets into \c src, where each offset is the 3948 * start of a byte string, except for the last offset, which is the 3949 * offset of the first byte past the end of the last byte string. (In 3950 * other words, <code>offsets[0]</code> will be 0, the offset of the 3951 * first byte of the first byte string in \c src, and 3952 * <code>offsets[slots]</code> is the total length of all of the byte 3953 * strings in the \c src buffer.) 3954 * 3955 * On entry, \c dst points to the destination buffer with a length 3956 * of \c dst_len. If the WT_COMPRESSOR::pre_size method is specified, 3957 * the destination buffer will be at least the size returned by that 3958 * method; otherwise, the destination buffer will be at least as large 3959 * as the length of the data to compress. 3960 * 3961 * After successful completion, the callback should return \c 0, and 3962 * set \c result_slotsp to the number of byte strings encoded and 3963 * \c result_lenp to the bytes needed for the encoded representation. 3964 * 3965 * There is no requirement the callback encode any or all of the byte 3966 * strings passed by WiredTiger. If the callback does not encode any 3967 * of the byte strings and compression should not be retried, the 3968 * callback should set \c result_slotsp to 0. 3969 * 3970 * If the callback does not encode any of the byte strings and 3971 * compression should be retried with additional byte strings, the 3972 * callback must return \c EAGAIN. In that case, WiredTiger will 3973 * accumulate more rows and repeat the call. 3974 * 3975 * If there are no more rows to accumulate or the callback indicates 3976 * that it cannot be retried, WiredTiger writes the remaining rows 3977 * using \c WT_COMPRESSOR::compress. 3978 * 3979 * On entry, \c final is zero if there are more rows to be written as 3980 * part of this page (if there will be additional data provided to the 3981 * callback), and non-zero if there are no more rows to be written as 3982 * part of this page. If \c final is set and the callback fails to 3983 * encode any rows, WiredTiger writes the remaining rows without further 3984 * calls to the callback. If \c final is set and the callback encodes 3985 * any number of rows, WiredTiger continues to call the callback until 3986 * all of the rows are encoded or the callback fails to encode any rows. 3987 * 3988 * The WT_COMPRESSOR::compress_raw callback is intended for applications 3989 * wanting to create disk blocks in specific sizes. 3990 * WT_COMPRESSOR::compress_raw is not a replacement for 3991 * WT_COMPRESSOR::compress: objects which WT_COMPRESSOR::compress_raw 3992 * cannot handle (for example, overflow key or value items), or which 3993 * WT_COMPRESSOR::compress_raw chooses not to compress for any reason 3994 * (for example, if WT_COMPRESSOR::compress_raw callback chooses not to 3995 * compress a small number of rows, but the page being written has no 3996 * more rows to accumulate), will be passed to WT_COMPRESSOR::compress. 3997 * 3998 * The WT_COMPRESSOR::compress_raw callback is only called for objects 3999 * where it is applicable, that is, for row-store and variable-length 4000 * column-store objects, where both row-store key prefix compression 4001 * and row-store and variable-length column-store dictionary compression 4002 * are \b not configured. When WT_COMPRESSOR::compress_raw is not 4003 * applicable, the WT_COMPRESSOR::compress callback is used instead. 4004 * 4005 * @param[in] page_max the configured maximum page size for this object 4006 * @param[in] split_pct the configured page split size for this object 4007 * @param[in] extra the count of the additional bytes 4008 * @param[in] src the data to compress 4009 * @param[in] offsets the byte offsets of the byte strings in src 4010 * @param[in] slots the number of entries in offsets 4011 * @param[in] dst the destination buffer 4012 * @param[in] dst_len the length of the destination buffer 4013 * @param[in] final non-zero if there are no more rows to accumulate 4014 * @param[out] result_lenp the length of the compressed data 4015 * @param[out] result_slotsp the number of byte offsets taken 4016 * @returns zero for success, non-zero to indicate an error. 4017 */ 4018 int (*compress_raw)(WT_COMPRESSOR *compressor, WT_SESSION *session, 4019 size_t page_max, int split_pct, size_t extra, 4020 uint8_t *src, uint32_t *offsets, uint32_t slots, 4021 uint8_t *dst, size_t dst_len, 4022 int final, 4023 size_t *result_lenp, uint32_t *result_slotsp); 4024 4025 /*! 4026 * Callback to decompress a chunk of data. 4027 * 4028 * WT_COMPRESSOR::decompress takes a source buffer and a destination 4029 * buffer. The contents are switched from \c compress: the 4030 * source buffer is the compressed value, and the destination buffer is 4031 * sized to be the original size. If the callback successfully 4032 * decompresses the source buffer to the destination buffer, it returns 4033 * 0. If an error occurs, it returns an errno or WiredTiger error code. 4034 * The source buffer that WT_COMPRESSOR::decompress takes may have a 4035 * size that is rounded up from the size originally produced by 4036 * WT_COMPRESSOR::compress, with the remainder of the buffer set to 4037 * zeroes. Most compressors do not care about this difference if the 4038 * size to be decompressed can be implicitly discovered from the 4039 * compressed data. If your compressor cares, you may need to allocate 4040 * space for, and store, the actual size in the compressed buffer. See 4041 * the source code for the included snappy compressor for an example. 4042 * 4043 * On entry, \c src will point to memory, with the length of the memory 4044 * in \c src_len. After successful completion, the callback should 4045 * return \c 0 and set \c result_lenp to the number of bytes required 4046 * for the decompressed representation. 4047 * 4048 * If the \c dst buffer is not big enough to hold the decompressed 4049 * data, the callback should return an error. 4050 * 4051 * @param[in] src the data to decompress 4052 * @param[in] src_len the length of the data to decompress 4053 * @param[in] dst the destination buffer 4054 * @param[in] dst_len the length of the destination buffer 4055 * @param[out] result_lenp the length of the decompressed data 4056 * @returns zero for success, non-zero to indicate an error. 4057 * 4058 * @snippet nop_compress.c WT_COMPRESSOR decompress 4059 */ 4060 int (*decompress)(WT_COMPRESSOR *compressor, WT_SESSION *session, 4061 uint8_t *src, size_t src_len, 4062 uint8_t *dst, size_t dst_len, 4063 size_t *result_lenp); 4064 4065 /*! 4066 * Callback to size a destination buffer for compression 4067 * 4068 * WT_COMPRESSOR::pre_size is an optional callback that, given the 4069 * source buffer and size, produces the size of the destination buffer 4070 * to be given to WT_COMPRESSOR::compress. This is useful for 4071 * compressors that assume that the output buffer is sized for the 4072 * worst case and thus no overrun checks are made. If your compressor 4073 * works like this, WT_COMPRESSOR::pre_size will need to be defined. 4074 * See the source code for the snappy compressor for an example. 4075 * However, if your compressor detects and avoids overruns against its 4076 * target buffer, you will not need to define WT_COMPRESSOR::pre_size. 4077 * When WT_COMPRESSOR::pre_size is set to NULL, the destination buffer 4078 * is sized the same as the source buffer. This is always sufficient, 4079 * since a compression result that is larger than the source buffer is 4080 * discarded by WiredTiger. 4081 * 4082 * If not NULL, this callback is called before each call to 4083 * WT_COMPRESSOR::compress to determine the size of the destination 4084 * buffer to provide. If the callback is NULL, the destination 4085 * buffer will be the same size as the source buffer. 4086 * 4087 * The callback should set \c result_lenp to a suitable buffer size 4088 * for compression, typically the maximum length required by 4089 * WT_COMPRESSOR::compress. 4090 * 4091 * This callback function is for compressors that require an output 4092 * buffer larger than the source buffer (for example, that do not 4093 * check for buffer overflow during compression). 4094 * 4095 * @param[in] src the data to compress 4096 * @param[in] src_len the length of the data to compress 4097 * @param[out] result_lenp the required destination buffer size 4098 * @returns zero for success, non-zero to indicate an error. 4099 * 4100 * @snippet nop_compress.c WT_COMPRESSOR presize 4101 */ 4102 int (*pre_size)(WT_COMPRESSOR *compressor, WT_SESSION *session, 4103 uint8_t *src, size_t src_len, size_t *result_lenp); 4104 4105 /*! 4106 * If non-NULL, a callback performed when the database is closed. 4107 * 4108 * The WT_COMPRESSOR::terminate callback is intended to allow cleanup, 4109 * the handle will not be subsequently accessed by WiredTiger. 4110 * 4111 * @snippet nop_compress.c WT_COMPRESSOR terminate 4112 */ 4113 int (*terminate)(WT_COMPRESSOR *compressor, WT_SESSION *session); 4114}; 4115 4116/*! 4117 * Applications can extend WiredTiger by providing new implementations of the 4118 * WT_DATA_SOURCE class. Each data source supports a different URI scheme for 4119 * data sources to WT_SESSION::create, WT_SESSION::open_cursor and related 4120 * methods. See @ref custom_data_sources for more information. 4121 * 4122 * <b>Thread safety:</b> WiredTiger may invoke methods on the WT_DATA_SOURCE 4123 * interface from multiple threads concurrently. It is the responsibility of 4124 * the implementation to protect any shared data. 4125 * 4126 * Applications register their implementation with WiredTiger by calling 4127 * WT_CONNECTION::add_data_source. 4128 * 4129 * @snippet ex_data_source.c WT_DATA_SOURCE register 4130 */ 4131struct __wt_data_source { 4132 /*! 4133 * Callback to alter an object. 4134 * 4135 * @snippet ex_data_source.c WT_DATA_SOURCE alter 4136 */ 4137 int (*alter)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4138 const char *uri, WT_CONFIG_ARG *config); 4139 4140 /*! 4141 * Callback to create a new object. 4142 * 4143 * @snippet ex_data_source.c WT_DATA_SOURCE create 4144 */ 4145 int (*create)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4146 const char *uri, WT_CONFIG_ARG *config); 4147 4148 /*! 4149 * Callback to compact an object. 4150 * 4151 * @snippet ex_data_source.c WT_DATA_SOURCE compact 4152 */ 4153 int (*compact)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4154 const char *uri, WT_CONFIG_ARG *config); 4155 4156 /*! 4157 * Callback to drop an object. 4158 * 4159 * @snippet ex_data_source.c WT_DATA_SOURCE drop 4160 */ 4161 int (*drop)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4162 const char *uri, WT_CONFIG_ARG *config); 4163 4164 /*! 4165 * Callback to initialize a cursor. 4166 * 4167 * @snippet ex_data_source.c WT_DATA_SOURCE open_cursor 4168 */ 4169 int (*open_cursor)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4170 const char *uri, WT_CONFIG_ARG *config, WT_CURSOR **new_cursor); 4171 4172 /*! 4173 * Callback to rename an object. 4174 * 4175 * @snippet ex_data_source.c WT_DATA_SOURCE rename 4176 */ 4177 int (*rename)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4178 const char *uri, const char *newuri, WT_CONFIG_ARG *config); 4179 4180 /*! 4181 * Callback to salvage an object. 4182 * 4183 * @snippet ex_data_source.c WT_DATA_SOURCE salvage 4184 */ 4185 int (*salvage)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4186 const char *uri, WT_CONFIG_ARG *config); 4187 4188 /*! 4189 * Callback to get the size of an object. 4190 * 4191 * @snippet ex_data_source.c WT_DATA_SOURCE size 4192 */ 4193 int (*size)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4194 const char *uri, wt_off_t *size); 4195 4196 /*! 4197 * Callback to truncate an object. 4198 * 4199 * @snippet ex_data_source.c WT_DATA_SOURCE truncate 4200 */ 4201 int (*truncate)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4202 const char *uri, WT_CONFIG_ARG *config); 4203 4204 /*! 4205 * Callback to truncate a range of an object. 4206 * 4207 * @snippet ex_data_source.c WT_DATA_SOURCE range truncate 4208 */ 4209 int (*range_truncate)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4210 WT_CURSOR *start, WT_CURSOR *stop); 4211 4212 /*! 4213 * Callback to verify an object. 4214 * 4215 * @snippet ex_data_source.c WT_DATA_SOURCE verify 4216 */ 4217 int (*verify)(WT_DATA_SOURCE *dsrc, WT_SESSION *session, 4218 const char *uri, WT_CONFIG_ARG *config); 4219 4220 /*! 4221 * Callback to checkpoint the database. 4222 * 4223 * @snippet ex_data_source.c WT_DATA_SOURCE checkpoint 4224 */ 4225 int (*checkpoint)( 4226 WT_DATA_SOURCE *dsrc, WT_SESSION *session, WT_CONFIG_ARG *config); 4227 4228 /*! 4229 * If non-NULL, a callback performed when the database is closed. 4230 * 4231 * The WT_DATA_SOURCE::terminate callback is intended to allow cleanup, 4232 * the handle will not be subsequently accessed by WiredTiger. 4233 * 4234 * @snippet ex_data_source.c WT_DATA_SOURCE terminate 4235 */ 4236 int (*terminate)(WT_DATA_SOURCE *dsrc, WT_SESSION *session); 4237 4238 /*! 4239 * If non-NULL, a callback performed before an LSM merge. 4240 * 4241 * @param[in] source a cursor configured with the data being merged 4242 * @param[in] dest a cursor on the new object being filled by the merge 4243 * 4244 * @snippet ex_data_source.c WT_DATA_SOURCE lsm_pre_merge 4245 */ 4246 int (*lsm_pre_merge)( 4247 WT_DATA_SOURCE *dsrc, WT_CURSOR *source, WT_CURSOR *dest); 4248}; 4249 4250/*! 4251 * The interface implemented by applications to provide custom encryption. 4252 * 4253 * Encryptors must implement the WT_ENCRYPTOR interface: the 4254 * WT_ENCRYPTOR::encrypt, WT_ENCRYPTOR::decrypt and WT_ENCRYPTOR::sizing 4255 * callbacks must be specified, WT_ENCRYPTOR::customize and 4256 * WT_ENCRYPTOR::terminate are optional. To build your own encryptor, use 4257 * one of the encryptors in \c ext/encryptors as a template: 4258 * \c ext/encryptors/nop_encrypt is a simple encryptor that passes through 4259 * data unchanged, and is a reasonable starting point; 4260 * \c ext/encryptors/rotn_encrypt is an encryptor implementing 4261 * a simple rotation cipher, it shows the use of \c keyid, \c secretkey, 4262 * and implements the WT_ENCRYPTOR::customize and 4263 * WT_ENCRYPTOR::terminate callbacks. 4264 * 4265 * Applications register their implementation with WiredTiger by calling 4266 * WT_CONNECTION::add_encryptor. 4267 * 4268 * @snippet nop_encrypt.c WT_ENCRYPTOR initialization structure 4269 * @snippet nop_encrypt.c WT_ENCRYPTOR initialization function 4270 */ 4271struct __wt_encryptor { 4272 /*! 4273 * Callback to encrypt a chunk of data. 4274 * 4275 * WT_ENCRYPTOR::encrypt takes a source buffer and a destination 4276 * buffer. The callback encrypts the source buffer (plain text) 4277 * into the destination buffer. 4278 * 4279 * On entry, \c src will point to memory, with the length of the memory 4280 * in \c src_len. After successful completion, the callback should 4281 * return \c 0 and set \c result_lenp to the number of bytes required 4282 * for the encrypted representation. 4283 * 4284 * On entry, \c dst points to the destination buffer with a length 4285 * of \c dst_len. The destination buffer will be at least src_len 4286 * plus the size returned by that WT_ENCRYPT::sizing. 4287 * 4288 * This callback cannot be NULL. 4289 * 4290 * @param[in] src the data to encrypt 4291 * @param[in] src_len the length of the data to encrypt 4292 * @param[in] dst the destination buffer 4293 * @param[in] dst_len the length of the destination buffer 4294 * @param[out] result_lenp the length of the encrypted data 4295 * @returns zero for success, non-zero to indicate an error. 4296 * 4297 * @snippet nop_encrypt.c WT_ENCRYPTOR encrypt 4298 */ 4299 int (*encrypt)(WT_ENCRYPTOR *encryptor, WT_SESSION *session, 4300 uint8_t *src, size_t src_len, 4301 uint8_t *dst, size_t dst_len, 4302 size_t *result_lenp); 4303 4304 /*! 4305 * Callback to decrypt a chunk of data. 4306 * 4307 * WT_ENCRYPTOR::decrypt takes a source buffer and a destination 4308 * buffer. The contents are switched from \c encrypt: the 4309 * source buffer is the encrypted value, and the destination buffer is 4310 * sized to be the original size. If the callback successfully 4311 * decrypts the source buffer to the destination buffer, it returns 4312 * 0. If an error occurs, it returns an errno or WiredTiger error code. 4313 * 4314 * On entry, \c src will point to memory, with the length of the memory 4315 * in \c src_len. After successful completion, the callback should 4316 * return \c 0 and set \c result_lenp to the number of bytes required 4317 * for the decrypted representation. 4318 * 4319 * If the \c dst buffer is not big enough to hold the decrypted 4320 * data, the callback should return an error. 4321 * 4322 * This callback cannot be NULL. 4323 * 4324 * @param[in] src the data to decrypt 4325 * @param[in] src_len the length of the data to decrypt 4326 * @param[in] dst the destination buffer 4327 * @param[in] dst_len the length of the destination buffer 4328 * @param[out] result_lenp the length of the decrypted data 4329 * @returns zero for success, non-zero to indicate an error. 4330 * 4331 * @snippet nop_encrypt.c WT_ENCRYPTOR decrypt 4332 */ 4333 int (*decrypt)(WT_ENCRYPTOR *encryptor, WT_SESSION *session, 4334 uint8_t *src, size_t src_len, 4335 uint8_t *dst, size_t dst_len, 4336 size_t *result_lenp); 4337 4338 /*! 4339 * Callback to size a destination buffer for encryption. 4340 * 4341 * WT_ENCRYPTOR::sizing is an callback that returns the number 4342 * of additional bytes that is needed when encrypting a 4343 * text buffer. This is always necessary, since encryptors 4344 * typically generate encrypted text that is larger than the 4345 * plain text input. Without such a call, WiredTiger would 4346 * have no way to know the worst case for the encrypted buffer size. 4347 * The WiredTiger encryption infrastructure assumes that 4348 * buffer sizing is not dependent on the number of bytes 4349 * of input, that there is a one to one relationship in number 4350 * of bytes needed between input and output. 4351 * 4352 * This callback cannot be NULL. 4353 * 4354 * The callback should set \c expansion_constantp to the additional 4355 * number of bytes needed. 4356 * 4357 * @param[out] expansion_constantp the additional number of bytes needed 4358 * when encrypting. 4359 * @returns zero for success, non-zero to indicate an error. 4360 * 4361 * @snippet nop_encrypt.c WT_ENCRYPTOR sizing 4362 */ 4363 int (*sizing)(WT_ENCRYPTOR *encryptor, WT_SESSION *session, 4364 size_t *expansion_constantp); 4365 4366 /*! 4367 * If non-NULL, this callback is called to customize the encryptor. 4368 * The customize function is called whenever a keyid is used for the 4369 * first time with this encryptor, whether it be in 4370 * the ::wiredtiger_open call or the WT_SESSION::create 4371 * call. This gives the algorithm an 4372 * opportunity to retrieve and save keys in a customized encryptor. 4373 * If the callback returns a non-NULL encryptor, that instance 4374 * is used instead of this one for any callbacks. 4375 * 4376 * @param[in] encrypt_config the "encryption" portion of the 4377 * configuration from the wiredtiger_open or WT_SESSION::create call 4378 * @param[out] customp the new modified encryptor, or NULL. 4379 * @returns zero for success, non-zero to indicate an error. 4380 */ 4381 int (*customize)(WT_ENCRYPTOR *encryptor, WT_SESSION *session, 4382 WT_CONFIG_ARG *encrypt_config, WT_ENCRYPTOR **customp); 4383 4384 /*! 4385 * If non-NULL, a callback performed when the database is closed. 4386 * It is called for each encryptor that was added using 4387 * WT_CONNECTION::add_encryptor or returned by the 4388 * WT_ENCRYPTOR::customize callback. 4389 * 4390 * The WT_ENCRYPTOR::terminate callback is intended to allow cleanup, 4391 * the handle will not be subsequently accessed by WiredTiger. 4392 * 4393 * @snippet nop_encrypt.c WT_ENCRYPTOR terminate 4394 */ 4395 int (*terminate)(WT_ENCRYPTOR *encryptor, WT_SESSION *session); 4396}; 4397 4398/*! 4399 * The interface implemented by applications to provide custom extraction of 4400 * index keys or column group values. 4401 * 4402 * Applications register implementations with WiredTiger by calling 4403 * WT_CONNECTION::add_extractor. See @ref custom_extractors for more 4404 * information. 4405 * 4406 * @snippet ex_all.c WT_EXTRACTOR register 4407 */ 4408struct __wt_extractor { 4409 /*! 4410 * Callback to extract a value for an index or column group. 4411 * 4412 * @errors 4413 * 4414 * @snippet ex_all.c WT_EXTRACTOR 4415 * 4416 * @param extractor the WT_EXTRACTOR implementation 4417 * @param session the current WiredTiger session 4418 * @param key the table key in raw format, see @ref cursor_raw for 4419 * details 4420 * @param value the table value in raw format, see @ref cursor_raw for 4421 * details 4422 * @param[out] result_cursor the method should call WT_CURSOR::set_key 4423 * and WT_CURSOR::insert on this cursor to return a key. The \c 4424 * key_format of the cursor will match that passed to 4425 * WT_SESSION::create for the index. Multiple index keys can be 4426 * created for each record by calling WT_CURSOR::insert multiple 4427 * times. 4428 */ 4429 int (*extract)(WT_EXTRACTOR *extractor, WT_SESSION *session, 4430 const WT_ITEM *key, const WT_ITEM *value, 4431 WT_CURSOR *result_cursor); 4432 4433 /*! 4434 * If non-NULL, this callback is called to customize the extractor for 4435 * each index. If the callback returns a non-NULL extractor, that 4436 * instance is used instead of this one for all comparisons. 4437 */ 4438 int (*customize)(WT_EXTRACTOR *extractor, WT_SESSION *session, 4439 const char *uri, WT_CONFIG_ITEM *appcfg, WT_EXTRACTOR **customp); 4440 4441 /*! 4442 * If non-NULL a callback performed when the index or column group 4443 * is closed for customized extractors otherwise when the database 4444 * is closed. 4445 * 4446 * The WT_EXTRACTOR::terminate callback is intended to allow cleanup, 4447 * the handle will not be subsequently accessed by WiredTiger. 4448 */ 4449 int (*terminate)(WT_EXTRACTOR *extractor, WT_SESSION *session); 4450}; 4451 4452#if !defined(SWIG) 4453/*! WT_FILE_SYSTEM::open_file file types */ 4454typedef enum { 4455 WT_FS_OPEN_FILE_TYPE_CHECKPOINT,/*!< open a data file checkpoint */ 4456 WT_FS_OPEN_FILE_TYPE_DATA, /*!< open a data file */ 4457 WT_FS_OPEN_FILE_TYPE_DIRECTORY, /*!< open a directory */ 4458 WT_FS_OPEN_FILE_TYPE_LOG, /*!< open a log file */ 4459 WT_FS_OPEN_FILE_TYPE_REGULAR /*!< open a regular file */ 4460} WT_FS_OPEN_FILE_TYPE; 4461 4462#ifdef DOXYGEN 4463/*! WT_FILE_SYSTEM::open_file flags: random access pattern */ 4464#define WT_FS_OPEN_ACCESS_RAND 0x0 4465/*! WT_FILE_SYSTEM::open_file flags: sequential access pattern */ 4466#define WT_FS_OPEN_ACCESS_SEQ 0x0 4467/*! WT_FILE_SYSTEM::open_file flags: create if does not exist */ 4468#define WT_FS_OPEN_CREATE 0x0 4469/*! WT_FILE_SYSTEM::open_file flags: direct I/O requested */ 4470#define WT_FS_OPEN_DIRECTIO 0x0 4471/*! WT_FILE_SYSTEM::open_file flags: file creation must be durable */ 4472#define WT_FS_OPEN_DURABLE 0x0 4473/*! 4474 * WT_FILE_SYSTEM::open_file flags: return EBUSY if exclusive use not available 4475 */ 4476#define WT_FS_OPEN_EXCLUSIVE 0x0 4477/*! WT_FILE_SYSTEM::open_file flags: open is read-only */ 4478#define WT_FS_OPEN_READONLY 0x0 4479 4480/*! 4481 * WT_FILE_SYSTEM::remove or WT_FILE_SYSTEM::rename flags: the remove or rename 4482 * operation must be durable 4483 */ 4484#define WT_FS_DURABLE 0x0 4485#else 4486/* AUTOMATIC FLAG VALUE GENERATION START */ 4487#define WT_FS_OPEN_ACCESS_RAND 0x01u 4488#define WT_FS_OPEN_ACCESS_SEQ 0x02u 4489#define WT_FS_OPEN_CREATE 0x04u 4490#define WT_FS_OPEN_DIRECTIO 0x08u 4491#define WT_FS_OPEN_DURABLE 0x10u 4492#define WT_FS_OPEN_EXCLUSIVE 0x20u 4493#define WT_FS_OPEN_FIXED 0x40u /* Path not home relative (internal) */ 4494#define WT_FS_OPEN_READONLY 0x80u 4495/* AUTOMATIC FLAG VALUE GENERATION STOP */ 4496 4497/* AUTOMATIC FLAG VALUE GENERATION START */ 4498#define WT_FS_DURABLE 0x1u 4499/* AUTOMATIC FLAG VALUE GENERATION STOP */ 4500#endif 4501 4502/*! 4503 * The interface implemented by applications to provide a custom file system 4504 * implementation. 4505 * 4506 * <b>Thread safety:</b> WiredTiger may invoke methods on the WT_FILE_SYSTEM 4507 * interface from multiple threads concurrently. It is the responsibility of 4508 * the implementation to protect any shared data. 4509 * 4510 * Applications register implementations with WiredTiger by calling 4511 * WT_CONNECTION::add_file_system. See @ref custom_file_systems for more 4512 * information. 4513 * 4514 * @snippet ex_file_system.c WT_FILE_SYSTEM register 4515 */ 4516struct __wt_file_system { 4517 /*! 4518 * Return a list of file names for the named directory. 4519 * 4520 * @errors 4521 * 4522 * @param file_system the WT_FILE_SYSTEM 4523 * @param session the current WiredTiger session 4524 * @param directory the name of the directory 4525 * @param prefix if not NULL, only files with names matching the prefix 4526 * are returned 4527 * @param[out] dirlist the method returns an allocated array of 4528 * individually allocated strings, one for each entry in the 4529 * directory. 4530 * @param[out] countp the number of entries returned 4531 */ 4532 int (*fs_directory_list)(WT_FILE_SYSTEM *file_system, 4533 WT_SESSION *session, const char *directory, const char *prefix, 4534 char ***dirlist, uint32_t *countp); 4535 4536#if !defined(DOXYGEN) 4537 /* 4538 * Return a single file name for the named directory. 4539 */ 4540 int (*fs_directory_list_single)(WT_FILE_SYSTEM *file_system, 4541 WT_SESSION *session, const char *directory, const char *prefix, 4542 char ***dirlist, uint32_t *countp); 4543#endif 4544 4545 /*! 4546 * Free memory allocated by WT_FILE_SYSTEM::directory_list. 4547 * 4548 * @errors 4549 * 4550 * @param file_system the WT_FILE_SYSTEM 4551 * @param session the current WiredTiger session 4552 * @param dirlist array returned by WT_FILE_SYSTEM::directory_list 4553 * @param count count returned by WT_FILE_SYSTEM::directory_list 4554 */ 4555 int (*fs_directory_list_free)(WT_FILE_SYSTEM *file_system, 4556 WT_SESSION *session, char **dirlist, uint32_t count); 4557 4558 /*! 4559 * Return if the named file system object exists. 4560 * 4561 * @errors 4562 * 4563 * @param file_system the WT_FILE_SYSTEM 4564 * @param session the current WiredTiger session 4565 * @param name the name of the file 4566 * @param[out] existp If the named file system object exists 4567 */ 4568 int (*fs_exist)(WT_FILE_SYSTEM *file_system, 4569 WT_SESSION *session, const char *name, bool *existp); 4570 4571 /*! 4572 * Open a handle for a named file system object 4573 * 4574 * The method should return ENOENT if the file is not being created and 4575 * does not exist. 4576 * 4577 * The method should return EACCES if the file cannot be opened in the 4578 * requested mode (for example, a file opened for writing in a readonly 4579 * file system). 4580 * 4581 * The method should return EBUSY if ::WT_FS_OPEN_EXCLUSIVE is set and 4582 * the file is in use. 4583 * 4584 * @errors 4585 * 4586 * @param file_system the WT_FILE_SYSTEM 4587 * @param session the current WiredTiger session 4588 * @param name the name of the file system object 4589 * @param file_type the type of the file 4590 * The file type is provided to allow optimization for different file 4591 * access patterns. 4592 * @param flags flags indicating how to open the file, one or more of 4593 * ::WT_FS_OPEN_CREATE, ::WT_FS_OPEN_DIRECTIO, ::WT_FS_OPEN_DURABLE, 4594 * ::WT_FS_OPEN_EXCLUSIVE or ::WT_FS_OPEN_READONLY. 4595 * @param[out] file_handlep the handle to the newly opened file. File 4596 * system implementations must allocate memory for the handle and 4597 * the WT_FILE_HANDLE::name field, and fill in the WT_FILE_HANDLE:: 4598 * fields. Applications wanting to associate private information 4599 * with the WT_FILE_HANDLE:: structure should declare and allocate 4600 * their own structure as a superset of a WT_FILE_HANDLE:: structure. 4601 */ 4602 int (*fs_open_file)(WT_FILE_SYSTEM *file_system, WT_SESSION *session, 4603 const char *name, WT_FS_OPEN_FILE_TYPE file_type, uint32_t flags, 4604 WT_FILE_HANDLE **file_handlep); 4605 4606 /*! 4607 * Remove a named file system object 4608 * 4609 * This method is not required for readonly file systems and should be 4610 * set to NULL when not required by the file system. 4611 * 4612 * @errors 4613 * 4614 * @param file_system the WT_FILE_SYSTEM 4615 * @param session the current WiredTiger session 4616 * @param name the name of the file system object 4617 * @param durable if the operation requires durability 4618 * @param flags 0 or ::WT_FS_DURABLE 4619 */ 4620 int (*fs_remove)(WT_FILE_SYSTEM *file_system, 4621 WT_SESSION *session, const char *name, uint32_t flags); 4622 4623 /*! 4624 * Rename a named file system object 4625 * 4626 * This method is not required for readonly file systems and should be 4627 * set to NULL when not required by the file system. 4628 * 4629 * @errors 4630 * 4631 * @param file_system the WT_FILE_SYSTEM 4632 * @param session the current WiredTiger session 4633 * @param from the original name of the object 4634 * @param to the new name for the object 4635 * @param flags 0 or ::WT_FS_DURABLE 4636 */ 4637 int (*fs_rename)(WT_FILE_SYSTEM *file_system, WT_SESSION *session, 4638 const char *from, const char *to, uint32_t flags); 4639 4640 /*! 4641 * Return the size of a named file system object 4642 * 4643 * @errors 4644 * 4645 * @param file_system the WT_FILE_SYSTEM 4646 * @param session the current WiredTiger session 4647 * @param name the name of the file system object 4648 * @param[out] sizep the size of the file system entry 4649 */ 4650 int (*fs_size)(WT_FILE_SYSTEM *file_system, 4651 WT_SESSION *session, const char *name, wt_off_t *sizep); 4652 4653 /*! 4654 * A callback performed when the file system is closed and will no 4655 * longer be accessed by the WiredTiger database. 4656 * 4657 * This method is not required and should be set to NULL when not 4658 * required by the file system. 4659 * 4660 * The WT_FILE_SYSTEM::terminate callback is intended to allow cleanup, 4661 * the handle will not be subsequently accessed by WiredTiger. 4662 */ 4663 int (*terminate)(WT_FILE_SYSTEM *file_system, WT_SESSION *session); 4664}; 4665 4666/*! WT_FILE_HANDLE::fadvise flags: no longer need */ 4667#define WT_FILE_HANDLE_DONTNEED 1 4668/*! WT_FILE_HANDLE::fadvise flags: will need */ 4669#define WT_FILE_HANDLE_WILLNEED 2 4670 4671/*! 4672 * A file handle implementation returned by WT_FILE_SYSTEM::open_file. 4673 * 4674 * <b>Thread safety:</b> Unless explicitly stated otherwise, WiredTiger may 4675 * invoke methods on the WT_FILE_HANDLE interface from multiple threads 4676 * concurrently. It is the responsibility of the implementation to protect 4677 * any shared data. 4678 * 4679 * See @ref custom_file_systems for more information. 4680 */ 4681struct __wt_file_handle { 4682 /*! 4683 * The enclosing file system, set by WT_FILE_SYSTEM::open_file. 4684 */ 4685 WT_FILE_SYSTEM *file_system; 4686 4687 /*! 4688 * The name of the file, set by WT_FILE_SYSTEM::open_file. 4689 */ 4690 char *name; 4691 4692 /*! 4693 * Close a file handle, the handle will not be further accessed by 4694 * WiredTiger. 4695 * 4696 * @errors 4697 * 4698 * @param file_handle the WT_FILE_HANDLE 4699 * @param session the current WiredTiger session 4700 */ 4701 int (*close)(WT_FILE_HANDLE *file_handle, WT_SESSION *session); 4702 4703 /*! 4704 * Indicate expected future use of file ranges, based on the POSIX 4705 * 1003.1 standard fadvise. 4706 * 4707 * This method is not required, and should be set to NULL when not 4708 * supported by the file. 4709 * 4710 * @errors 4711 * 4712 * @param file_handle the WT_FILE_HANDLE 4713 * @param session the current WiredTiger session 4714 * @param offset the file offset 4715 * @param len the size of the advisory 4716 * @param advice one of ::WT_FILE_HANDLE_WILLNEED or 4717 * ::WT_FILE_HANDLE_DONTNEED. 4718 */ 4719 int (*fh_advise)(WT_FILE_HANDLE *file_handle, 4720 WT_SESSION *session, wt_off_t offset, wt_off_t len, int advice); 4721 4722 /*! 4723 * Extend the file. 4724 * 4725 * This method is not required, and should be set to NULL when not 4726 * supported by the file. 4727 * 4728 * Any allocated disk space must read as 0 bytes, and no existing file 4729 * data may change. Allocating all necessary underlying storage (not 4730 * changing just the file's metadata), is likely to result in increased 4731 * performance. 4732 * 4733 * This method is not called by multiple threads concurrently (on the 4734 * same file handle). If the file handle's extension method supports 4735 * concurrent calls, set the WT_FILE_HANDLE::fh_extend_nolock method 4736 * instead. See @ref custom_file_systems for more information. 4737 * 4738 * @errors 4739 * 4740 * @param file_handle the WT_FILE_HANDLE 4741 * @param session the current WiredTiger session 4742 * @param offset desired file size after extension 4743 */ 4744 int (*fh_extend)( 4745 WT_FILE_HANDLE *file_handle, WT_SESSION *session, wt_off_t offset); 4746 4747 /*! 4748 * Extend the file. 4749 * 4750 * This method is not required, and should be set to NULL when not 4751 * supported by the file. 4752 * 4753 * Any allocated disk space must read as 0 bytes, and no existing file 4754 * data may change. Allocating all necessary underlying storage (not 4755 * only changing the file's metadata), is likely to result in increased 4756 * performance. 4757 * 4758 * This method may be called by multiple threads concurrently (on the 4759 * same file handle). If the file handle's extension method does not 4760 * support concurrent calls, set the WT_FILE_HANDLE::fh_extend method 4761 * instead. See @ref custom_file_systems for more information. 4762 * 4763 * @errors 4764 * 4765 * @param file_handle the WT_FILE_HANDLE 4766 * @param session the current WiredTiger session 4767 * @param offset desired file size after extension 4768 */ 4769 int (*fh_extend_nolock)( 4770 WT_FILE_HANDLE *file_handle, WT_SESSION *session, wt_off_t offset); 4771 4772 /*! 4773 * Lock/unlock a file from the perspective of other processes running 4774 * in the system, where necessary. 4775 * 4776 * @errors 4777 * 4778 * @param file_handle the WT_FILE_HANDLE 4779 * @param session the current WiredTiger session 4780 * @param lock whether to lock or unlock 4781 */ 4782 int (*fh_lock)( 4783 WT_FILE_HANDLE *file_handle, WT_SESSION *session, bool lock); 4784 4785 /*! 4786 * Map a file into memory, based on the POSIX 1003.1 standard mmap. 4787 * 4788 * This method is not required, and should be set to NULL when not 4789 * supported by the file. 4790 * 4791 * @errors 4792 * 4793 * @param file_handle the WT_FILE_HANDLE 4794 * @param session the current WiredTiger session 4795 * @param[out] mapped_regionp a reference to a memory location into 4796 * which should be stored a pointer to the start of the mapped region 4797 * @param[out] lengthp a reference to a memory location into which 4798 * should be stored the length of the region 4799 * @param[out] mapped_cookiep a reference to a memory location into 4800 * which can be optionally stored a pointer to an opaque cookie 4801 * which is subsequently passed to WT_FILE_HANDLE::unmap. 4802 */ 4803 int (*fh_map)(WT_FILE_HANDLE *file_handle, WT_SESSION *session, 4804 void *mapped_regionp, size_t *lengthp, void *mapped_cookiep); 4805 4806 /*! 4807 * Unmap part of a memory mapped file, based on the POSIX 1003.1 4808 * standard madvise. 4809 * 4810 * This method is not required, and should be set to NULL when not 4811 * supported by the file. 4812 * 4813 * @errors 4814 * 4815 * @param file_handle the WT_FILE_HANDLE 4816 * @param session the current WiredTiger session 4817 * @param map a location in the mapped region unlikely to be used in the 4818 * near future 4819 * @param length the length of the mapped region to discard 4820 * @param mapped_cookie any cookie set by the WT_FILE_HANDLE::map method 4821 */ 4822 int (*fh_map_discard)(WT_FILE_HANDLE *file_handle, 4823 WT_SESSION *session, void *map, size_t length, void *mapped_cookie); 4824 4825 /*! 4826 * Preload part of a memory mapped file, based on the POSIX 1003.1 4827 * standard madvise. 4828 * 4829 * This method is not required, and should be set to NULL when not 4830 * supported by the file. 4831 * 4832 * @errors 4833 * 4834 * @param file_handle the WT_FILE_HANDLE 4835 * @param session the current WiredTiger session 4836 * @param map a location in the mapped region likely to be used in the 4837 * near future 4838 * @param length the size of the mapped region to preload 4839 * @param mapped_cookie any cookie set by the WT_FILE_HANDLE::map method 4840 */ 4841 int (*fh_map_preload)(WT_FILE_HANDLE *file_handle, WT_SESSION *session, 4842 const void *map, size_t length, void *mapped_cookie); 4843 4844 /*! 4845 * Unmap a memory mapped file, based on the POSIX 1003.1 standard 4846 * munmap. 4847 * 4848 * This method is only required if a valid implementation of map is 4849 * provided by the file, and should be set to NULL otherwise. 4850 * 4851 * @errors 4852 * 4853 * @param file_handle the WT_FILE_HANDLE 4854 * @param session the current WiredTiger session 4855 * @param mapped_region a pointer to the start of the mapped region 4856 * @param length the length of the mapped region 4857 * @param mapped_cookie any cookie set by the WT_FILE_HANDLE::map method 4858 */ 4859 int (*fh_unmap)(WT_FILE_HANDLE *file_handle, WT_SESSION *session, 4860 void *mapped_region, size_t length, void *mapped_cookie); 4861 4862 /*! 4863 * Read from a file, based on the POSIX 1003.1 standard pread. 4864 * 4865 * @errors 4866 * 4867 * @param file_handle the WT_FILE_HANDLE 4868 * @param session the current WiredTiger session 4869 * @param offset the offset in the file to start reading from 4870 * @param len the amount to read 4871 * @param[out] buf buffer to hold the content read from file 4872 */ 4873 int (*fh_read)(WT_FILE_HANDLE *file_handle, 4874 WT_SESSION *session, wt_off_t offset, size_t len, void *buf); 4875 4876 /*! 4877 * Return the size of a file. 4878 * 4879 * @errors 4880 * 4881 * @param file_handle the WT_FILE_HANDLE 4882 * @param session the current WiredTiger session 4883 * @param sizep the size of the file 4884 */ 4885 int (*fh_size)( 4886 WT_FILE_HANDLE *file_handle, WT_SESSION *session, wt_off_t *sizep); 4887 4888 /*! 4889 * Make outstanding file writes durable and do not return until writes 4890 * are complete. 4891 * 4892 * This method is not required for read-only files, and should be set 4893 * to NULL when not supported by the file. 4894 * 4895 * @errors 4896 * 4897 * @param file_handle the WT_FILE_HANDLE 4898 * @param session the current WiredTiger session 4899 */ 4900 int (*fh_sync)(WT_FILE_HANDLE *file_handle, WT_SESSION *session); 4901 4902 /*! 4903 * Schedule the outstanding file writes required for durability and 4904 * return immediately. 4905 * 4906 * This method is not required, and should be set to NULL when not 4907 * supported by the file. 4908 * 4909 * @errors 4910 * 4911 * @param file_handle the WT_FILE_HANDLE 4912 * @param session the current WiredTiger session 4913 */ 4914 int (*fh_sync_nowait)(WT_FILE_HANDLE *file_handle, WT_SESSION *session); 4915 4916 /*! 4917 * Truncate the file. 4918 * 4919 * This method is not required, and should be set to NULL when not 4920 * supported by the file. 4921 * 4922 * This method is not called by multiple threads concurrently (on the 4923 * same file handle). 4924 * 4925 * @errors 4926 * 4927 * @param file_handle the WT_FILE_HANDLE 4928 * @param session the current WiredTiger session 4929 * @param offset desired file size after truncate 4930 */ 4931 int (*fh_truncate)( 4932 WT_FILE_HANDLE *file_handle, WT_SESSION *session, wt_off_t offset); 4933 4934 /*! 4935 * Write to a file, based on the POSIX 1003.1 standard pwrite. 4936 * 4937 * This method is not required for read-only files, and should be set 4938 * to NULL when not supported by the file. 4939 * 4940 * @errors 4941 * 4942 * @param file_handle the WT_FILE_HANDLE 4943 * @param session the current WiredTiger session 4944 * @param offset offset at which to start writing 4945 * @param length amount of data to write 4946 * @param buf content to be written to the file 4947 */ 4948 int (*fh_write)(WT_FILE_HANDLE *file_handle, WT_SESSION *session, 4949 wt_off_t offset, size_t length, const void *buf); 4950}; 4951#endif /* !defined(SWIG) */ 4952 4953/*! 4954 * Entry point to an extension, called when the extension is loaded. 4955 * 4956 * @param connection the connection handle 4957 * @param config the config information passed to WT_CONNECTION::load_extension 4958 * @errors 4959 */ 4960extern int wiredtiger_extension_init( 4961 WT_CONNECTION *connection, WT_CONFIG_ARG *config); 4962 4963/*! 4964 * Optional cleanup function for an extension, called during 4965 * WT_CONNECTION::close. 4966 * 4967 * @param connection the connection handle 4968 * @errors 4969 */ 4970extern int wiredtiger_extension_terminate(WT_CONNECTION *connection); 4971 4972/*! @} */ 4973 4974/*! 4975 * @addtogroup wt 4976 * @{ 4977 */ 4978 4979/*! 4980 * @name Log record and operation types 4981 * @anchor log_types 4982 * @{ 4983 */ 4984/* 4985 * NOTE: The values of these record types and operations must 4986 * never change because they're written into the log. Append 4987 * any new records or operations to the appropriate set. 4988 */ 4989/*! checkpoint */ 4990#define WT_LOGREC_CHECKPOINT 0 4991/*! transaction commit */ 4992#define WT_LOGREC_COMMIT 1 4993/*! file sync */ 4994#define WT_LOGREC_FILE_SYNC 2 4995/*! message */ 4996#define WT_LOGREC_MESSAGE 3 4997/*! system/internal record */ 4998#define WT_LOGREC_SYSTEM 4 4999/*! invalid operation */ 5000#define WT_LOGOP_INVALID 0 5001/*! column-store put */ 5002#define WT_LOGOP_COL_PUT 1 5003/*! column-store remove */ 5004#define WT_LOGOP_COL_REMOVE 2 5005/*! column-store truncate */ 5006#define WT_LOGOP_COL_TRUNCATE 3 5007/*! row-store put */ 5008#define WT_LOGOP_ROW_PUT 4 5009/*! row-store remove */ 5010#define WT_LOGOP_ROW_REMOVE 5 5011/*! row-store truncate */ 5012#define WT_LOGOP_ROW_TRUNCATE 6 5013/*! checkpoint start */ 5014#define WT_LOGOP_CHECKPOINT_START 7 5015/*! previous LSN */ 5016#define WT_LOGOP_PREV_LSN 8 5017/*! column-store modify */ 5018#define WT_LOGOP_COL_MODIFY 9 5019/*! row-store modify */ 5020#define WT_LOGOP_ROW_MODIFY 10 5021/*! @} */ 5022 5023/******************************************* 5024 * Statistic reference. 5025 *******************************************/ 5026/* 5027 * DO NOT EDIT: automatically built by dist/api_stat.py. 5028 * Statistics section: BEGIN 5029 */ 5030 5031/*! 5032 * @name Connection statistics 5033 * @anchor statistics_keys 5034 * @anchor statistics_conn 5035 * Statistics are accessed through cursors with \c "statistics:" URIs. 5036 * Individual statistics can be queried through the cursor using the following 5037 * keys. See @ref data_statistics for more information. 5038 * @{ 5039 */ 5040/*! LSM: application work units currently queued */ 5041#define WT_STAT_CONN_LSM_WORK_QUEUE_APP 1000 5042/*! LSM: merge work units currently queued */ 5043#define WT_STAT_CONN_LSM_WORK_QUEUE_MANAGER 1001 5044/*! LSM: rows merged in an LSM tree */ 5045#define WT_STAT_CONN_LSM_ROWS_MERGED 1002 5046/*! LSM: sleep for LSM checkpoint throttle */ 5047#define WT_STAT_CONN_LSM_CHECKPOINT_THROTTLE 1003 5048/*! LSM: sleep for LSM merge throttle */ 5049#define WT_STAT_CONN_LSM_MERGE_THROTTLE 1004 5050/*! LSM: switch work units currently queued */ 5051#define WT_STAT_CONN_LSM_WORK_QUEUE_SWITCH 1005 5052/*! LSM: tree maintenance operations discarded */ 5053#define WT_STAT_CONN_LSM_WORK_UNITS_DISCARDED 1006 5054/*! LSM: tree maintenance operations executed */ 5055#define WT_STAT_CONN_LSM_WORK_UNITS_DONE 1007 5056/*! LSM: tree maintenance operations scheduled */ 5057#define WT_STAT_CONN_LSM_WORK_UNITS_CREATED 1008 5058/*! LSM: tree queue hit maximum */ 5059#define WT_STAT_CONN_LSM_WORK_QUEUE_MAX 1009 5060/*! async: current work queue length */ 5061#define WT_STAT_CONN_ASYNC_CUR_QUEUE 1010 5062/*! async: maximum work queue length */ 5063#define WT_STAT_CONN_ASYNC_MAX_QUEUE 1011 5064/*! async: number of allocation state races */ 5065#define WT_STAT_CONN_ASYNC_ALLOC_RACE 1012 5066/*! async: number of flush calls */ 5067#define WT_STAT_CONN_ASYNC_FLUSH 1013 5068/*! async: number of operation slots viewed for allocation */ 5069#define WT_STAT_CONN_ASYNC_ALLOC_VIEW 1014 5070/*! async: number of times operation allocation failed */ 5071#define WT_STAT_CONN_ASYNC_FULL 1015 5072/*! async: number of times worker found no work */ 5073#define WT_STAT_CONN_ASYNC_NOWORK 1016 5074/*! async: total allocations */ 5075#define WT_STAT_CONN_ASYNC_OP_ALLOC 1017 5076/*! async: total compact calls */ 5077#define WT_STAT_CONN_ASYNC_OP_COMPACT 1018 5078/*! async: total insert calls */ 5079#define WT_STAT_CONN_ASYNC_OP_INSERT 1019 5080/*! async: total remove calls */ 5081#define WT_STAT_CONN_ASYNC_OP_REMOVE 1020 5082/*! async: total search calls */ 5083#define WT_STAT_CONN_ASYNC_OP_SEARCH 1021 5084/*! async: total update calls */ 5085#define WT_STAT_CONN_ASYNC_OP_UPDATE 1022 5086/*! block-manager: blocks pre-loaded */ 5087#define WT_STAT_CONN_BLOCK_PRELOAD 1023 5088/*! block-manager: blocks read */ 5089#define WT_STAT_CONN_BLOCK_READ 1024 5090/*! block-manager: blocks written */ 5091#define WT_STAT_CONN_BLOCK_WRITE 1025 5092/*! block-manager: bytes read */ 5093#define WT_STAT_CONN_BLOCK_BYTE_READ 1026 5094/*! block-manager: bytes written */ 5095#define WT_STAT_CONN_BLOCK_BYTE_WRITE 1027 5096/*! block-manager: bytes written for checkpoint */ 5097#define WT_STAT_CONN_BLOCK_BYTE_WRITE_CHECKPOINT 1028 5098/*! block-manager: mapped blocks read */ 5099#define WT_STAT_CONN_BLOCK_MAP_READ 1029 5100/*! block-manager: mapped bytes read */ 5101#define WT_STAT_CONN_BLOCK_BYTE_MAP_READ 1030 5102/*! cache: application threads page read from disk to cache count */ 5103#define WT_STAT_CONN_CACHE_READ_APP_COUNT 1031 5104/*! cache: application threads page read from disk to cache time (usecs) */ 5105#define WT_STAT_CONN_CACHE_READ_APP_TIME 1032 5106/*! cache: application threads page write from cache to disk count */ 5107#define WT_STAT_CONN_CACHE_WRITE_APP_COUNT 1033 5108/*! cache: application threads page write from cache to disk time (usecs) */ 5109#define WT_STAT_CONN_CACHE_WRITE_APP_TIME 1034 5110/*! cache: bytes belonging to page images in the cache */ 5111#define WT_STAT_CONN_CACHE_BYTES_IMAGE 1035 5112/*! cache: bytes belonging to the cache overflow table in the cache */ 5113#define WT_STAT_CONN_CACHE_BYTES_LOOKASIDE 1036 5114/*! cache: bytes currently in the cache */ 5115#define WT_STAT_CONN_CACHE_BYTES_INUSE 1037 5116/*! cache: bytes not belonging to page images in the cache */ 5117#define WT_STAT_CONN_CACHE_BYTES_OTHER 1038 5118/*! cache: bytes read into cache */ 5119#define WT_STAT_CONN_CACHE_BYTES_READ 1039 5120/*! cache: bytes written from cache */ 5121#define WT_STAT_CONN_CACHE_BYTES_WRITE 1040 5122/*! cache: cache overflow cursor application thread wait time (usecs) */ 5123#define WT_STAT_CONN_CACHE_LOOKASIDE_CURSOR_WAIT_APPLICATION 1041 5124/*! cache: cache overflow cursor internal thread wait time (usecs) */ 5125#define WT_STAT_CONN_CACHE_LOOKASIDE_CURSOR_WAIT_INTERNAL 1042 5126/*! cache: cache overflow score */ 5127#define WT_STAT_CONN_CACHE_LOOKASIDE_SCORE 1043 5128/*! cache: cache overflow table entries */ 5129#define WT_STAT_CONN_CACHE_LOOKASIDE_ENTRIES 1044 5130/*! cache: cache overflow table insert calls */ 5131#define WT_STAT_CONN_CACHE_LOOKASIDE_INSERT 1045 5132/*! cache: cache overflow table max on-disk size */ 5133#define WT_STAT_CONN_CACHE_LOOKASIDE_ONDISK_MAX 1046 5134/*! cache: cache overflow table on-disk size */ 5135#define WT_STAT_CONN_CACHE_LOOKASIDE_ONDISK 1047 5136/*! cache: cache overflow table remove calls */ 5137#define WT_STAT_CONN_CACHE_LOOKASIDE_REMOVE 1048 5138/*! cache: checkpoint blocked page eviction */ 5139#define WT_STAT_CONN_CACHE_EVICTION_CHECKPOINT 1049 5140/*! cache: eviction calls to get a page */ 5141#define WT_STAT_CONN_CACHE_EVICTION_GET_REF 1050 5142/*! cache: eviction calls to get a page found queue empty */ 5143#define WT_STAT_CONN_CACHE_EVICTION_GET_REF_EMPTY 1051 5144/*! cache: eviction calls to get a page found queue empty after locking */ 5145#define WT_STAT_CONN_CACHE_EVICTION_GET_REF_EMPTY2 1052 5146/*! cache: eviction currently operating in aggressive mode */ 5147#define WT_STAT_CONN_CACHE_EVICTION_AGGRESSIVE_SET 1053 5148/*! cache: eviction empty score */ 5149#define WT_STAT_CONN_CACHE_EVICTION_EMPTY_SCORE 1054 5150/*! cache: eviction passes of a file */ 5151#define WT_STAT_CONN_CACHE_EVICTION_WALK_PASSES 1055 5152/*! cache: eviction server candidate queue empty when topping up */ 5153#define WT_STAT_CONN_CACHE_EVICTION_QUEUE_EMPTY 1056 5154/*! cache: eviction server candidate queue not empty when topping up */ 5155#define WT_STAT_CONN_CACHE_EVICTION_QUEUE_NOT_EMPTY 1057 5156/*! cache: eviction server evicting pages */ 5157#define WT_STAT_CONN_CACHE_EVICTION_SERVER_EVICTING 1058 5158/*! 5159 * cache: eviction server slept, because we did not make progress with 5160 * eviction 5161 */ 5162#define WT_STAT_CONN_CACHE_EVICTION_SERVER_SLEPT 1059 5163/*! cache: eviction server unable to reach eviction goal */ 5164#define WT_STAT_CONN_CACHE_EVICTION_SLOW 1060 5165/*! cache: eviction state */ 5166#define WT_STAT_CONN_CACHE_EVICTION_STATE 1061 5167/*! cache: eviction walk target pages histogram - 0-9 */ 5168#define WT_STAT_CONN_CACHE_EVICTION_TARGET_PAGE_LT10 1062 5169/*! cache: eviction walk target pages histogram - 10-31 */ 5170#define WT_STAT_CONN_CACHE_EVICTION_TARGET_PAGE_LT32 1063 5171/*! cache: eviction walk target pages histogram - 128 and higher */ 5172#define WT_STAT_CONN_CACHE_EVICTION_TARGET_PAGE_GE128 1064 5173/*! cache: eviction walk target pages histogram - 32-63 */ 5174#define WT_STAT_CONN_CACHE_EVICTION_TARGET_PAGE_LT64 1065 5175/*! cache: eviction walk target pages histogram - 64-128 */ 5176#define WT_STAT_CONN_CACHE_EVICTION_TARGET_PAGE_LT128 1066 5177/*! cache: eviction walks abandoned */ 5178#define WT_STAT_CONN_CACHE_EVICTION_WALKS_ABANDONED 1067 5179/*! cache: eviction walks gave up because they restarted their walk twice */ 5180#define WT_STAT_CONN_CACHE_EVICTION_WALKS_STOPPED 1068 5181/*! 5182 * cache: eviction walks gave up because they saw too many pages and 5183 * found no candidates 5184 */ 5185#define WT_STAT_CONN_CACHE_EVICTION_WALKS_GAVE_UP_NO_TARGETS 1069 5186/*! 5187 * cache: eviction walks gave up because they saw too many pages and 5188 * found too few candidates 5189 */ 5190#define WT_STAT_CONN_CACHE_EVICTION_WALKS_GAVE_UP_RATIO 1070 5191/*! cache: eviction walks reached end of tree */ 5192#define WT_STAT_CONN_CACHE_EVICTION_WALKS_ENDED 1071 5193/*! cache: eviction walks started from root of tree */ 5194#define WT_STAT_CONN_CACHE_EVICTION_WALK_FROM_ROOT 1072 5195/*! cache: eviction walks started from saved location in tree */ 5196#define WT_STAT_CONN_CACHE_EVICTION_WALK_SAVED_POS 1073 5197/*! cache: eviction worker thread active */ 5198#define WT_STAT_CONN_CACHE_EVICTION_ACTIVE_WORKERS 1074 5199/*! cache: eviction worker thread created */ 5200#define WT_STAT_CONN_CACHE_EVICTION_WORKER_CREATED 1075 5201/*! cache: eviction worker thread evicting pages */ 5202#define WT_STAT_CONN_CACHE_EVICTION_WORKER_EVICTING 1076 5203/*! cache: eviction worker thread removed */ 5204#define WT_STAT_CONN_CACHE_EVICTION_WORKER_REMOVED 1077 5205/*! cache: eviction worker thread stable number */ 5206#define WT_STAT_CONN_CACHE_EVICTION_STABLE_STATE_WORKERS 1078 5207/*! 5208 * cache: failed eviction of pages that exceeded the in-memory maximum 5209 * count 5210 */ 5211#define WT_STAT_CONN_CACHE_EVICTION_FORCE_FAIL 1079 5212/*! 5213 * cache: failed eviction of pages that exceeded the in-memory maximum 5214 * time (usecs) 5215 */ 5216#define WT_STAT_CONN_CACHE_EVICTION_FORCE_FAIL_TIME 1080 5217/*! cache: files with active eviction walks */ 5218#define WT_STAT_CONN_CACHE_EVICTION_WALKS_ACTIVE 1081 5219/*! cache: files with new eviction walks started */ 5220#define WT_STAT_CONN_CACHE_EVICTION_WALKS_STARTED 1082 5221/*! cache: force re-tuning of eviction workers once in a while */ 5222#define WT_STAT_CONN_CACHE_EVICTION_FORCE_RETUNE 1083 5223/*! cache: hazard pointer blocked page eviction */ 5224#define WT_STAT_CONN_CACHE_EVICTION_HAZARD 1084 5225/*! cache: hazard pointer check calls */ 5226#define WT_STAT_CONN_CACHE_HAZARD_CHECKS 1085 5227/*! cache: hazard pointer check entries walked */ 5228#define WT_STAT_CONN_CACHE_HAZARD_WALKS 1086 5229/*! cache: hazard pointer maximum array length */ 5230#define WT_STAT_CONN_CACHE_HAZARD_MAX 1087 5231/*! cache: in-memory page passed criteria to be split */ 5232#define WT_STAT_CONN_CACHE_INMEM_SPLITTABLE 1088 5233/*! cache: in-memory page splits */ 5234#define WT_STAT_CONN_CACHE_INMEM_SPLIT 1089 5235/*! cache: internal pages evicted */ 5236#define WT_STAT_CONN_CACHE_EVICTION_INTERNAL 1090 5237/*! cache: internal pages split during eviction */ 5238#define WT_STAT_CONN_CACHE_EVICTION_SPLIT_INTERNAL 1091 5239/*! cache: leaf pages split during eviction */ 5240#define WT_STAT_CONN_CACHE_EVICTION_SPLIT_LEAF 1092 5241/*! cache: maximum bytes configured */ 5242#define WT_STAT_CONN_CACHE_BYTES_MAX 1093 5243/*! cache: maximum page size at eviction */ 5244#define WT_STAT_CONN_CACHE_EVICTION_MAXIMUM_PAGE_SIZE 1094 5245/*! cache: modified pages evicted */ 5246#define WT_STAT_CONN_CACHE_EVICTION_DIRTY 1095 5247/*! cache: modified pages evicted by application threads */ 5248#define WT_STAT_CONN_CACHE_EVICTION_APP_DIRTY 1096 5249/*! cache: operations timed out waiting for space in cache */ 5250#define WT_STAT_CONN_CACHE_TIMED_OUT_OPS 1097 5251/*! cache: overflow pages read into cache */ 5252#define WT_STAT_CONN_CACHE_READ_OVERFLOW 1098 5253/*! cache: page split during eviction deepened the tree */ 5254#define WT_STAT_CONN_CACHE_EVICTION_DEEPEN 1099 5255/*! cache: page written requiring cache overflow records */ 5256#define WT_STAT_CONN_CACHE_WRITE_LOOKASIDE 1100 5257/*! cache: pages currently held in the cache */ 5258#define WT_STAT_CONN_CACHE_PAGES_INUSE 1101 5259/*! cache: pages evicted because they exceeded the in-memory maximum count */ 5260#define WT_STAT_CONN_CACHE_EVICTION_FORCE 1102 5261/*! 5262 * cache: pages evicted because they exceeded the in-memory maximum time 5263 * (usecs) 5264 */ 5265#define WT_STAT_CONN_CACHE_EVICTION_FORCE_TIME 1103 5266/*! cache: pages evicted because they had chains of deleted items count */ 5267#define WT_STAT_CONN_CACHE_EVICTION_FORCE_DELETE 1104 5268/*! 5269 * cache: pages evicted because they had chains of deleted items time 5270 * (usecs) 5271 */ 5272#define WT_STAT_CONN_CACHE_EVICTION_FORCE_DELETE_TIME 1105 5273/*! cache: pages evicted by application threads */ 5274#define WT_STAT_CONN_CACHE_EVICTION_APP 1106 5275/*! cache: pages queued for eviction */ 5276#define WT_STAT_CONN_CACHE_EVICTION_PAGES_QUEUED 1107 5277/*! cache: pages queued for urgent eviction */ 5278#define WT_STAT_CONN_CACHE_EVICTION_PAGES_QUEUED_URGENT 1108 5279/*! cache: pages queued for urgent eviction during walk */ 5280#define WT_STAT_CONN_CACHE_EVICTION_PAGES_QUEUED_OLDEST 1109 5281/*! cache: pages read into cache */ 5282#define WT_STAT_CONN_CACHE_READ 1110 5283/*! cache: pages read into cache after truncate */ 5284#define WT_STAT_CONN_CACHE_READ_DELETED 1111 5285/*! cache: pages read into cache after truncate in prepare state */ 5286#define WT_STAT_CONN_CACHE_READ_DELETED_PREPARED 1112 5287/*! cache: pages read into cache requiring cache overflow entries */ 5288#define WT_STAT_CONN_CACHE_READ_LOOKASIDE 1113 5289/*! cache: pages read into cache requiring cache overflow for checkpoint */ 5290#define WT_STAT_CONN_CACHE_READ_LOOKASIDE_CHECKPOINT 1114 5291/*! cache: pages read into cache skipping older cache overflow entries */ 5292#define WT_STAT_CONN_CACHE_READ_LOOKASIDE_SKIPPED 1115 5293/*! 5294 * cache: pages read into cache with skipped cache overflow entries 5295 * needed later 5296 */ 5297#define WT_STAT_CONN_CACHE_READ_LOOKASIDE_DELAY 1116 5298/*! 5299 * cache: pages read into cache with skipped cache overflow entries 5300 * needed later by checkpoint 5301 */ 5302#define WT_STAT_CONN_CACHE_READ_LOOKASIDE_DELAY_CHECKPOINT 1117 5303/*! cache: pages requested from the cache */ 5304#define WT_STAT_CONN_CACHE_PAGES_REQUESTED 1118 5305/*! cache: pages seen by eviction walk */ 5306#define WT_STAT_CONN_CACHE_EVICTION_PAGES_SEEN 1119 5307/*! cache: pages selected for eviction unable to be evicted */ 5308#define WT_STAT_CONN_CACHE_EVICTION_FAIL 1120 5309/*! cache: pages walked for eviction */ 5310#define WT_STAT_CONN_CACHE_EVICTION_WALK 1121 5311/*! cache: pages written from cache */ 5312#define WT_STAT_CONN_CACHE_WRITE 1122 5313/*! cache: pages written requiring in-memory restoration */ 5314#define WT_STAT_CONN_CACHE_WRITE_RESTORE 1123 5315/*! cache: percentage overhead */ 5316#define WT_STAT_CONN_CACHE_OVERHEAD 1124 5317/*! cache: tracked bytes belonging to internal pages in the cache */ 5318#define WT_STAT_CONN_CACHE_BYTES_INTERNAL 1125 5319/*! cache: tracked bytes belonging to leaf pages in the cache */ 5320#define WT_STAT_CONN_CACHE_BYTES_LEAF 1126 5321/*! cache: tracked dirty bytes in the cache */ 5322#define WT_STAT_CONN_CACHE_BYTES_DIRTY 1127 5323/*! cache: tracked dirty pages in the cache */ 5324#define WT_STAT_CONN_CACHE_PAGES_DIRTY 1128 5325/*! cache: unmodified pages evicted */ 5326#define WT_STAT_CONN_CACHE_EVICTION_CLEAN 1129 5327/*! connection: auto adjusting condition resets */ 5328#define WT_STAT_CONN_COND_AUTO_WAIT_RESET 1130 5329/*! connection: auto adjusting condition wait calls */ 5330#define WT_STAT_CONN_COND_AUTO_WAIT 1131 5331/*! connection: detected system time went backwards */ 5332#define WT_STAT_CONN_TIME_TRAVEL 1132 5333/*! connection: files currently open */ 5334#define WT_STAT_CONN_FILE_OPEN 1133 5335/*! connection: memory allocations */ 5336#define WT_STAT_CONN_MEMORY_ALLOCATION 1134 5337/*! connection: memory frees */ 5338#define WT_STAT_CONN_MEMORY_FREE 1135 5339/*! connection: memory re-allocations */ 5340#define WT_STAT_CONN_MEMORY_GROW 1136 5341/*! connection: pthread mutex condition wait calls */ 5342#define WT_STAT_CONN_COND_WAIT 1137 5343/*! connection: pthread mutex shared lock read-lock calls */ 5344#define WT_STAT_CONN_RWLOCK_READ 1138 5345/*! connection: pthread mutex shared lock write-lock calls */ 5346#define WT_STAT_CONN_RWLOCK_WRITE 1139 5347/*! connection: total fsync I/Os */ 5348#define WT_STAT_CONN_FSYNC_IO 1140 5349/*! connection: total read I/Os */ 5350#define WT_STAT_CONN_READ_IO 1141 5351/*! connection: total write I/Os */ 5352#define WT_STAT_CONN_WRITE_IO 1142 5353/*! cursor: cached cursor count */ 5354#define WT_STAT_CONN_CURSOR_CACHED_COUNT 1143 5355/*! cursor: cursor close calls that result in cache */ 5356#define WT_STAT_CONN_CURSOR_CACHE 1144 5357/*! cursor: cursor create calls */ 5358#define WT_STAT_CONN_CURSOR_CREATE 1145 5359/*! cursor: cursor insert calls */ 5360#define WT_STAT_CONN_CURSOR_INSERT 1146 5361/*! cursor: cursor modify calls */ 5362#define WT_STAT_CONN_CURSOR_MODIFY 1147 5363/*! cursor: cursor next calls */ 5364#define WT_STAT_CONN_CURSOR_NEXT 1148 5365/*! cursor: cursor operation restarted */ 5366#define WT_STAT_CONN_CURSOR_RESTART 1149 5367/*! cursor: cursor prev calls */ 5368#define WT_STAT_CONN_CURSOR_PREV 1150 5369/*! cursor: cursor remove calls */ 5370#define WT_STAT_CONN_CURSOR_REMOVE 1151 5371/*! cursor: cursor reserve calls */ 5372#define WT_STAT_CONN_CURSOR_RESERVE 1152 5373/*! cursor: cursor reset calls */ 5374#define WT_STAT_CONN_CURSOR_RESET 1153 5375/*! cursor: cursor search calls */ 5376#define WT_STAT_CONN_CURSOR_SEARCH 1154 5377/*! cursor: cursor search near calls */ 5378#define WT_STAT_CONN_CURSOR_SEARCH_NEAR 1155 5379/*! cursor: cursor sweep buckets */ 5380#define WT_STAT_CONN_CURSOR_SWEEP_BUCKETS 1156 5381/*! cursor: cursor sweep cursors closed */ 5382#define WT_STAT_CONN_CURSOR_SWEEP_CLOSED 1157 5383/*! cursor: cursor sweep cursors examined */ 5384#define WT_STAT_CONN_CURSOR_SWEEP_EXAMINED 1158 5385/*! cursor: cursor sweeps */ 5386#define WT_STAT_CONN_CURSOR_SWEEP 1159 5387/*! cursor: cursor update calls */ 5388#define WT_STAT_CONN_CURSOR_UPDATE 1160 5389/*! cursor: cursors reused from cache */ 5390#define WT_STAT_CONN_CURSOR_REOPEN 1161 5391/*! cursor: open cursor count */ 5392#define WT_STAT_CONN_CURSOR_OPEN_COUNT 1162 5393/*! cursor: truncate calls */ 5394#define WT_STAT_CONN_CURSOR_TRUNCATE 1163 5395/*! data-handle: connection data handles currently active */ 5396#define WT_STAT_CONN_DH_CONN_HANDLE_COUNT 1164 5397/*! data-handle: connection sweep candidate became referenced */ 5398#define WT_STAT_CONN_DH_SWEEP_REF 1165 5399/*! data-handle: connection sweep dhandles closed */ 5400#define WT_STAT_CONN_DH_SWEEP_CLOSE 1166 5401/*! data-handle: connection sweep dhandles removed from hash list */ 5402#define WT_STAT_CONN_DH_SWEEP_REMOVE 1167 5403/*! data-handle: connection sweep time-of-death sets */ 5404#define WT_STAT_CONN_DH_SWEEP_TOD 1168 5405/*! data-handle: connection sweeps */ 5406#define WT_STAT_CONN_DH_SWEEPS 1169 5407/*! data-handle: session dhandles swept */ 5408#define WT_STAT_CONN_DH_SESSION_HANDLES 1170 5409/*! data-handle: session sweep attempts */ 5410#define WT_STAT_CONN_DH_SESSION_SWEEPS 1171 5411/*! lock: checkpoint lock acquisitions */ 5412#define WT_STAT_CONN_LOCK_CHECKPOINT_COUNT 1172 5413/*! lock: checkpoint lock application thread wait time (usecs) */ 5414#define WT_STAT_CONN_LOCK_CHECKPOINT_WAIT_APPLICATION 1173 5415/*! lock: checkpoint lock internal thread wait time (usecs) */ 5416#define WT_STAT_CONN_LOCK_CHECKPOINT_WAIT_INTERNAL 1174 5417/*! 5418 * lock: commit timestamp queue lock application thread time waiting 5419 * (usecs) 5420 */ 5421#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_WAIT_APPLICATION 1175 5422/*! lock: commit timestamp queue lock internal thread time waiting (usecs) */ 5423#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_WAIT_INTERNAL 1176 5424/*! lock: commit timestamp queue read lock acquisitions */ 5425#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_READ_COUNT 1177 5426/*! lock: commit timestamp queue write lock acquisitions */ 5427#define WT_STAT_CONN_LOCK_COMMIT_TIMESTAMP_WRITE_COUNT 1178 5428/*! lock: dhandle lock application thread time waiting (usecs) */ 5429#define WT_STAT_CONN_LOCK_DHANDLE_WAIT_APPLICATION 1179 5430/*! lock: dhandle lock internal thread time waiting (usecs) */ 5431#define WT_STAT_CONN_LOCK_DHANDLE_WAIT_INTERNAL 1180 5432/*! lock: dhandle read lock acquisitions */ 5433#define WT_STAT_CONN_LOCK_DHANDLE_READ_COUNT 1181 5434/*! lock: dhandle write lock acquisitions */ 5435#define WT_STAT_CONN_LOCK_DHANDLE_WRITE_COUNT 1182 5436/*! lock: metadata lock acquisitions */ 5437#define WT_STAT_CONN_LOCK_METADATA_COUNT 1183 5438/*! lock: metadata lock application thread wait time (usecs) */ 5439#define WT_STAT_CONN_LOCK_METADATA_WAIT_APPLICATION 1184 5440/*! lock: metadata lock internal thread wait time (usecs) */ 5441#define WT_STAT_CONN_LOCK_METADATA_WAIT_INTERNAL 1185 5442/*! 5443 * lock: read timestamp queue lock application thread time waiting 5444 * (usecs) 5445 */ 5446#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_WAIT_APPLICATION 1186 5447/*! lock: read timestamp queue lock internal thread time waiting (usecs) */ 5448#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_WAIT_INTERNAL 1187 5449/*! lock: read timestamp queue read lock acquisitions */ 5450#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_READ_COUNT 1188 5451/*! lock: read timestamp queue write lock acquisitions */ 5452#define WT_STAT_CONN_LOCK_READ_TIMESTAMP_WRITE_COUNT 1189 5453/*! lock: schema lock acquisitions */ 5454#define WT_STAT_CONN_LOCK_SCHEMA_COUNT 1190 5455/*! lock: schema lock application thread wait time (usecs) */ 5456#define WT_STAT_CONN_LOCK_SCHEMA_WAIT_APPLICATION 1191 5457/*! lock: schema lock internal thread wait time (usecs) */ 5458#define WT_STAT_CONN_LOCK_SCHEMA_WAIT_INTERNAL 1192 5459/*! 5460 * lock: table lock application thread time waiting for the table lock 5461 * (usecs) 5462 */ 5463#define WT_STAT_CONN_LOCK_TABLE_WAIT_APPLICATION 1193 5464/*! 5465 * lock: table lock internal thread time waiting for the table lock 5466 * (usecs) 5467 */ 5468#define WT_STAT_CONN_LOCK_TABLE_WAIT_INTERNAL 1194 5469/*! lock: table read lock acquisitions */ 5470#define WT_STAT_CONN_LOCK_TABLE_READ_COUNT 1195 5471/*! lock: table write lock acquisitions */ 5472#define WT_STAT_CONN_LOCK_TABLE_WRITE_COUNT 1196 5473/*! lock: txn global lock application thread time waiting (usecs) */ 5474#define WT_STAT_CONN_LOCK_TXN_GLOBAL_WAIT_APPLICATION 1197 5475/*! lock: txn global lock internal thread time waiting (usecs) */ 5476#define WT_STAT_CONN_LOCK_TXN_GLOBAL_WAIT_INTERNAL 1198 5477/*! lock: txn global read lock acquisitions */ 5478#define WT_STAT_CONN_LOCK_TXN_GLOBAL_READ_COUNT 1199 5479/*! lock: txn global write lock acquisitions */ 5480#define WT_STAT_CONN_LOCK_TXN_GLOBAL_WRITE_COUNT 1200 5481/*! log: busy returns attempting to switch slots */ 5482#define WT_STAT_CONN_LOG_SLOT_SWITCH_BUSY 1201 5483/*! log: force archive time sleeping (usecs) */ 5484#define WT_STAT_CONN_LOG_FORCE_ARCHIVE_SLEEP 1202 5485/*! log: log bytes of payload data */ 5486#define WT_STAT_CONN_LOG_BYTES_PAYLOAD 1203 5487/*! log: log bytes written */ 5488#define WT_STAT_CONN_LOG_BYTES_WRITTEN 1204 5489/*! log: log files manually zero-filled */ 5490#define WT_STAT_CONN_LOG_ZERO_FILLS 1205 5491/*! log: log flush operations */ 5492#define WT_STAT_CONN_LOG_FLUSH 1206 5493/*! log: log force write operations */ 5494#define WT_STAT_CONN_LOG_FORCE_WRITE 1207 5495/*! log: log force write operations skipped */ 5496#define WT_STAT_CONN_LOG_FORCE_WRITE_SKIP 1208 5497/*! log: log records compressed */ 5498#define WT_STAT_CONN_LOG_COMPRESS_WRITES 1209 5499/*! log: log records not compressed */ 5500#define WT_STAT_CONN_LOG_COMPRESS_WRITE_FAILS 1210 5501/*! log: log records too small to compress */ 5502#define WT_STAT_CONN_LOG_COMPRESS_SMALL 1211 5503/*! log: log release advances write LSN */ 5504#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1212 5505/*! log: log scan operations */ 5506#define WT_STAT_CONN_LOG_SCANS 1213 5507/*! log: log scan records requiring two reads */ 5508#define WT_STAT_CONN_LOG_SCAN_REREADS 1214 5509/*! log: log server thread advances write LSN */ 5510#define WT_STAT_CONN_LOG_WRITE_LSN 1215 5511/*! log: log server thread write LSN walk skipped */ 5512#define WT_STAT_CONN_LOG_WRITE_LSN_SKIP 1216 5513/*! log: log sync operations */ 5514#define WT_STAT_CONN_LOG_SYNC 1217 5515/*! log: log sync time duration (usecs) */ 5516#define WT_STAT_CONN_LOG_SYNC_DURATION 1218 5517/*! log: log sync_dir operations */ 5518#define WT_STAT_CONN_LOG_SYNC_DIR 1219 5519/*! log: log sync_dir time duration (usecs) */ 5520#define WT_STAT_CONN_LOG_SYNC_DIR_DURATION 1220 5521/*! log: log write operations */ 5522#define WT_STAT_CONN_LOG_WRITES 1221 5523/*! log: logging bytes consolidated */ 5524#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1222 5525/*! log: maximum log file size */ 5526#define WT_STAT_CONN_LOG_MAX_FILESIZE 1223 5527/*! log: number of pre-allocated log files to create */ 5528#define WT_STAT_CONN_LOG_PREALLOC_MAX 1224 5529/*! log: pre-allocated log files not ready and missed */ 5530#define WT_STAT_CONN_LOG_PREALLOC_MISSED 1225 5531/*! log: pre-allocated log files prepared */ 5532#define WT_STAT_CONN_LOG_PREALLOC_FILES 1226 5533/*! log: pre-allocated log files used */ 5534#define WT_STAT_CONN_LOG_PREALLOC_USED 1227 5535/*! log: records processed by log scan */ 5536#define WT_STAT_CONN_LOG_SCAN_RECORDS 1228 5537/*! log: slot close lost race */ 5538#define WT_STAT_CONN_LOG_SLOT_CLOSE_RACE 1229 5539/*! log: slot close unbuffered waits */ 5540#define WT_STAT_CONN_LOG_SLOT_CLOSE_UNBUF 1230 5541/*! log: slot closures */ 5542#define WT_STAT_CONN_LOG_SLOT_CLOSES 1231 5543/*! log: slot join atomic update races */ 5544#define WT_STAT_CONN_LOG_SLOT_RACES 1232 5545/*! log: slot join calls atomic updates raced */ 5546#define WT_STAT_CONN_LOG_SLOT_YIELD_RACE 1233 5547/*! log: slot join calls did not yield */ 5548#define WT_STAT_CONN_LOG_SLOT_IMMEDIATE 1234 5549/*! log: slot join calls found active slot closed */ 5550#define WT_STAT_CONN_LOG_SLOT_YIELD_CLOSE 1235 5551/*! log: slot join calls slept */ 5552#define WT_STAT_CONN_LOG_SLOT_YIELD_SLEEP 1236 5553/*! log: slot join calls yielded */ 5554#define WT_STAT_CONN_LOG_SLOT_YIELD 1237 5555/*! log: slot join found active slot closed */ 5556#define WT_STAT_CONN_LOG_SLOT_ACTIVE_CLOSED 1238 5557/*! log: slot joins yield time (usecs) */ 5558#define WT_STAT_CONN_LOG_SLOT_YIELD_DURATION 1239 5559/*! log: slot transitions unable to find free slot */ 5560#define WT_STAT_CONN_LOG_SLOT_NO_FREE_SLOTS 1240 5561/*! log: slot unbuffered writes */ 5562#define WT_STAT_CONN_LOG_SLOT_UNBUFFERED 1241 5563/*! log: total in-memory size of compressed records */ 5564#define WT_STAT_CONN_LOG_COMPRESS_MEM 1242 5565/*! log: total log buffer size */ 5566#define WT_STAT_CONN_LOG_BUFFER_SIZE 1243 5567/*! log: total size of compressed records */ 5568#define WT_STAT_CONN_LOG_COMPRESS_LEN 1244 5569/*! log: written slots coalesced */ 5570#define WT_STAT_CONN_LOG_SLOT_COALESCED 1245 5571/*! log: yields waiting for previous log file close */ 5572#define WT_STAT_CONN_LOG_CLOSE_YIELDS 1246 5573/*! perf: file system read latency histogram (bucket 1) - 10-49ms */ 5574#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT50 1247 5575/*! perf: file system read latency histogram (bucket 2) - 50-99ms */ 5576#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT100 1248 5577/*! perf: file system read latency histogram (bucket 3) - 100-249ms */ 5578#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT250 1249 5579/*! perf: file system read latency histogram (bucket 4) - 250-499ms */ 5580#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT500 1250 5581/*! perf: file system read latency histogram (bucket 5) - 500-999ms */ 5582#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_LT1000 1251 5583/*! perf: file system read latency histogram (bucket 6) - 1000ms+ */ 5584#define WT_STAT_CONN_PERF_HIST_FSREAD_LATENCY_GT1000 1252 5585/*! perf: file system write latency histogram (bucket 1) - 10-49ms */ 5586#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT50 1253 5587/*! perf: file system write latency histogram (bucket 2) - 50-99ms */ 5588#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT100 1254 5589/*! perf: file system write latency histogram (bucket 3) - 100-249ms */ 5590#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT250 1255 5591/*! perf: file system write latency histogram (bucket 4) - 250-499ms */ 5592#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT500 1256 5593/*! perf: file system write latency histogram (bucket 5) - 500-999ms */ 5594#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_LT1000 1257 5595/*! perf: file system write latency histogram (bucket 6) - 1000ms+ */ 5596#define WT_STAT_CONN_PERF_HIST_FSWRITE_LATENCY_GT1000 1258 5597/*! perf: operation read latency histogram (bucket 1) - 100-249us */ 5598#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT250 1259 5599/*! perf: operation read latency histogram (bucket 2) - 250-499us */ 5600#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT500 1260 5601/*! perf: operation read latency histogram (bucket 3) - 500-999us */ 5602#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT1000 1261 5603/*! perf: operation read latency histogram (bucket 4) - 1000-9999us */ 5604#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_LT10000 1262 5605/*! perf: operation read latency histogram (bucket 5) - 10000us+ */ 5606#define WT_STAT_CONN_PERF_HIST_OPREAD_LATENCY_GT10000 1263 5607/*! perf: operation write latency histogram (bucket 1) - 100-249us */ 5608#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT250 1264 5609/*! perf: operation write latency histogram (bucket 2) - 250-499us */ 5610#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT500 1265 5611/*! perf: operation write latency histogram (bucket 3) - 500-999us */ 5612#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT1000 1266 5613/*! perf: operation write latency histogram (bucket 4) - 1000-9999us */ 5614#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_LT10000 1267 5615/*! perf: operation write latency histogram (bucket 5) - 10000us+ */ 5616#define WT_STAT_CONN_PERF_HIST_OPWRITE_LATENCY_GT10000 1268 5617/*! reconciliation: fast-path pages deleted */ 5618#define WT_STAT_CONN_REC_PAGE_DELETE_FAST 1269 5619/*! reconciliation: page reconciliation calls */ 5620#define WT_STAT_CONN_REC_PAGES 1270 5621/*! reconciliation: page reconciliation calls for eviction */ 5622#define WT_STAT_CONN_REC_PAGES_EVICTION 1271 5623/*! reconciliation: pages deleted */ 5624#define WT_STAT_CONN_REC_PAGE_DELETE 1272 5625/*! reconciliation: split bytes currently awaiting free */ 5626#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1273 5627/*! reconciliation: split objects currently awaiting free */ 5628#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1274 5629/*! session: open session count */ 5630#define WT_STAT_CONN_SESSION_OPEN 1275 5631/*! session: session query timestamp calls */ 5632#define WT_STAT_CONN_SESSION_QUERY_TS 1276 5633/*! session: table alter failed calls */ 5634#define WT_STAT_CONN_SESSION_TABLE_ALTER_FAIL 1277 5635/*! session: table alter successful calls */ 5636#define WT_STAT_CONN_SESSION_TABLE_ALTER_SUCCESS 1278 5637/*! session: table alter unchanged and skipped */ 5638#define WT_STAT_CONN_SESSION_TABLE_ALTER_SKIP 1279 5639/*! session: table compact failed calls */ 5640#define WT_STAT_CONN_SESSION_TABLE_COMPACT_FAIL 1280 5641/*! session: table compact successful calls */ 5642#define WT_STAT_CONN_SESSION_TABLE_COMPACT_SUCCESS 1281 5643/*! session: table create failed calls */ 5644#define WT_STAT_CONN_SESSION_TABLE_CREATE_FAIL 1282 5645/*! session: table create successful calls */ 5646#define WT_STAT_CONN_SESSION_TABLE_CREATE_SUCCESS 1283 5647/*! session: table drop failed calls */ 5648#define WT_STAT_CONN_SESSION_TABLE_DROP_FAIL 1284 5649/*! session: table drop successful calls */ 5650#define WT_STAT_CONN_SESSION_TABLE_DROP_SUCCESS 1285 5651/*! session: table rebalance failed calls */ 5652#define WT_STAT_CONN_SESSION_TABLE_REBALANCE_FAIL 1286 5653/*! session: table rebalance successful calls */ 5654#define WT_STAT_CONN_SESSION_TABLE_REBALANCE_SUCCESS 1287 5655/*! session: table rename failed calls */ 5656#define WT_STAT_CONN_SESSION_TABLE_RENAME_FAIL 1288 5657/*! session: table rename successful calls */ 5658#define WT_STAT_CONN_SESSION_TABLE_RENAME_SUCCESS 1289 5659/*! session: table salvage failed calls */ 5660#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_FAIL 1290 5661/*! session: table salvage successful calls */ 5662#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_SUCCESS 1291 5663/*! session: table truncate failed calls */ 5664#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_FAIL 1292 5665/*! session: table truncate successful calls */ 5666#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_SUCCESS 1293 5667/*! session: table verify failed calls */ 5668#define WT_STAT_CONN_SESSION_TABLE_VERIFY_FAIL 1294 5669/*! session: table verify successful calls */ 5670#define WT_STAT_CONN_SESSION_TABLE_VERIFY_SUCCESS 1295 5671/*! thread-state: active filesystem fsync calls */ 5672#define WT_STAT_CONN_THREAD_FSYNC_ACTIVE 1296 5673/*! thread-state: active filesystem read calls */ 5674#define WT_STAT_CONN_THREAD_READ_ACTIVE 1297 5675/*! thread-state: active filesystem write calls */ 5676#define WT_STAT_CONN_THREAD_WRITE_ACTIVE 1298 5677/*! thread-yield: application thread time evicting (usecs) */ 5678#define WT_STAT_CONN_APPLICATION_EVICT_TIME 1299 5679/*! thread-yield: application thread time waiting for cache (usecs) */ 5680#define WT_STAT_CONN_APPLICATION_CACHE_TIME 1300 5681/*! 5682 * thread-yield: connection close blocked waiting for transaction state 5683 * stabilization 5684 */ 5685#define WT_STAT_CONN_TXN_RELEASE_BLOCKED 1301 5686/*! thread-yield: connection close yielded for lsm manager shutdown */ 5687#define WT_STAT_CONN_CONN_CLOSE_BLOCKED_LSM 1302 5688/*! thread-yield: data handle lock yielded */ 5689#define WT_STAT_CONN_DHANDLE_LOCK_BLOCKED 1303 5690/*! 5691 * thread-yield: get reference for page index and slot time sleeping 5692 * (usecs) 5693 */ 5694#define WT_STAT_CONN_PAGE_INDEX_SLOT_REF_BLOCKED 1304 5695/*! thread-yield: log server sync yielded for log write */ 5696#define WT_STAT_CONN_LOG_SERVER_SYNC_BLOCKED 1305 5697/*! thread-yield: page access yielded due to prepare state change */ 5698#define WT_STAT_CONN_PREPARED_TRANSITION_BLOCKED_PAGE 1306 5699/*! thread-yield: page acquire busy blocked */ 5700#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1307 5701/*! thread-yield: page acquire eviction blocked */ 5702#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1308 5703/*! thread-yield: page acquire locked blocked */ 5704#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1309 5705/*! thread-yield: page acquire read blocked */ 5706#define WT_STAT_CONN_PAGE_READ_BLOCKED 1310 5707/*! thread-yield: page acquire time sleeping (usecs) */ 5708#define WT_STAT_CONN_PAGE_SLEEP 1311 5709/*! 5710 * thread-yield: page delete rollback time sleeping for state change 5711 * (usecs) 5712 */ 5713#define WT_STAT_CONN_PAGE_DEL_ROLLBACK_BLOCKED 1312 5714/*! thread-yield: page reconciliation yielded due to child modification */ 5715#define WT_STAT_CONN_CHILD_MODIFY_BLOCKED_PAGE 1313 5716/*! transaction: commit timestamp queue entries walked */ 5717#define WT_STAT_CONN_TXN_COMMIT_QUEUE_WALKED 1314 5718/*! transaction: commit timestamp queue insert to empty */ 5719#define WT_STAT_CONN_TXN_COMMIT_QUEUE_EMPTY 1315 5720/*! transaction: commit timestamp queue inserts to head */ 5721#define WT_STAT_CONN_TXN_COMMIT_QUEUE_HEAD 1316 5722/*! transaction: commit timestamp queue inserts total */ 5723#define WT_STAT_CONN_TXN_COMMIT_QUEUE_INSERTS 1317 5724/*! transaction: commit timestamp queue length */ 5725#define WT_STAT_CONN_TXN_COMMIT_QUEUE_LEN 1318 5726/*! transaction: number of named snapshots created */ 5727#define WT_STAT_CONN_TXN_SNAPSHOTS_CREATED 1319 5728/*! transaction: number of named snapshots dropped */ 5729#define WT_STAT_CONN_TXN_SNAPSHOTS_DROPPED 1320 5730/*! transaction: prepared transactions */ 5731#define WT_STAT_CONN_TXN_PREPARE 1321 5732/*! transaction: prepared transactions committed */ 5733#define WT_STAT_CONN_TXN_PREPARE_COMMIT 1322 5734/*! transaction: prepared transactions currently active */ 5735#define WT_STAT_CONN_TXN_PREPARE_ACTIVE 1323 5736/*! transaction: prepared transactions rolled back */ 5737#define WT_STAT_CONN_TXN_PREPARE_ROLLBACK 1324 5738/*! transaction: query timestamp calls */ 5739#define WT_STAT_CONN_TXN_QUERY_TS 1325 5740/*! transaction: read timestamp queue entries walked */ 5741#define WT_STAT_CONN_TXN_READ_QUEUE_WALKED 1326 5742/*! transaction: read timestamp queue insert to empty */ 5743#define WT_STAT_CONN_TXN_READ_QUEUE_EMPTY 1327 5744/*! transaction: read timestamp queue inserts to head */ 5745#define WT_STAT_CONN_TXN_READ_QUEUE_HEAD 1328 5746/*! transaction: read timestamp queue inserts total */ 5747#define WT_STAT_CONN_TXN_READ_QUEUE_INSERTS 1329 5748/*! transaction: read timestamp queue length */ 5749#define WT_STAT_CONN_TXN_READ_QUEUE_LEN 1330 5750/*! transaction: rollback to stable calls */ 5751#define WT_STAT_CONN_TXN_ROLLBACK_TO_STABLE 1331 5752/*! transaction: rollback to stable updates aborted */ 5753#define WT_STAT_CONN_TXN_ROLLBACK_UPD_ABORTED 1332 5754/*! transaction: rollback to stable updates removed from cache overflow */ 5755#define WT_STAT_CONN_TXN_ROLLBACK_LAS_REMOVED 1333 5756/*! transaction: set timestamp calls */ 5757#define WT_STAT_CONN_TXN_SET_TS 1334 5758/*! transaction: set timestamp commit calls */ 5759#define WT_STAT_CONN_TXN_SET_TS_COMMIT 1335 5760/*! transaction: set timestamp commit updates */ 5761#define WT_STAT_CONN_TXN_SET_TS_COMMIT_UPD 1336 5762/*! transaction: set timestamp oldest calls */ 5763#define WT_STAT_CONN_TXN_SET_TS_OLDEST 1337 5764/*! transaction: set timestamp oldest updates */ 5765#define WT_STAT_CONN_TXN_SET_TS_OLDEST_UPD 1338 5766/*! transaction: set timestamp stable calls */ 5767#define WT_STAT_CONN_TXN_SET_TS_STABLE 1339 5768/*! transaction: set timestamp stable updates */ 5769#define WT_STAT_CONN_TXN_SET_TS_STABLE_UPD 1340 5770/*! transaction: transaction begins */ 5771#define WT_STAT_CONN_TXN_BEGIN 1341 5772/*! transaction: transaction checkpoint currently running */ 5773#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1342 5774/*! transaction: transaction checkpoint generation */ 5775#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1343 5776/*! transaction: transaction checkpoint max time (msecs) */ 5777#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1344 5778/*! transaction: transaction checkpoint min time (msecs) */ 5779#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1345 5780/*! transaction: transaction checkpoint most recent time (msecs) */ 5781#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1346 5782/*! transaction: transaction checkpoint scrub dirty target */ 5783#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TARGET 1347 5784/*! transaction: transaction checkpoint scrub time (msecs) */ 5785#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TIME 1348 5786/*! transaction: transaction checkpoint total time (msecs) */ 5787#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1349 5788/*! transaction: transaction checkpoints */ 5789#define WT_STAT_CONN_TXN_CHECKPOINT 1350 5790/*! 5791 * transaction: transaction checkpoints skipped because database was 5792 * clean 5793 */ 5794#define WT_STAT_CONN_TXN_CHECKPOINT_SKIPPED 1351 5795/*! transaction: transaction failures due to cache overflow */ 5796#define WT_STAT_CONN_TXN_FAIL_CACHE 1352 5797/*! 5798 * transaction: transaction fsync calls for checkpoint after allocating 5799 * the transaction ID 5800 */ 5801#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST 1353 5802/*! 5803 * transaction: transaction fsync duration for checkpoint after 5804 * allocating the transaction ID (usecs) 5805 */ 5806#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST_DURATION 1354 5807/*! transaction: transaction range of IDs currently pinned */ 5808#define WT_STAT_CONN_TXN_PINNED_RANGE 1355 5809/*! transaction: transaction range of IDs currently pinned by a checkpoint */ 5810#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1356 5811/*! 5812 * transaction: transaction range of IDs currently pinned by named 5813 * snapshots 5814 */ 5815#define WT_STAT_CONN_TXN_PINNED_SNAPSHOT_RANGE 1357 5816/*! transaction: transaction range of timestamps currently pinned */ 5817#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP 1358 5818/*! transaction: transaction range of timestamps pinned by a checkpoint */ 5819#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_CHECKPOINT 1359 5820/*! 5821 * transaction: transaction range of timestamps pinned by the oldest 5822 * timestamp 5823 */ 5824#define WT_STAT_CONN_TXN_PINNED_TIMESTAMP_OLDEST 1360 5825/*! transaction: transaction sync calls */ 5826#define WT_STAT_CONN_TXN_SYNC 1361 5827/*! transaction: transactions committed */ 5828#define WT_STAT_CONN_TXN_COMMIT 1362 5829/*! transaction: transactions rolled back */ 5830#define WT_STAT_CONN_TXN_ROLLBACK 1363 5831/*! transaction: update conflicts */ 5832#define WT_STAT_CONN_TXN_UPDATE_CONFLICT 1364 5833 5834/*! 5835 * @} 5836 * @name Statistics for data sources 5837 * @anchor statistics_dsrc 5838 * @{ 5839 */ 5840/*! LSM: bloom filter false positives */ 5841#define WT_STAT_DSRC_BLOOM_FALSE_POSITIVE 2000 5842/*! LSM: bloom filter hits */ 5843#define WT_STAT_DSRC_BLOOM_HIT 2001 5844/*! LSM: bloom filter misses */ 5845#define WT_STAT_DSRC_BLOOM_MISS 2002 5846/*! LSM: bloom filter pages evicted from cache */ 5847#define WT_STAT_DSRC_BLOOM_PAGE_EVICT 2003 5848/*! LSM: bloom filter pages read into cache */ 5849#define WT_STAT_DSRC_BLOOM_PAGE_READ 2004 5850/*! LSM: bloom filters in the LSM tree */ 5851#define WT_STAT_DSRC_BLOOM_COUNT 2005 5852/*! LSM: chunks in the LSM tree */ 5853#define WT_STAT_DSRC_LSM_CHUNK_COUNT 2006 5854/*! LSM: highest merge generation in the LSM tree */ 5855#define WT_STAT_DSRC_LSM_GENERATION_MAX 2007 5856/*! 5857 * LSM: queries that could have benefited from a Bloom filter that did 5858 * not exist 5859 */ 5860#define WT_STAT_DSRC_LSM_LOOKUP_NO_BLOOM 2008 5861/*! LSM: sleep for LSM checkpoint throttle */ 5862#define WT_STAT_DSRC_LSM_CHECKPOINT_THROTTLE 2009 5863/*! LSM: sleep for LSM merge throttle */ 5864#define WT_STAT_DSRC_LSM_MERGE_THROTTLE 2010 5865/*! LSM: total size of bloom filters */ 5866#define WT_STAT_DSRC_BLOOM_SIZE 2011 5867/*! block-manager: allocations requiring file extension */ 5868#define WT_STAT_DSRC_BLOCK_EXTENSION 2012 5869/*! block-manager: blocks allocated */ 5870#define WT_STAT_DSRC_BLOCK_ALLOC 2013 5871/*! block-manager: blocks freed */ 5872#define WT_STAT_DSRC_BLOCK_FREE 2014 5873/*! block-manager: checkpoint size */ 5874#define WT_STAT_DSRC_BLOCK_CHECKPOINT_SIZE 2015 5875/*! block-manager: file allocation unit size */ 5876#define WT_STAT_DSRC_ALLOCATION_SIZE 2016 5877/*! block-manager: file bytes available for reuse */ 5878#define WT_STAT_DSRC_BLOCK_REUSE_BYTES 2017 5879/*! block-manager: file magic number */ 5880#define WT_STAT_DSRC_BLOCK_MAGIC 2018 5881/*! block-manager: file major version number */ 5882#define WT_STAT_DSRC_BLOCK_MAJOR 2019 5883/*! block-manager: file size in bytes */ 5884#define WT_STAT_DSRC_BLOCK_SIZE 2020 5885/*! block-manager: minor version number */ 5886#define WT_STAT_DSRC_BLOCK_MINOR 2021 5887/*! btree: btree checkpoint generation */ 5888#define WT_STAT_DSRC_BTREE_CHECKPOINT_GENERATION 2022 5889/*! 5890 * btree: column-store fixed-size leaf pages, only reported if tree_walk 5891 * or all statistics are enabled 5892 */ 5893#define WT_STAT_DSRC_BTREE_COLUMN_FIX 2023 5894/*! 5895 * btree: column-store internal pages, only reported if tree_walk or all 5896 * statistics are enabled 5897 */ 5898#define WT_STAT_DSRC_BTREE_COLUMN_INTERNAL 2024 5899/*! 5900 * btree: column-store variable-size RLE encoded values, only reported if 5901 * tree_walk or all statistics are enabled 5902 */ 5903#define WT_STAT_DSRC_BTREE_COLUMN_RLE 2025 5904/*! 5905 * btree: column-store variable-size deleted values, only reported if 5906 * tree_walk or all statistics are enabled 5907 */ 5908#define WT_STAT_DSRC_BTREE_COLUMN_DELETED 2026 5909/*! 5910 * btree: column-store variable-size leaf pages, only reported if 5911 * tree_walk or all statistics are enabled 5912 */ 5913#define WT_STAT_DSRC_BTREE_COLUMN_VARIABLE 2027 5914/*! btree: fixed-record size */ 5915#define WT_STAT_DSRC_BTREE_FIXED_LEN 2028 5916/*! btree: maximum internal page key size */ 5917#define WT_STAT_DSRC_BTREE_MAXINTLKEY 2029 5918/*! btree: maximum internal page size */ 5919#define WT_STAT_DSRC_BTREE_MAXINTLPAGE 2030 5920/*! btree: maximum leaf page key size */ 5921#define WT_STAT_DSRC_BTREE_MAXLEAFKEY 2031 5922/*! btree: maximum leaf page size */ 5923#define WT_STAT_DSRC_BTREE_MAXLEAFPAGE 2032 5924/*! btree: maximum leaf page value size */ 5925#define WT_STAT_DSRC_BTREE_MAXLEAFVALUE 2033 5926/*! btree: maximum tree depth */ 5927#define WT_STAT_DSRC_BTREE_MAXIMUM_DEPTH 2034 5928/*! 5929 * btree: number of key/value pairs, only reported if tree_walk or all 5930 * statistics are enabled 5931 */ 5932#define WT_STAT_DSRC_BTREE_ENTRIES 2035 5933/*! 5934 * btree: overflow pages, only reported if tree_walk or all statistics 5935 * are enabled 5936 */ 5937#define WT_STAT_DSRC_BTREE_OVERFLOW 2036 5938/*! btree: pages rewritten by compaction */ 5939#define WT_STAT_DSRC_BTREE_COMPACT_REWRITE 2037 5940/*! 5941 * btree: row-store internal pages, only reported if tree_walk or all 5942 * statistics are enabled 5943 */ 5944#define WT_STAT_DSRC_BTREE_ROW_INTERNAL 2038 5945/*! 5946 * btree: row-store leaf pages, only reported if tree_walk or all 5947 * statistics are enabled 5948 */ 5949#define WT_STAT_DSRC_BTREE_ROW_LEAF 2039 5950/*! cache: bytes currently in the cache */ 5951#define WT_STAT_DSRC_CACHE_BYTES_INUSE 2040 5952/*! cache: bytes read into cache */ 5953#define WT_STAT_DSRC_CACHE_BYTES_READ 2041 5954/*! cache: bytes written from cache */ 5955#define WT_STAT_DSRC_CACHE_BYTES_WRITE 2042 5956/*! cache: checkpoint blocked page eviction */ 5957#define WT_STAT_DSRC_CACHE_EVICTION_CHECKPOINT 2043 5958/*! cache: data source pages selected for eviction unable to be evicted */ 5959#define WT_STAT_DSRC_CACHE_EVICTION_FAIL 2044 5960/*! cache: eviction walk passes of a file */ 5961#define WT_STAT_DSRC_CACHE_EVICTION_WALK_PASSES 2045 5962/*! cache: eviction walk target pages histogram - 0-9 */ 5963#define WT_STAT_DSRC_CACHE_EVICTION_TARGET_PAGE_LT10 2046 5964/*! cache: eviction walk target pages histogram - 10-31 */ 5965#define WT_STAT_DSRC_CACHE_EVICTION_TARGET_PAGE_LT32 2047 5966/*! cache: eviction walk target pages histogram - 128 and higher */ 5967#define WT_STAT_DSRC_CACHE_EVICTION_TARGET_PAGE_GE128 2048 5968/*! cache: eviction walk target pages histogram - 32-63 */ 5969#define WT_STAT_DSRC_CACHE_EVICTION_TARGET_PAGE_LT64 2049 5970/*! cache: eviction walk target pages histogram - 64-128 */ 5971#define WT_STAT_DSRC_CACHE_EVICTION_TARGET_PAGE_LT128 2050 5972/*! cache: eviction walks abandoned */ 5973#define WT_STAT_DSRC_CACHE_EVICTION_WALKS_ABANDONED 2051 5974/*! cache: eviction walks gave up because they restarted their walk twice */ 5975#define WT_STAT_DSRC_CACHE_EVICTION_WALKS_STOPPED 2052 5976/*! 5977 * cache: eviction walks gave up because they saw too many pages and 5978 * found no candidates 5979 */ 5980#define WT_STAT_DSRC_CACHE_EVICTION_WALKS_GAVE_UP_NO_TARGETS 2053 5981/*! 5982 * cache: eviction walks gave up because they saw too many pages and 5983 * found too few candidates 5984 */ 5985#define WT_STAT_DSRC_CACHE_EVICTION_WALKS_GAVE_UP_RATIO 2054 5986/*! cache: eviction walks reached end of tree */ 5987#define WT_STAT_DSRC_CACHE_EVICTION_WALKS_ENDED 2055 5988/*! cache: eviction walks started from root of tree */ 5989#define WT_STAT_DSRC_CACHE_EVICTION_WALK_FROM_ROOT 2056 5990/*! cache: eviction walks started from saved location in tree */ 5991#define WT_STAT_DSRC_CACHE_EVICTION_WALK_SAVED_POS 2057 5992/*! cache: hazard pointer blocked page eviction */ 5993#define WT_STAT_DSRC_CACHE_EVICTION_HAZARD 2058 5994/*! cache: in-memory page passed criteria to be split */ 5995#define WT_STAT_DSRC_CACHE_INMEM_SPLITTABLE 2059 5996/*! cache: in-memory page splits */ 5997#define WT_STAT_DSRC_CACHE_INMEM_SPLIT 2060 5998/*! cache: internal pages evicted */ 5999#define WT_STAT_DSRC_CACHE_EVICTION_INTERNAL 2061 6000/*! cache: internal pages split during eviction */ 6001#define WT_STAT_DSRC_CACHE_EVICTION_SPLIT_INTERNAL 2062 6002/*! cache: leaf pages split during eviction */ 6003#define WT_STAT_DSRC_CACHE_EVICTION_SPLIT_LEAF 2063 6004/*! cache: modified pages evicted */ 6005#define WT_STAT_DSRC_CACHE_EVICTION_DIRTY 2064 6006/*! cache: overflow pages read into cache */ 6007#define WT_STAT_DSRC_CACHE_READ_OVERFLOW 2065 6008/*! cache: page split during eviction deepened the tree */ 6009#define WT_STAT_DSRC_CACHE_EVICTION_DEEPEN 2066 6010/*! cache: page written requiring cache overflow records */ 6011#define WT_STAT_DSRC_CACHE_WRITE_LOOKASIDE 2067 6012/*! cache: pages read into cache */ 6013#define WT_STAT_DSRC_CACHE_READ 2068 6014/*! cache: pages read into cache after truncate */ 6015#define WT_STAT_DSRC_CACHE_READ_DELETED 2069 6016/*! cache: pages read into cache after truncate in prepare state */ 6017#define WT_STAT_DSRC_CACHE_READ_DELETED_PREPARED 2070 6018/*! cache: pages read into cache requiring cache overflow entries */ 6019#define WT_STAT_DSRC_CACHE_READ_LOOKASIDE 2071 6020/*! cache: pages requested from the cache */ 6021#define WT_STAT_DSRC_CACHE_PAGES_REQUESTED 2072 6022/*! cache: pages seen by eviction walk */ 6023#define WT_STAT_DSRC_CACHE_EVICTION_PAGES_SEEN 2073 6024/*! cache: pages written from cache */ 6025#define WT_STAT_DSRC_CACHE_WRITE 2074 6026/*! cache: pages written requiring in-memory restoration */ 6027#define WT_STAT_DSRC_CACHE_WRITE_RESTORE 2075 6028/*! cache: tracked dirty bytes in the cache */ 6029#define WT_STAT_DSRC_CACHE_BYTES_DIRTY 2076 6030/*! cache: unmodified pages evicted */ 6031#define WT_STAT_DSRC_CACHE_EVICTION_CLEAN 2077 6032/*! 6033 * cache_walk: Average difference between current eviction generation 6034 * when the page was last considered, only reported if cache_walk or all 6035 * statistics are enabled 6036 */ 6037#define WT_STAT_DSRC_CACHE_STATE_GEN_AVG_GAP 2078 6038/*! 6039 * cache_walk: Average on-disk page image size seen, only reported if 6040 * cache_walk or all statistics are enabled 6041 */ 6042#define WT_STAT_DSRC_CACHE_STATE_AVG_WRITTEN_SIZE 2079 6043/*! 6044 * cache_walk: Average time in cache for pages that have been visited by 6045 * the eviction server, only reported if cache_walk or all statistics are 6046 * enabled 6047 */ 6048#define WT_STAT_DSRC_CACHE_STATE_AVG_VISITED_AGE 2080 6049/*! 6050 * cache_walk: Average time in cache for pages that have not been visited 6051 * by the eviction server, only reported if cache_walk or all statistics 6052 * are enabled 6053 */ 6054#define WT_STAT_DSRC_CACHE_STATE_AVG_UNVISITED_AGE 2081 6055/*! 6056 * cache_walk: Clean pages currently in cache, only reported if 6057 * cache_walk or all statistics are enabled 6058 */ 6059#define WT_STAT_DSRC_CACHE_STATE_PAGES_CLEAN 2082 6060/*! 6061 * cache_walk: Current eviction generation, only reported if cache_walk 6062 * or all statistics are enabled 6063 */ 6064#define WT_STAT_DSRC_CACHE_STATE_GEN_CURRENT 2083 6065/*! 6066 * cache_walk: Dirty pages currently in cache, only reported if 6067 * cache_walk or all statistics are enabled 6068 */ 6069#define WT_STAT_DSRC_CACHE_STATE_PAGES_DIRTY 2084 6070/*! 6071 * cache_walk: Entries in the root page, only reported if cache_walk or 6072 * all statistics are enabled 6073 */ 6074#define WT_STAT_DSRC_CACHE_STATE_ROOT_ENTRIES 2085 6075/*! 6076 * cache_walk: Internal pages currently in cache, only reported if 6077 * cache_walk or all statistics are enabled 6078 */ 6079#define WT_STAT_DSRC_CACHE_STATE_PAGES_INTERNAL 2086 6080/*! 6081 * cache_walk: Leaf pages currently in cache, only reported if cache_walk 6082 * or all statistics are enabled 6083 */ 6084#define WT_STAT_DSRC_CACHE_STATE_PAGES_LEAF 2087 6085/*! 6086 * cache_walk: Maximum difference between current eviction generation 6087 * when the page was last considered, only reported if cache_walk or all 6088 * statistics are enabled 6089 */ 6090#define WT_STAT_DSRC_CACHE_STATE_GEN_MAX_GAP 2088 6091/*! 6092 * cache_walk: Maximum page size seen, only reported if cache_walk or all 6093 * statistics are enabled 6094 */ 6095#define WT_STAT_DSRC_CACHE_STATE_MAX_PAGESIZE 2089 6096/*! 6097 * cache_walk: Minimum on-disk page image size seen, only reported if 6098 * cache_walk or all statistics are enabled 6099 */ 6100#define WT_STAT_DSRC_CACHE_STATE_MIN_WRITTEN_SIZE 2090 6101/*! 6102 * cache_walk: Number of pages never visited by eviction server, only 6103 * reported if cache_walk or all statistics are enabled 6104 */ 6105#define WT_STAT_DSRC_CACHE_STATE_UNVISITED_COUNT 2091 6106/*! 6107 * cache_walk: On-disk page image sizes smaller than a single allocation 6108 * unit, only reported if cache_walk or all statistics are enabled 6109 */ 6110#define WT_STAT_DSRC_CACHE_STATE_SMALLER_ALLOC_SIZE 2092 6111/*! 6112 * cache_walk: Pages created in memory and never written, only reported 6113 * if cache_walk or all statistics are enabled 6114 */ 6115#define WT_STAT_DSRC_CACHE_STATE_MEMORY 2093 6116/*! 6117 * cache_walk: Pages currently queued for eviction, only reported if 6118 * cache_walk or all statistics are enabled 6119 */ 6120#define WT_STAT_DSRC_CACHE_STATE_QUEUED 2094 6121/*! 6122 * cache_walk: Pages that could not be queued for eviction, only reported 6123 * if cache_walk or all statistics are enabled 6124 */ 6125#define WT_STAT_DSRC_CACHE_STATE_NOT_QUEUEABLE 2095 6126/*! 6127 * cache_walk: Refs skipped during cache traversal, only reported if 6128 * cache_walk or all statistics are enabled 6129 */ 6130#define WT_STAT_DSRC_CACHE_STATE_REFS_SKIPPED 2096 6131/*! 6132 * cache_walk: Size of the root page, only reported if cache_walk or all 6133 * statistics are enabled 6134 */ 6135#define WT_STAT_DSRC_CACHE_STATE_ROOT_SIZE 2097 6136/*! 6137 * cache_walk: Total number of pages currently in cache, only reported if 6138 * cache_walk or all statistics are enabled 6139 */ 6140#define WT_STAT_DSRC_CACHE_STATE_PAGES 2098 6141/*! compression: compressed pages read */ 6142#define WT_STAT_DSRC_COMPRESS_READ 2099 6143/*! compression: compressed pages written */ 6144#define WT_STAT_DSRC_COMPRESS_WRITE 2100 6145/*! compression: page written failed to compress */ 6146#define WT_STAT_DSRC_COMPRESS_WRITE_FAIL 2101 6147/*! compression: page written was too small to compress */ 6148#define WT_STAT_DSRC_COMPRESS_WRITE_TOO_SMALL 2102 6149/*! compression: raw compression call failed, additional data available */ 6150#define WT_STAT_DSRC_COMPRESS_RAW_FAIL_TEMPORARY 2103 6151/*! compression: raw compression call failed, no additional data available */ 6152#define WT_STAT_DSRC_COMPRESS_RAW_FAIL 2104 6153/*! compression: raw compression call succeeded */ 6154#define WT_STAT_DSRC_COMPRESS_RAW_OK 2105 6155/*! cursor: bulk-loaded cursor-insert calls */ 6156#define WT_STAT_DSRC_CURSOR_INSERT_BULK 2106 6157/*! cursor: close calls that result in cache */ 6158#define WT_STAT_DSRC_CURSOR_CACHE 2107 6159/*! cursor: create calls */ 6160#define WT_STAT_DSRC_CURSOR_CREATE 2108 6161/*! cursor: cursor operation restarted */ 6162#define WT_STAT_DSRC_CURSOR_RESTART 2109 6163/*! cursor: cursor-insert key and value bytes inserted */ 6164#define WT_STAT_DSRC_CURSOR_INSERT_BYTES 2110 6165/*! cursor: cursor-remove key bytes removed */ 6166#define WT_STAT_DSRC_CURSOR_REMOVE_BYTES 2111 6167/*! cursor: cursor-update value bytes updated */ 6168#define WT_STAT_DSRC_CURSOR_UPDATE_BYTES 2112 6169/*! cursor: cursors reused from cache */ 6170#define WT_STAT_DSRC_CURSOR_REOPEN 2113 6171/*! cursor: insert calls */ 6172#define WT_STAT_DSRC_CURSOR_INSERT 2114 6173/*! cursor: modify calls */ 6174#define WT_STAT_DSRC_CURSOR_MODIFY 2115 6175/*! cursor: next calls */ 6176#define WT_STAT_DSRC_CURSOR_NEXT 2116 6177/*! cursor: open cursor count */ 6178#define WT_STAT_DSRC_CURSOR_OPEN_COUNT 2117 6179/*! cursor: prev calls */ 6180#define WT_STAT_DSRC_CURSOR_PREV 2118 6181/*! cursor: remove calls */ 6182#define WT_STAT_DSRC_CURSOR_REMOVE 2119 6183/*! cursor: reserve calls */ 6184#define WT_STAT_DSRC_CURSOR_RESERVE 2120 6185/*! cursor: reset calls */ 6186#define WT_STAT_DSRC_CURSOR_RESET 2121 6187/*! cursor: search calls */ 6188#define WT_STAT_DSRC_CURSOR_SEARCH 2122 6189/*! cursor: search near calls */ 6190#define WT_STAT_DSRC_CURSOR_SEARCH_NEAR 2123 6191/*! cursor: truncate calls */ 6192#define WT_STAT_DSRC_CURSOR_TRUNCATE 2124 6193/*! cursor: update calls */ 6194#define WT_STAT_DSRC_CURSOR_UPDATE 2125 6195/*! reconciliation: dictionary matches */ 6196#define WT_STAT_DSRC_REC_DICTIONARY 2126 6197/*! reconciliation: fast-path pages deleted */ 6198#define WT_STAT_DSRC_REC_PAGE_DELETE_FAST 2127 6199/*! 6200 * reconciliation: internal page key bytes discarded using suffix 6201 * compression 6202 */ 6203#define WT_STAT_DSRC_REC_SUFFIX_COMPRESSION 2128 6204/*! reconciliation: internal page multi-block writes */ 6205#define WT_STAT_DSRC_REC_MULTIBLOCK_INTERNAL 2129 6206/*! reconciliation: internal-page overflow keys */ 6207#define WT_STAT_DSRC_REC_OVERFLOW_KEY_INTERNAL 2130 6208/*! reconciliation: leaf page key bytes discarded using prefix compression */ 6209#define WT_STAT_DSRC_REC_PREFIX_COMPRESSION 2131 6210/*! reconciliation: leaf page multi-block writes */ 6211#define WT_STAT_DSRC_REC_MULTIBLOCK_LEAF 2132 6212/*! reconciliation: leaf-page overflow keys */ 6213#define WT_STAT_DSRC_REC_OVERFLOW_KEY_LEAF 2133 6214/*! reconciliation: maximum blocks required for a page */ 6215#define WT_STAT_DSRC_REC_MULTIBLOCK_MAX 2134 6216/*! reconciliation: overflow values written */ 6217#define WT_STAT_DSRC_REC_OVERFLOW_VALUE 2135 6218/*! reconciliation: page checksum matches */ 6219#define WT_STAT_DSRC_REC_PAGE_MATCH 2136 6220/*! reconciliation: page reconciliation calls */ 6221#define WT_STAT_DSRC_REC_PAGES 2137 6222/*! reconciliation: page reconciliation calls for eviction */ 6223#define WT_STAT_DSRC_REC_PAGES_EVICTION 2138 6224/*! reconciliation: pages deleted */ 6225#define WT_STAT_DSRC_REC_PAGE_DELETE 2139 6226/*! session: object compaction */ 6227#define WT_STAT_DSRC_SESSION_COMPACT 2140 6228/*! transaction: update conflicts */ 6229#define WT_STAT_DSRC_TXN_UPDATE_CONFLICT 2141 6230 6231/*! 6232 * @} 6233 * @name Statistics for join cursors 6234 * @anchor statistics_join 6235 * @{ 6236 */ 6237/*! : accesses to the main table */ 6238#define WT_STAT_JOIN_MAIN_ACCESS 3000 6239/*! : bloom filter false positives */ 6240#define WT_STAT_JOIN_BLOOM_FALSE_POSITIVE 3001 6241/*! : checks that conditions of membership are satisfied */ 6242#define WT_STAT_JOIN_MEMBERSHIP_CHECK 3002 6243/*! : items inserted into a bloom filter */ 6244#define WT_STAT_JOIN_BLOOM_INSERT 3003 6245/*! : items iterated */ 6246#define WT_STAT_JOIN_ITERATED 3004 6247/*! @} */ 6248/* 6249 * Statistics section: END 6250 * DO NOT EDIT: automatically built by dist/api_stat.py. 6251 */ 6252/*! @} */ 6253 6254#undef __F 6255 6256#if defined(__cplusplus) 6257} 6258#endif 6259#endif /* __WIREDTIGER_H_ */ 6260