diff options
author | Michael Cahill <mjc@wiredtiger.com> | 2014-12-15 12:26:12 +1100 |
---|---|---|
committer | Michael Cahill <mjc@wiredtiger.com> | 2014-12-15 12:26:12 +1100 |
commit | 7e98861433383677bfba576db0616df690f9e072 (patch) | |
tree | bb8debf5b7534894680c7f6e12ae59d790f900c3 /examples | |
parent | 4de195b948737514c0f3ec16a4486fac8e56ddbe (diff) | |
parent | 231fb0549ef85bec8ec8619fef603581bbd1e31a (diff) | |
download | mongo-7e98861433383677bfba576db0616df690f9e072.tar.gz |
Merge pull request #1454 from wiredtiger/overflow-relax
Separate the btree maximum key/value sizes from the underlying page size
Diffstat (limited to 'examples')
-rw-r--r-- | examples/c/Makefile.am | 1 | ||||
-rw-r--r-- | examples/c/ex_all.c | 14 | ||||
-rw-r--r-- | examples/c/ex_file.c | 72 |
3 files changed, 14 insertions, 73 deletions
diff --git a/examples/c/Makefile.am b/examples/c/Makefile.am index 17beba4a470..382c5912fef 100644 --- a/examples/c/Makefile.am +++ b/examples/c/Makefile.am @@ -13,7 +13,6 @@ noinst_PROGRAMS = \ ex_data_source \ ex_extending \ ex_extractor \ - ex_file \ ex_hello \ ex_log \ ex_pack \ diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c index 4fe6a2f265a..01966b5196f 100644 --- a/examples/c/ex_all.c +++ b/examples/c/ex_all.c @@ -528,6 +528,20 @@ session_ops(WT_SESSION *session) /*! [Create a table with columns] */ ret = session->drop(session, "table:mytable", NULL); + /*! [Create a table and configure the page size] */ + ret = session->create(session, + "table:mytable", "key_format=S,value_format=S" + "internal_page_max=16KB,leaf_page_max=1MB,leaf_value_max=64KB"); + /*! [Create a table and configure the page size] */ + ret = session->drop(session, "table:mytable", NULL); + + /*! [Create a table and configure a large leaf value max] */ + ret = session->create(session, + "table:mytable", "key_format=S,value_format=S" + "leaf_page_max=16KB,leaf_value_max=256KB"); + /*! [Create a table and configure a large leaf value max] */ + ret = session->drop(session, "table:mytable", NULL); + /* * This example code gets run, and the compression libraries might not * be loaded, causing the create to fail. The documentation requires diff --git a/examples/c/ex_file.c b/examples/c/ex_file.c deleted file mode 100644 index 4170d1b099d..00000000000 --- a/examples/c/ex_file.c +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * Public Domain 2008-2014 WiredTiger, Inc. - * - * This is free and unencumbered software released into the public domain. - * - * Anyone is free to copy, modify, publish, use, compile, sell, or - * distribute this software, either in source code form or as a compiled - * binary, for any purpose, commercial or non-commercial, and by any - * means. - * - * In jurisdictions that recognize copyright laws, the author or authors - * of this software dedicate any and all copyright interest in the - * software to the public domain. We make this dedication for the benefit - * of the public at large and to the detriment of our heirs and - * successors. We intend this dedication to be an overt act of - * relinquishment in perpetuity of all present and future rights to this - * software under copyright law. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * ex_file.c - * This is an example demonstrating how to configure an individual file. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <wiredtiger.h> - -static const char *home; - -int -main(void) -{ - WT_CONNECTION *conn; - WT_SESSION *session; - int ret; - - /* - * Create a clean test directory for this run of the test program if the - * environment variable isn't already set (as is done by make check). - */ - if (getenv("WIREDTIGER_HOME") == NULL) { - home = "WT_HOME"; - ret = system("rm -rf WT_HOME && mkdir WT_HOME"); - } else - home = NULL; - - if ((ret = wiredtiger_open(home, NULL, "create", &conn)) != 0 || - (ret = conn->open_session(conn, NULL, NULL, &session)) != 0) { - fprintf(stderr, "Error connecting to %s: %s\n", - home, wiredtiger_strerror(ret)); - return (ret); - } - /* Note: further error checking omitted for clarity. */ - - /*! [file create] */ - ret = session->create(session, "file:example", - "key_format=u," - "internal_page_max=32KB,internal_item_max=1KB," - "leaf_page_max=1MB,leaf_item_max=32KB"); - /*! [file create] */ - - return (conn->close(conn, NULL) == 0 ? ret : EXIT_FAILURE); -} |