diff options
author | Susan LoVerso <sue@wiredtiger.com> | 2014-12-02 11:24:55 -0500 |
---|---|---|
committer | Susan LoVerso <sue@wiredtiger.com> | 2014-12-02 11:24:55 -0500 |
commit | 91e2e694ed558b66b6a9561e4dc5c74edaca7edf (patch) | |
tree | 263cf273d2ec4d2dde6164dd8e9153586cec6dbe /examples | |
parent | e1c185dd64706dbbb650e3d5abf32cd79a8b1d7a (diff) | |
download | mongo-91e2e694ed558b66b6a9561e4dc5c74edaca7edf.tar.gz |
Make pre-alloc a boolean and convert connection log settings to flags.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/c/ex_log.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/examples/c/ex_log.c b/examples/c/ex_log.c index c58c8997c66..21b9b6f0c6b 100644 --- a/examples/c/ex_log.c +++ b/examples/c/ex_log.c @@ -25,7 +25,7 @@ * OTHER DEALINGS IN THE SOFTWARE. * * ex_log.c - * demonstrates how to use logging and log cursors. + * demonstrates how to logging and log cursors. */ #include <inttypes.h> #include <stdio.h> @@ -45,8 +45,13 @@ static const char *home2 = "WT_HOME_LOG_2"; static const char * const uri = "table:logtest"; +#if 0 #define CONN_CONFIG "create,cache_size=100MB,log=(archive=false,enabled=true)" #define MAX_KEYS 10 +#else +#define CONN_CONFIG "create,cache_size=100MB,log=(archive=true,enabled=true,file_max=100K),verbose=(log),checkpoint=(log_size=300K),statistics=(fast,clear),statistics_log=(wait=5)" +#define MAX_KEYS 10000 +#endif static int setup_copy(WT_CONNECTION **wt_connp, WT_SESSION **sessionp) @@ -301,6 +306,8 @@ main(void) for (record_count = 0, i = 0; i < MAX_KEYS; i++, record_count++) { snprintf(k, sizeof(k), "key%d", i); snprintf(v, sizeof(v), "value%d", i); + if (i % 3000 == 0) + sleep(1); cursor->set_key(cursor, k); cursor->set_value(cursor, v); ret = cursor->insert(cursor); @@ -337,8 +344,25 @@ main(void) } ret = wt_conn->open_session(wt_conn, NULL, NULL, &session); +#if 0 ret = simple_walk_log(session); ret = walk_log(session); +#else + ret = session->open_cursor(session, uri, NULL, NULL, &cursor); + /* + * Perform some operations with individual auto-commit transactions. + */ + for (record_count = 0, i = MAX_KEYS+100; record_count < MAX_KEYS; i++, record_count++) { + snprintf(k, sizeof(k), "key%d", i); + snprintf(v, sizeof(v), "value%d", i); + if (i % 3000 == 0) + sleep(1); + cursor->set_key(cursor, k); + cursor->set_value(cursor, v); + ret = cursor->insert(cursor); + } +#endif + sleep(1); ret = wt_conn->close(wt_conn, NULL); return (ret); } |