diff options
-rw-r--r-- | build_posix/Make.subdirs | 2 | ||||
-rw-r--r-- | dist/api_data.py | 21 | ||||
-rw-r--r-- | dist/filelist | 2 | ||||
-rw-r--r-- | src/config/config_def.c | 13 | ||||
-rw-r--r-- | src/conn/conn_btree.c | 33 | ||||
-rw-r--r-- | src/cursor/cur_std.c | 2 | ||||
-rw-r--r-- | src/docs/checkpoints.dox | 44 | ||||
-rw-r--r-- | src/docs/command-line.dox | 16 | ||||
-rw-r--r-- | src/docs/programming.dox | 2 | ||||
-rw-r--r-- | src/docs/snapshots.dox | 44 | ||||
-rw-r--r-- | src/docs/spell.ok | 2 | ||||
-rw-r--r-- | src/docs/transactions.dox | 8 | ||||
-rw-r--r-- | src/docs/upgrading.dox | 14 | ||||
-rw-r--r-- | src/include/btree.h | 5 | ||||
-rw-r--r-- | src/include/extern.h | 4 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 20 | ||||
-rw-r--r-- | src/session/session_btree.c | 34 | ||||
-rw-r--r-- | src/txn/txn_snapshot.c (renamed from src/session/session_snapshot.c) | 0 | ||||
-rw-r--r-- | src/utilities/util_dump.c | 23 | ||||
-rw-r--r-- | src/utilities/util_list.c | 41 | ||||
-rw-r--r-- | test/checkpoint/Makefile.am (renamed from test/snapshot/Makefile.am) | 2 | ||||
-rw-r--r-- | test/checkpoint/checkpoint.c (renamed from test/snapshot/snapshot.c) | 82 | ||||
-rw-r--r-- | test/fops/file.c | 2 | ||||
-rw-r--r-- | test/format/wts_ops.c | 2 |
24 files changed, 215 insertions, 203 deletions
diff --git a/build_posix/Make.subdirs b/build_posix/Make.subdirs index 80716035795..cd60340426f 100644 --- a/build_posix/Make.subdirs +++ b/build_posix/Make.subdirs @@ -12,8 +12,8 @@ ext/compressors/bzip2_compress BZIP2 ext/compressors/nop_compress ext/compressors/snappy_compress SNAPPY lang/python PYTHON +test/checkpoint test/fops test/format HAVE_BDB test/salvage -test/snapshot test/thread diff --git a/dist/api_data.py b/dist/api_data.py index cb0eb2f3cf1..b1793cf3eac 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -222,6 +222,8 @@ methods = { load path for empty objects, only empty objects may be bulk-loaded''', type='boolean'), + Config('checkpoint', '', r''' + the name of a checkpoint to open'''), Config('dump', '', r''' configure the cursor for dump format inputs and outputs: "hex" selects a simple hexadecimal format, "print" @@ -241,8 +243,6 @@ methods = { ignore the encodings for the key and value, manage data as if the formats were \c "u". See @ref cursor_raw for details''', type='boolean'), - Config('snapshot', '', r''' - the name of a snapshot to open'''), Config('statistics', 'false', r''' configure the cursor for statistics''', type='boolean'), @@ -283,15 +283,15 @@ methods = { 'session.checkpoint' : Method([ Config('drop', '', r''' - specify a list of snapshots to drop. + specify a list of checkpoints to drop. The list may additionally contain one of the following keys: - \c "from=all" to drop all snapshots, - \c "from=<snapshot>" to drop all snapshots after and - including the named snapshot, or - \c "to=<snapshot>" to drop all snapshots before and - including the named snapshot''', type='list'), + \c "from=all" to drop all checkpoints, + \c "from=<checkpoint>" to drop all checkpoints after and + including the named checkpoint, or + \c "to=<checkpoint>" to drop all checkpoints before and + including the named checkpoint''', type='list'), Config('name', '', r''' - if non-empty, specify a name for the snapshot'''), + if non-empty, specify a name for the checkpoint'''), Config('target', '', r''' if non-empty, checkpoint the list of objects''', type='list'), ]), @@ -360,7 +360,8 @@ methods = { threads)''', min='1'), Config('sync', 'true', r''' - sync files when closing or writing snapshots''', + flush files to stable storage when closing or writing + checkpoints''', type='boolean'), Config('transactional', 'true', r''' support transactional semantics''', diff --git a/dist/filelist b/dist/filelist index 50506078dc6..70cd5819540 100644 --- a/dist/filelist +++ b/dist/filelist @@ -104,7 +104,6 @@ src/schema/schema_worker.c src/session/session_api.c src/session/session_btree.c src/session/session_salvage.c -src/session/session_snapshot.c src/support/err.c src/support/filename.c src/support/global.c @@ -117,3 +116,4 @@ src/support/scratch.c src/support/sess_dump.c src/support/stat.c src/txn/txn.c +src/txn/txn_snapshot.c diff --git a/src/config/config_def.c b/src/config/config_def.c index 430e5b1580f..34c22c0ce43 100644 --- a/src/config/config_def.c +++ b/src/config/config_def.c @@ -186,15 +186,16 @@ __wt_confchk_session_log_printf = const char * __wt_confdfl_session_open_cursor = - "append=false,bulk=false,dump="",isolation=read-committed,overwrite=false" - ",raw=false,snapshot="",statistics=false,statistics_clear=false"; + "append=false,bulk=false,checkpoint="",dump="",isolation=read-committed," + "overwrite=false,raw=false,statistics=false,statistics_clear=false"; const char * __wt_confchk_session_open_cursor = - "append=(type=boolean),bulk=(type=boolean),dump=(choices=[\"hex\"," - "\"print\"]),isolation=(choices=[\"snapshot\",\"read-committed\"," - "\"read-uncommitted\"]),overwrite=(type=boolean),raw=(type=boolean)," - "snapshot=(),statistics=(type=boolean),statistics_clear=(type=boolean)"; + "append=(type=boolean),bulk=(type=boolean),checkpoint=()," + "dump=(choices=[\"hex\",\"print\"]),isolation=(choices=[\"snapshot\"," + "\"read-committed\",\"read-uncommitted\"]),overwrite=(type=boolean)," + "raw=(type=boolean),statistics=(type=boolean)," + "statistics_clear=(type=boolean)"; const char * __wt_confdfl_session_rename = diff --git a/src/conn/conn_btree.c b/src/conn/conn_btree.c index 1a113f59145..236858a9c9f 100644 --- a/src/conn/conn_btree.c +++ b/src/conn/conn_btree.c @@ -75,7 +75,7 @@ __wt_conn_btree_open_lock(WT_SESSION_IMPL *session, uint32_t flags) */ static int __conn_btree_get(WT_SESSION_IMPL *session, - const char *name, const char *snapshot, uint32_t flags) + const char *name, const char *ckpt, uint32_t flags) { WT_BTREE *btree; WT_CONNECTION_IMPL *conn; @@ -89,9 +89,9 @@ __conn_btree_get(WT_SESSION_IMPL *session, __wt_spin_lock(session, &conn->spinlock); TAILQ_FOREACH(btree, &conn->btqh, q) { if (strcmp(name, btree->name) == 0 && - ((snapshot == NULL && btree->snapshot == NULL) || - (snapshot != NULL && btree->snapshot != NULL && - strcmp(snapshot, btree->snapshot) == 0))) { + ((ckpt == NULL && btree->ckpt == NULL) || + (ckpt != NULL && btree->ckpt != NULL && + strcmp(ckpt, btree->ckpt) == 0))) { ++btree->refcnt; session->btree = btree; matched = 1; @@ -113,8 +113,8 @@ __conn_btree_get(WT_SESSION_IMPL *session, (ret = __wt_rwlock_alloc( session, "btree handle", &btree->rwlock)) == 0 && (ret = __wt_strdup(session, name, &btree->name)) == 0 && - (snapshot == NULL || - (ret = __wt_strdup(session, snapshot, &btree->snapshot)) == 0)) { + (ckpt == NULL || + (ret = __wt_strdup(session, ckpt, &btree->ckpt)) == 0)) { /* Lock the handle before it is inserted in the list. */ __wt_writelock(session, btree->rwlock); F_SET(btree, WT_BTREE_EXCLUSIVE); @@ -132,7 +132,7 @@ __conn_btree_get(WT_SESSION_IMPL *session, if (btree->rwlock != NULL) __wt_rwlock_destroy(session, &btree->rwlock); __wt_free(session, btree->name); - __wt_free(session, btree->snapshot); + __wt_free(session, btree->ckpt); __wt_overwrite_and_free(session, btree); } @@ -208,9 +208,9 @@ __wt_conn_btree_open(WT_SESSION_IMPL *session, do { WT_ERR(__wt_meta_snapshot_get( - session, btree->name, btree->snapshot, addr)); + session, btree->name, btree->ckpt, addr)); WT_ERR(__wt_btree_open(session, addr->data, addr->size, cfg, - btree->snapshot == NULL ? 0 : 1)); + btree->ckpt == NULL ? 0 : 1)); F_SET(btree, WT_BTREE_OPEN); /* Drop back to a readlock if that is all that was needed. */ @@ -235,8 +235,7 @@ err: (void)__wt_conn_btree_close(session, 1); */ int __wt_conn_btree_get(WT_SESSION_IMPL *session, - const char *name, const char *snapshot, - const char *cfg[], uint32_t flags) + const char *name, const char *ckpt, const char *cfg[], uint32_t flags) { WT_BTREE *btree; WT_CONNECTION_IMPL *conn; @@ -255,7 +254,7 @@ __wt_conn_btree_get(WT_SESSION_IMPL *session, else locked = 0; } else { - WT_RET(__conn_btree_get(session, name, snapshot, flags)); + WT_RET(__conn_btree_get(session, name, ckpt, flags)); btree = session->btree; } @@ -283,8 +282,8 @@ err: if (ret != 0 && locked) { /* * __wt_conn_btree_apply -- - * Apply a function to all open, non-snapshot btree handles apart from the - * metadata file. + * Apply a function to all open, non-checkpoint btree handles apart from + * the metadata file. */ int __wt_conn_btree_apply(WT_SESSION_IMPL *session, @@ -300,7 +299,7 @@ __wt_conn_btree_apply(WT_SESSION_IMPL *session, __wt_spin_lock(session, &conn->spinlock); TAILQ_FOREACH(btree, &conn->btqh, q) if (F_ISSET(btree, WT_BTREE_OPEN) && - btree->snapshot == NULL && + btree->ckpt == NULL && strcmp(btree->name, WT_METADATA_URI) != 0) { /* * We have the connection spinlock, which prevents @@ -370,7 +369,7 @@ __wt_conn_btree_close(WT_SESSION_IMPL *session, int locked) /* * __wt_conn_btree_close_all -- * Close all btree handles handles with matching name (including all - * snapshot handles). + * checkpoint handles). */ int __wt_conn_btree_close_all(WT_SESSION_IMPL *session, const char *name) @@ -454,7 +453,7 @@ __conn_btree_discard(WT_SESSION_IMPL *session, WT_BTREE *btree) __wt_rwlock_destroy(session, &btree->rwlock); __wt_free(session, btree->config); __wt_free(session, btree->name); - __wt_free(session, btree->snapshot); + __wt_free(session, btree->ckpt); __wt_overwrite_and_free(session, btree); return (ret); diff --git a/src/cursor/cur_std.c b/src/cursor/cur_std.c index c2bc71dae73..293c95d6467 100644 --- a/src/cursor/cur_std.c +++ b/src/cursor/cur_std.c @@ -427,7 +427,7 @@ __wt_cursor_init(WT_CURSOR *cursor, F_SET(cursor, WT_CURSTD_RAW); /* Snapshot cursors are read-only. */ - WT_RET(__wt_config_gets(session, cfg, "snapshot", &cval)); + WT_RET(__wt_config_gets(session, cfg, "checkpoint", &cval)); if (cval.len != 0) { cursor->insert = (int (*)(WT_CURSOR *))__wt_cursor_notsup; cursor->update = (int (*)(WT_CURSOR *))__wt_cursor_notsup; diff --git a/src/docs/checkpoints.dox b/src/docs/checkpoints.dox new file mode 100644 index 00000000000..07b4dfc3900 --- /dev/null +++ b/src/docs/checkpoints.dox @@ -0,0 +1,44 @@ +/*! @page checkpoints Checkpoints + +WiredTiger supports checkpoints, a read-only, static view of one or +more data sources. + +Checkpoints offer basic operation durability without transactional +logging, across application or system failure. (Transactional logging +offers fine-grained durability, but requires a recovery step when files +are first opened, and impacts the performance of every operation; +checkpoints offer durability without recovery or impacting performance, +but the creation of a checkpoint is a relatively heavy-weight operation. +WiredTiger does not yet support transactional logging.) + +Checkpoints are automatically created whenever a modified data source is +closed. + +When WiredTiger data sources are first opened, they are opened in the +state of the most recent checkpoint taken on the file, in other words, +updates after the most recent checkpoint will not appear in the data +source. If no checkpoint is found when the data source is opened, the +data source will appear empty. + +Checkpoints may optionally be named. Named checkpoints are created and +discarded using the WT_SESSION::checkpoint method and read using the +WT_SESSION::open_cursor method. Additionally, the \c -c option to the +\c wt command line utility \c list command will list a data source's +checkpoints in a human-readable format. + +Cursors are opened in the most recent version of a data source unless a +checkpoint name is provided to WT_SESSION::open_cursor. Cursors opened +in the most recent version of a data source support write operations, +cursors opened in a checkpoint are read-only. + +Named checkpoints persist until explicitly dropped. Checkpoints share +pages, and deleting a checkpoint may or may not make pages available for +re-use, depending on whether the dropped checkpoint contained the last +reference to a block of data. Creating a named checkpoint automatically +discards any other checkpoint with the same name (unless they are +currently open in a cursor). + +Unnamed checkpoints managed by WiredTiger are given the name +"WiredTigerInternal". + + */ diff --git a/src/docs/command-line.dox b/src/docs/command-line.dox index 639d88b0ca3..2ed7887a4c4 100644 --- a/src/docs/command-line.dox +++ b/src/docs/command-line.dox @@ -66,11 +66,15 @@ which can be re-loaded into a new table using the \c load command. See @subpage dump_formats for details of the dump file formats. @subsection utility_dump_synopsis Synopsis -<code>wt [-Vv] [-C config] [-h directory] dump [-rx] [-f output] [-s snapshot] uri</code> +<code>wt [-Vv] [-C config] [-h directory] dump [-rx] [-c checkpoint] [-f output] uri</code> @subsection utility_dump_options Options The following are command-specific options for the \c dump command: +@par <code>-c</code> +By default, the \c dump command opens the most recent version of the object; +the \c -c option changes the \c dump command to open the named checkpoint. + @par <code>-f</code> By default, the \c dump command output is written to the standard output; the \c -f option re-directs the output to the specified file. @@ -78,10 +82,6 @@ the \c -f option re-directs the output to the specified file. @par <code>-r</code> Dump in reverse order, from largest to smallest. -@par <code>-s</code> -By default, the \c dump command opens the most recent snapshot of the object; -the \c -s option changes the \c dump command to open the named snapshot. - @par <code>-x</code> Dump all characters in a hexadecimal encoding (the default is to leave printable characters unencoded). @@ -114,13 +114,13 @@ in the database. If an object name is specified as an argument, only information about that object is printed. @subsection utility_list_synopsis Synopsis -<code>wt [-Vv] [-C config] [-h directory] list [-sv] [uri]</code> +<code>wt [-Vv] [-C config] [-h directory] list [-cv] [uri]</code> @subsection utility_list_options Options The following are command-specific options for the \c list command: -@par <code>-s</code> -If the \c -s option is specified, the object's snapshots are printed +@par <code>-c</code> +If the \c -c option is specified, the object's checkpoints are printed in a human-readable format. @par <code>-v</code> diff --git a/src/docs/programming.dox b/src/docs/programming.dox index f4041679dbb..b4e2c8cecf5 100644 --- a/src/docs/programming.dox +++ b/src/docs/programming.dox @@ -7,7 +7,7 @@ This section explains how to write applications that use WiredTiger: - @subpage schema - @subpage cursors - @subpage threads -- @subpage snapshots +- @subpage checkpoints - @subpage transactions - @subpage compression - @subpage name_space diff --git a/src/docs/snapshots.dox b/src/docs/snapshots.dox deleted file mode 100644 index 4465dbe5546..00000000000 --- a/src/docs/snapshots.dox +++ /dev/null @@ -1,44 +0,0 @@ -/*! @page snapshots Snapshots - -WiredTiger supports snapshots, a read-only, static view of a data -source. - -Snapshots offer basic operation durability without transactional -logging, across application or system failure. (Transactional logging -offers fine-grained durability, but requires a recovery step when files -are first opened, and impacts the performance of every operation; -snapshots offer durability without recovery or impacting performance, -but the creation of a snapshot is a relatively heavy-weight operation. -WiredTiger does not yet support transactional logging.) - -Snapshots are automatically created whenever a modified data source is -closed. - -When WiredTiger data sources are first opened, they are opened in the -state of the most recent snapshot taken on the file, in other words, -updates after the most recent snapshot will not appear in the data -source. If no snapshot is found when the data source is opened, the -data source will appear empty. - -Snapshots may optionally be named. Named snapshots are created and -discarded using the WT_SESSION::checkpoint method and read using the -WT_SESSION::open_cursor method. Additionally, the \c -s option to the -\c wt command line utility will list a data source's snapshots in a -human-readable format. - -Cursors are opened in the current working version of a data source -unless a snapshot name is provided to WT_SESSION::open_cursor. Cursors -opened in the current working version of a data source support write -operations, cursors opened in a snapshot are read-only. - -Named snapshots persist until they are explicitly dropped. Snapshots -share pages, and deleting a snapshot may or may not make pages available -for re-use, depending on whether the dropped snapshot contained the last -reference to a block of data. Creating a named snapshot automatically -discards any other snapshots with the same name (unless they are -currently open in a cursor). - -Unnamed snapshots managed by WiredTiger are given the name -"WiredTigerInternal". - - */ diff --git a/src/docs/spell.ok b/src/docs/spell.ok index 027c6623ecd..7c4f5480cc0 100644 --- a/src/docs/spell.ok +++ b/src/docs/spell.ok @@ -73,6 +73,7 @@ control's cpp crashless cursortype +cv dN dNLen dNOff @@ -257,7 +258,6 @@ structs subdatabases subpage superset -sv tablename tcl tcmalloc diff --git a/src/docs/transactions.dox b/src/docs/transactions.dox index b94515c007c..fa8a3d3c459 100644 --- a/src/docs/transactions.dox +++ b/src/docs/transactions.dox @@ -71,10 +71,10 @@ Recovery is run automatically when a data source is opened. Any changes since the last checkpoint are discarded, and the application restarts from a consistent point in the transaction history. -This suggests the importance of regular checkpoints: they limit the volume of -commits that may be lost in a crash. Checkpoints create a snapshot in every -data source in the database. See WT_SESSION::checkpoint for information about -checkpoints, and @ref snapshots for information about snapshots. +This suggests the importance of regular checkpoints: they limit the +volume of commits that may be lost in a crash. See +WT_SESSION::checkpoint and @ref checkpoints for further information +about checkpoints. @section transaction_example Code samples diff --git a/src/docs/upgrading.dox b/src/docs/upgrading.dox index dede4b58896..ca5a408d640 100644 --- a/src/docs/upgrading.dox +++ b/src/docs/upgrading.dox @@ -2,6 +2,11 @@ @section version13 Version 1.3 +The checkpoint functionality supported by WT_SESSION::checkpoint and the +snapshot functionality supported by WT_SESSION::sync have been merged +into a single piece of functionality, and applications no longer have +access to object-level snapshots. + @par WT_SESSION.checkpoint The WT_SESSION::checkpoint method's \c snapshot configuration string has been renamed to \c name. @@ -21,7 +26,12 @@ one or more objects is done using the WT_SESSION::checkpoint method's \c target configuration string. @par wt drop -s -The \c -s option to the \c drop command for the command line utility -\c wt has been removed. +The \c -s option to the \c drop command for the \c wt command line +utility has been removed, and object snapshots may no longer be removed +from the command line. + +@par wt dump, list -s +The \c -s options to the \c dump and \c list commands for the \c wt +command line utility have been renamed to be \c -c. */ diff --git a/src/include/btree.h b/src/include/btree.h index 3873589f94e..e713107e10e 100644 --- a/src/include/btree.h +++ b/src/include/btree.h @@ -72,10 +72,11 @@ struct __wt_btree { const char *name; /* Object name as a URI */ const char *config; /* Configuration string */ - const char *snapshot; /* Snapshot name (or NULL) */ + const char *ckpt; /* Checkpoint name (or NULL) */ /* XXX Should move into the session-level handle information. */ WT_RWLOCK *snaplock; /* Lock for snapshot creation */ + WT_SNAPSHOT *snap; /* Snapshot information */ enum { BTREE_COL_FIX=1, /* Fixed-length column store */ BTREE_COL_VAR=2, /* Variable-length column store */ @@ -107,8 +108,6 @@ struct __wt_btree { WT_PAGE *root_page; /* Root page */ - WT_SNAPSHOT *snap; /* Snapshot information */ - void *block; /* Block manager */ u_int block_header; /* Block manager header length */ diff --git a/src/include/extern.h b/src/include/extern.h index 950c7395561..381ff79d92d 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -536,7 +536,7 @@ extern int __wt_conn_btree_open(WT_SESSION_IMPL *session, uint32_t flags); extern int __wt_conn_btree_get(WT_SESSION_IMPL *session, const char *name, - const char *snapshot, + const char *ckpt, const char *cfg[], uint32_t flags); extern int __wt_conn_btree_apply(WT_SESSION_IMPL *session, @@ -907,7 +907,6 @@ extern int __wt_session_lock_snapshot( WT_SESSION_IMPL *session, extern int __wt_session_discard_btree( WT_SESSION_IMPL *session, WT_BTREE_SESSION *btree_session); extern int __wt_salvage(WT_SESSION_IMPL *session, const char *cfg[]); -extern int __wt_snapshot(WT_SESSION_IMPL *session, const char *cfg[]); extern void __wt_event_handler_set(WT_SESSION_IMPL *session, WT_EVENT_HANDLER *handler); extern void __wt_err(WT_SESSION_IMPL *session, @@ -1055,3 +1054,4 @@ extern int __wt_txn_init(WT_SESSION_IMPL *session); extern void __wt_txn_destroy(WT_SESSION_IMPL *session); extern int __wt_txn_global_init(WT_CONNECTION_IMPL *conn, const char *cfg[]); extern void __wt_txn_global_destroy(WT_CONNECTION_IMPL *conn); +extern int __wt_snapshot(WT_SESSION_IMPL *session, const char *cfg[]); diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 8642eaddfc8..676e0dd31d9 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -494,6 +494,8 @@ struct __wt_session { * @config{bulk, configure the cursor for bulk loads; bulk-load is a * fast load path for empty objects\, only empty objects may be * bulk-loaded.,a boolean flag; default \c false.} + * @config{checkpoint, the name of a checkpoint to open.,a string; + * default empty.} * @config{dump, configure the cursor for dump format inputs and * outputs: "hex" selects a simple hexadecimal format\, "print" selects * a format where only non-printing characters are hexadecimal encoded. @@ -510,8 +512,6 @@ struct __wt_session { * @config{raw, ignore the encodings for the key and value\, manage data * as if the formats were \c "u". See @ref cursor_raw for details.,a * boolean flag; default \c false.} - * @config{snapshot, the name of a snapshot to open.,a string; default - * empty.} * @config{statistics, configure the cursor for statistics.,a boolean * flag; default \c false.} * @config{statistics_clear, statistics cursors only; reset statistics @@ -810,13 +810,13 @@ struct __wt_session { * * @param session the session handle * @configstart{session.checkpoint, see dist/api_data.py} - * @config{drop, specify a list of snapshots to drop. The list may + * @config{drop, specify a list of checkpoints to drop. The list may * additionally contain one of the following keys: \c "from=all" to drop - * all snapshots\, \c "from=<snapshot>" to drop all snapshots after and - * including the named snapshot\, or \c "to=<snapshot>" to drop all - * snapshots before and including the named snapshot.,a list of strings; - * default empty.} - * @config{name, if non-empty\, specify a name for the snapshot.,a + * all checkpoints\, \c "from=<checkpoint>" to drop all checkpoints + * after and including the named checkpoint\, or \c "to=<checkpoint>" to + * drop all checkpoints before and including the named checkpoint.,a + * list of strings; default empty.} + * @config{name, if non-empty\, specify a name for the checkpoint.,a * string; default empty.} * @config{target, if non-empty\, checkpoint the list of objects.,a list * of strings; default empty.} @@ -1048,8 +1048,8 @@ struct __wt_connection { * \c false.} * @config{session_max, maximum expected number of sessions (including server * threads).,an integer greater than or equal to 1; default \c 50.} - * @config{sync, sync files when closing or writing snapshots.,a boolean flag; - * default \c true.} + * @config{sync, flush files to stable storage when closing or writing + * checkpoints.,a boolean flag; default \c true.} * @config{transactional, support transactional semantics.,a boolean flag; * default \c true.} * @config{use_environment_priv, use the \c WIREDTIGER_CONFIG and \c diff --git a/src/session/session_btree.c b/src/session/session_btree.c index 47b6460b524..abcc3efa16e 100644 --- a/src/session/session_btree.c +++ b/src/session/session_btree.c @@ -133,36 +133,36 @@ __wt_session_get_btree(WT_SESSION_IMPL *session, WT_BTREE_SESSION *btree_session; WT_CONFIG_ITEM cval; WT_DECL_RET; - const char *snapshot; - size_t snaplen; + const char *ckpt; + size_t ckptlen; btree = NULL; /* - * Optionally open a snapshot. This function is called from lots of + * Optionally open a checkpoint. This function is called from lots of * places, for example, session.checkpoint: the only method currently - * having a "snapshot" configuration string is session.open_cursor, - * so we don't need to check further than if that configuration string - * is set. + * with a "checkpoint" configuration string is session.open_cursor, so + * we don't need to check further than if that configuration string is + * set. */ if (cfg != NULL && - __wt_config_gets(session, cfg, "snapshot", &cval) == 0 && + __wt_config_gets(session, cfg, "checkpoint", &cval) == 0 && cval.len != 0) { - snapshot = cval.str; - snaplen = cval.len; + ckpt = cval.str; + ckptlen = cval.len; } else { - snapshot = NULL; - snaplen = 0; + ckpt = NULL; + ckptlen = 0; } TAILQ_FOREACH(btree_session, &session->btrees, q) { btree = btree_session->btree; if (strcmp(uri, btree->name) != 0) continue; - if ((snapshot == NULL && btree->snapshot == NULL) || - (snapshot != NULL && btree->snapshot != NULL && - (strncmp(snapshot, btree->snapshot, snaplen) == 0 && - btree->snapshot[snaplen] == '\0'))) + if ((ckpt == NULL && btree->ckpt == NULL) || + (ckpt != NULL && btree->ckpt != NULL && + (strncmp(ckpt, btree->ckpt, ckptlen) == 0 && + btree->ckpt[ckptlen] == '\0'))) break; } @@ -187,7 +187,7 @@ __wt_session_get_btree(WT_SESSION_IMPL *session, ret = 0; } - WT_RET(__wt_conn_btree_get(session, uri, snapshot, cfg, flags)); + WT_RET(__wt_conn_btree_get(session, uri, ckpt, cfg, flags)); if (btree_session == NULL) WT_RET(__wt_session_add_btree(session, NULL)); @@ -217,7 +217,7 @@ __wt_session_lock_snapshot( btree = session->btree; WT_ERR(__wt_scr_alloc(session, 0, &buf)); - WT_ERR(__wt_buf_fmt(session, buf, "snapshot=\"%s\"", snapshot)); + WT_ERR(__wt_buf_fmt(session, buf, "checkpoint=\"%s\"", snapshot)); cfg[0] = buf->data; LF_SET(WT_BTREE_LOCK_ONLY); diff --git a/src/session/session_snapshot.c b/src/txn/txn_snapshot.c index 073e5e1f993..073e5e1f993 100644 --- a/src/session/session_snapshot.c +++ b/src/txn/txn_snapshot.c diff --git a/src/utilities/util_dump.c b/src/utilities/util_dump.c index 6f918b51774..9d06dd5ec4f 100644 --- a/src/utilities/util_dump.c +++ b/src/utilities/util_dump.c @@ -56,12 +56,15 @@ util_dump(WT_SESSION *session, int argc, char *argv[]) WT_DECL_RET; size_t len; int ch, hex, reverse; - char *config, *name, *snapshot; + char *checkpoint, *config, *name; hex = reverse = 0; - config = name = snapshot = NULL; - while ((ch = util_getopt(argc, argv, "f:rs:x")) != EOF) + checkpoint = config = name = NULL; + while ((ch = util_getopt(argc, argv, "c:f:rx")) != EOF) switch (ch) { + case 'c': + checkpoint = util_optarg; + break; case 'f': /* output file */ if (freopen(util_optarg, "w", stdout) == NULL) return ( @@ -70,9 +73,6 @@ util_dump(WT_SESSION *session, int argc, char *argv[]) case 'r': reverse = 1; break; - case 's': - snapshot = util_optarg; - break; case 'x': hex = 1; break; @@ -95,15 +95,16 @@ util_dump(WT_SESSION *session, int argc, char *argv[]) dump_suffix() != 0) goto err; - len = snapshot == NULL ? 0 : strlen("snapshot=") + strlen(snapshot); + len = + checkpoint == NULL ? 0 : strlen("checkpoint=") + strlen(checkpoint); len += strlen(hex ? "dump=hex" : "dump=print"); if ((config = malloc(len + 10)) == NULL) goto err; - if (snapshot == NULL) + if (checkpoint == NULL) config[0] = '\0'; else { - (void)strcpy(config, "snapshot="); - (void)strcat(config, snapshot); + (void)strcpy(config, "checkpoint="); + (void)strcat(config, checkpoint); (void)strcat(config, ","); } (void)strcat(config, hex ? "dump=hex" : "dump=print"); @@ -376,7 +377,7 @@ usage(void) { (void)fprintf(stderr, "usage: %s %s " - "dump [-rx] [-f output-file] [-s snapshot] uri\n", + "dump [-rx] [-c checkpoint] [-f output-file] uri\n", progname, usage_prefix); return (1); } diff --git a/src/utilities/util_list.c b/src/utilities/util_list.c index 3cf3a988427..19db1677638 100644 --- a/src/utilities/util_list.c +++ b/src/utilities/util_list.c @@ -8,22 +8,22 @@ #include "util.h" static int list_print(WT_SESSION *, const char *, int, int); -static int list_print_snapshot(WT_SESSION *, const char *); +static int list_print_checkpoint(WT_SESSION *, const char *); static int usage(void); int util_list(WT_SESSION *session, int argc, char *argv[]) { WT_DECL_RET; - int ch, sflag, vflag; + int cflag, ch, vflag; char *name; - sflag = vflag = 0; + cflag = vflag = 0; name = NULL; - while ((ch = util_getopt(argc, argv, "sv")) != EOF) + while ((ch = util_getopt(argc, argv, "cv")) != EOF) switch (ch) { - case 's': - sflag = 1; + case 'c': + cflag = 1; break; case 'v': vflag = 1; @@ -47,7 +47,7 @@ util_list(WT_SESSION *session, int argc, char *argv[]) return (usage()); } - ret = list_print(session, name, sflag, vflag); + ret = list_print(session, name, cflag, vflag); if (name != NULL) free(name); @@ -60,7 +60,7 @@ util_list(WT_SESSION *session, int argc, char *argv[]) * List the high-level objects in the database. */ static int -list_print(WT_SESSION *session, const char *name, int sflag, int vflag) +list_print(WT_SESSION *session, const char *name, int cflag, int vflag) { WT_CURSOR *cursor; WT_DECL_RET; @@ -71,12 +71,12 @@ list_print(WT_SESSION *session, const char *name, int sflag, int vflag) * XXX * Normally, we don't say anything about the WiredTiger metadata file, * it's not an "object" in the database. I'm making an exception for - * -s and -v, the snapshot and verbose options. + * -c and -v, the checkpoint and verbose options. */ - if (sflag || vflag) { + if (cflag || vflag) { uri = WT_METADATA_URI; printf("%s\n", uri); - if (sflag && (ret = list_print_snapshot(session, uri)) != 0) + if (cflag && (ret = list_print_checkpoint(session, uri)) != 0) return (ret); if (vflag) { if ((ret = @@ -124,10 +124,10 @@ list_print(WT_SESSION *session, const char *name, int sflag, int vflag) found = 1; } printf("%s\n", key); - if (!sflag && !vflag) + if (!cflag && !vflag) continue; - if (sflag && (ret = list_print_snapshot(session, key)) != 0) + if (cflag && (ret = list_print_checkpoint(session, key)) != 0) return (ret); if (vflag) { if ((ret = cursor->get_value(cursor, &value)) != 0) @@ -147,11 +147,11 @@ list_print(WT_SESSION *session, const char *name, int sflag, int vflag) } /* - * list_print_snapshot -- - * List the snapshot information. + * list_print_checkpoint -- + * List the checkpoint information. */ static int -list_print_snapshot(WT_SESSION *session, const char *key) +list_print_checkpoint(WT_SESSION *session, const char *key) { WT_DECL_RET; WT_SNAPSHOT *snap, *snapbase; @@ -161,9 +161,10 @@ list_print_snapshot(WT_SESSION *session, const char *key) char buf[256]; /* - * We may not find any snapshots for this file, in which case we don't - * report an error, and continue our caller's loop. Otherwise, report - * each snapshot's name and time. + * We may not find any checkpoints for this file, in which case we don't + * report an error, and continue our caller's loop. Otherwise, read the + * list of snapshots (which is the same as the list of checkpoints), and + * print each snapshot's name and time. */ if ((ret = __wt_metadata_get_snaplist(session, key, &snapbase)) != 0) return (ret == WT_NOTFOUND ? 0 : ret); @@ -203,7 +204,7 @@ usage(void) { (void)fprintf(stderr, "usage: %s %s " - "list [-sv] [uri]\n", + "list [-cv] [uri]\n", progname, usage_prefix); return (1); } diff --git a/test/snapshot/Makefile.am b/test/checkpoint/Makefile.am index d6fb5cf86d3..655a9815180 100644 --- a/test/snapshot/Makefile.am +++ b/test/checkpoint/Makefile.am @@ -1,7 +1,7 @@ INCLUDES = -I$(top_builddir) -I$(top_srcdir)/src/include noinst_PROGRAMS = t -t_SOURCES = snapshot.c +t_SOURCES = checkpoint.c t_LDADD = $(top_builddir)/libwiredtiger.la t_LDFLAGS = -static diff --git a/test/snapshot/snapshot.c b/test/checkpoint/checkpoint.c index 9c2537930cc..9cf4cc471fb 100644 --- a/test/snapshot/snapshot.c +++ b/test/checkpoint/checkpoint.c @@ -18,33 +18,33 @@ #include <wiredtiger.h> -#define URI "file:__snap" +#define URI "file:__ckpt" struct L { int start, stop; /* starting/stopping id */ - const char *name; /* snapshot name */ + const char *name; /* checkpoint name */ } list[] = { - { 100, 120, "snapshot-1" }, - { 200, 220, "snapshot-2" }, - { 300, 320, "snapshot-3" }, - { 400, 420, "snapshot-4" }, - { 500, 520, "snapshot-5" }, - { 100, 620, "snapshot-6" }, - { 200, 720, "snapshot-7" }, - { 300, 820, "snapshot-8" }, - { 400, 920, "snapshot-9" }, - { 500, 600, "snapshot-a" }, + { 100, 120, "checkpoint-1" }, + { 200, 220, "checkpoint-2" }, + { 300, 320, "checkpoint-3" }, + { 400, 420, "checkpoint-4" }, + { 500, 520, "checkpoint-5" }, + { 100, 620, "checkpoint-6" }, + { 200, 720, "checkpoint-7" }, + { 300, 820, "checkpoint-8" }, + { 400, 920, "checkpoint-9" }, + { 500, 600, "checkpoint-a" }, { 0, 0, NULL } }; void add(int, int); void build(void); void check(struct L *); -int ckpt(const char *, const char *); +int checkpoint(const char *, const char *); void cursor_lock(void); void delete(void); void dump_cat(struct L *, const char *); -void dump_snap(struct L *, const char *); +void dump_ckpt(struct L *, const char *); void run(void); int usage(void); @@ -105,7 +105,7 @@ run(void) assert(session->create(session, URI, config) == 0); printf("building...\n"); - build(); /* Build a set of snapshots */ + build(); /* Build a set of checkpoints */ printf("checking build...\n"); for (p = list; p->start != 0; ++p) @@ -122,7 +122,7 @@ run(void) /* * build -- - * Build a file with a set of snapshots. + * Build a file with a set of checkpoints. */ void build(void) @@ -131,7 +131,7 @@ build(void) for (p = list; p->start != 0; ++p) { add(p->start, p->stop); - assert (ckpt(p->name, NULL) == 0); + assert (checkpoint(p->name, NULL) == 0); } } @@ -168,16 +168,16 @@ add(int start, int stop) /* * check -- - * Check the contents of an individual snapshot. + * Check the contents of an individual checkpoint. */ void -check(struct L *snap) +check(struct L *ckpt) { - dump_cat(snap, "__dump.1"); /* Dump out the records */ - dump_snap(snap, "__dump.2"); /* Dump out the snapshot */ + dump_cat(ckpt, "__dump.1"); /* Dump out the records */ + dump_ckpt(ckpt, "__dump.2"); /* Dump out the checkpoint */ /* - * Sort the two versions of the snapshot, discarding overlapping + * Sort the two versions of the checkpoint, discarding overlapping * entries, and compare the results. */ if (system( @@ -185,8 +185,8 @@ check(struct L *snap) "sort -u -o __dump.2 __dump.2 && " "cmp __dump.1 __dump.2 > /dev/null")) { fprintf(stderr, - "check failed, snapshot results for %s were incorrect\n", - snap->name); + "check failed, checkpoint results for %s were incorrect\n", + ckpt->name); exit(EXIT_FAILURE); } } @@ -196,7 +196,7 @@ check(struct L *snap) * Output the expected rows into a file. */ void -dump_cat(struct L *snap, const char *f) +dump_cat(struct L *ckpt, const char *f) { struct L *p; FILE *fp; @@ -204,7 +204,7 @@ dump_cat(struct L *snap, const char *f) assert((fp = fopen(f, "w")) != NULL); - for (p = list; p <= snap; ++p) { + for (p = list; p <= ckpt; ++p) { for (row = p->start; row < p->stop; ++row) fprintf(fp, "%010d KEY------\n%010d VALUE----\n", row, row); @@ -214,11 +214,11 @@ dump_cat(struct L *snap, const char *f) } /* - * dump_snap -- - * Dump a snapshot into a file. + * dump_ckpt -- + * Dump a checkpoint into a file. */ void -dump_snap(struct L *snap, const char *f) +dump_ckpt(struct L *ckpt, const char *f) { FILE *fp; WT_CURSOR *cursor; @@ -228,7 +228,7 @@ dump_snap(struct L *snap, const char *f) assert((fp = fopen(f, "w")) != NULL); - snprintf(buf, sizeof(buf), "snapshot=%s", snap->name); + snprintf(buf, sizeof(buf), "checkpoint=%s", ckpt->name); assert(session->open_cursor(session, URI, NULL, buf, &cursor) == 0); while ((ret = cursor->next(cursor)) == 0) { @@ -252,16 +252,16 @@ cursor_lock(void) WT_CURSOR *cursor, *c1, *c2, *c3; char buf[64]; - /* Check that you can't drop a snapshot if it's in use. */ - snprintf(buf, sizeof(buf), "snapshot=%s", list[0].name); + /* Check that you can't drop a checkpoint if it's in use. */ + snprintf(buf, sizeof(buf), "checkpoint=%s", list[0].name); assert(session->open_cursor(session, URI, NULL, buf, &cursor) == 0); - assert(ckpt(list[0].name, NULL) != 0); + assert(checkpoint(list[0].name, NULL) != 0); assert(cursor->close(cursor) == 0); - /* Check you can open two snapshots at the same time. */ - snprintf(buf, sizeof(buf), "snapshot=%s", list[0].name); + /* Check you can open two checkpoints at the same time. */ + snprintf(buf, sizeof(buf), "checkpoint=%s", list[0].name); assert(session->open_cursor(session, URI, NULL, buf, &c1) == 0); - snprintf(buf, sizeof(buf), "snapshot=%s", list[1].name); + snprintf(buf, sizeof(buf), "checkpoint=%s", list[1].name); assert(session->open_cursor(session, URI, NULL, buf, &c2) == 0); assert(session->open_cursor(session, URI, NULL, NULL, &c3) == 0); assert(c2->close(c2) == 0); @@ -271,7 +271,7 @@ cursor_lock(void) /* * delete -- - * Delete a snapshot and verify the file. + * Delete a checkpoint and verify the file. */ void delete(void) @@ -279,15 +279,15 @@ delete(void) struct L *p; for (p = list; p->start != 0; ++p) - assert(ckpt(NULL, p->name) == 0); + assert(checkpoint(NULL, p->name) == 0); } /* - * ckpt -- - * Take a checkpoint, optionally naming/dropping snapshots. + * checkpoint -- + * Take a checkpoint, optionally naming and/or dropping other checkpoints. */ int -ckpt(const char *name, const char *drop) +checkpoint(const char *name, const char *drop) { int ret; char buf[128]; diff --git a/test/fops/file.c b/test/fops/file.c index 14925bd2c8f..aa9aa641526 100644 --- a/test/fops/file.c +++ b/test/fops/file.c @@ -51,7 +51,7 @@ obj_checkpoint(void) die("conn.session", ret); /* - * Name the checkpoint so a snapshot has to be taken, don't specify + * Name the checkpoint so the checkpoint has to be taken, don't specify * a target, it might not exist. */ if ((ret = session->checkpoint(session, "name=fops")) != 0) diff --git a/test/format/wts_ops.c b/test/format/wts_ops.c index ec8d5f07bec..14c9a82fbcf 100644 --- a/test/format/wts_ops.c +++ b/test/format/wts_ops.c @@ -162,7 +162,7 @@ ops(void *arg) track("read/write ops", 0ULL, tinfo); if (cnt == ckpt_op) { - /* Half the time we name the snapshot. */ + /* Half the time we name the checkpoint. */ if (MMRAND(1, 2) == 1) ckpt_config = NULL; else { |