diff options
author | Luke Chen <luke.chen@mongodb.com> | 2020-08-17 15:56:33 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-17 06:16:56 +0000 |
commit | b2c2c5e28402f113ac52f6ce5e629d59fc09b995 (patch) | |
tree | f66c98f6fbbc5fae973620de07d2f6e262c0bd44 /src/third_party/wiredtiger/examples/c | |
parent | 3cc779415f2777223b5549d3dfd1b85eef01842b (diff) | |
download | mongo-b2c2c5e28402f113ac52f6ce5e629d59fc09b995.tar.gz |
Import wiredtiger: 1a3371324597a8f124c126c2df11303ded4d8dd9 from branch mongodb-4.6
ref: 1124e23db6..1a33713245
for: 4.5.1
WT-5940 Migrate to Clang Format 10
WT-6000 Enhance incremental backup testing in format to support restart
WT-6471 Avoid the error message for non-existent clang-format binary
WT-6560 Fix usage of global salvage in WT utility
WT-6577 History store dump outputs confusing time window
WT-6586 Tombstone inserted to history store should also be flagged as WT_UPDATE_HS
Diffstat (limited to 'src/third_party/wiredtiger/examples/c')
9 files changed, 39 insertions, 75 deletions
diff --git a/src/third_party/wiredtiger/examples/c/ex_all.c b/src/third_party/wiredtiger/examples/c/ex_all.c index 7360bf92862..163c9cfddda 100644 --- a/src/third_party/wiredtiger/examples/c/ex_all.c +++ b/src/third_party/wiredtiger/examples/c/ex_all.c @@ -571,22 +571,19 @@ session_ops_create(WT_SESSION *session) * integer, unsigned 16-bit integer). */ error_check(session->create(session, "table:mytable", - "key_format=r,value_format=SiH," - "columns=(id,department,salary,year-started)")); + "key_format=r,value_format=SiH,columns=(id,department,salary,year-started)")); /*! [Create a table with columns] */ error_check(session->drop(session, "table:mytable", NULL)); /*! [Create a table and configure the page size] */ error_check(session->create(session, "table:mytable", - "key_format=S,value_format=S," - "internal_page_max=16KB,leaf_page_max=1MB,leaf_value_max=64KB")); + "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] */ error_check(session->drop(session, "table:mytable", NULL)); /*! [Create a table and configure a large leaf value max] */ error_check(session->create(session, "table:mytable", - "key_format=S,value_format=S," - "leaf_page_max=16KB,leaf_value_max=256KB")); + "key_format=S,value_format=S,leaf_page_max=16KB,leaf_value_max=256KB")); /*! [Create a table and configure a large leaf value max] */ error_check(session->drop(session, "table:mytable", NULL)); @@ -687,7 +684,7 @@ session_ops(WT_SESSION *session) /*! [Compact a table] */ error_check(session->compact(session, "table:mytable", NULL)); -/*! [Compact a table] */ + /*! [Compact a table] */ #ifdef MIGHT_NOT_RUN /*! [Import a file] */ @@ -1145,9 +1142,9 @@ main(int argc, char *argv[]) /*! [Open a connection] */ connection_ops(conn); -/* - * The connection has been closed. - */ + /* + * The connection has been closed. + */ #ifdef MIGHT_NOT_RUN /* @@ -1155,51 +1152,39 @@ main(int argc, char *argv[]) * open to fail. The documentation requires the code snippets, use #ifdef's to avoid running it. */ /*! [Configure lz4 extension] */ - error_check(wiredtiger_open(home, NULL, - "create," - "extensions=[/usr/local/lib/libwiredtiger_lz4.so]", - &conn)); + error_check(wiredtiger_open( + home, NULL, "create,extensions=[/usr/local/lib/libwiredtiger_lz4.so]", &conn)); /*! [Configure lz4 extension] */ error_check(conn->close(conn, NULL)); /*! [Configure snappy extension] */ - error_check(wiredtiger_open(home, NULL, - "create," - "extensions=[/usr/local/lib/libwiredtiger_snappy.so]", - &conn)); + error_check(wiredtiger_open( + home, NULL, "create,extensions=[/usr/local/lib/libwiredtiger_snappy.so]", &conn)); /*! [Configure snappy extension] */ error_check(conn->close(conn, NULL)); /*! [Configure zlib extension] */ - error_check(wiredtiger_open(home, NULL, - "create," - "extensions=[/usr/local/lib/libwiredtiger_zlib.so]", - &conn)); + error_check(wiredtiger_open( + home, NULL, "create,extensions=[/usr/local/lib/libwiredtiger_zlib.so]", &conn)); /*! [Configure zlib extension] */ error_check(conn->close(conn, NULL)); /*! [Configure zlib extension with compression level] */ error_check(wiredtiger_open(home, NULL, - "create," - "extensions=[/usr/local/lib/" - "libwiredtiger_zlib.so=[config=[compression_level=3]]]", + "create,extensions=[/usr/local/lib/libwiredtiger_zlib.so=[config=[compression_level=3]]]", &conn)); /*! [Configure zlib extension with compression level] */ error_check(conn->close(conn, NULL)); /*! [Configure zstd extension] */ - error_check(wiredtiger_open(home, NULL, - "create," - "extensions=[/usr/local/lib/libwiredtiger_zstd.so]", - &conn)); + error_check(wiredtiger_open( + home, NULL, "create,extensions=[/usr/local/lib/libwiredtiger_zstd.so]", &conn)); /*! [Configure zstd extension] */ error_check(conn->close(conn, NULL)); /*! [Configure zstd extension with compression level] */ error_check(wiredtiger_open(home, NULL, - "create," - "extensions=[/usr/local/lib/" - "libwiredtiger_zstd.so=[config=[compression_level=9]]]", + "create,extensions=[/usr/local/lib/libwiredtiger_zstd.so=[config=[compression_level=9]]]", &conn)); /*! [Configure zstd extension with compression level] */ error_check(conn->close(conn, NULL)); @@ -1257,9 +1242,7 @@ main(int argc, char *argv[]) */ /*! [Statistics logging with a table] */ error_check(wiredtiger_open(home, NULL, - "create, statistics_log=(" - "sources=(\"table:table1\",\"table:table2\"), wait=5)", - &conn)); + "create, statistics_log=(sources=(\"table:table1\",\"table:table2\"), wait=5)", &conn)); /*! [Statistics logging with a table] */ error_check(conn->close(conn, NULL)); diff --git a/src/third_party/wiredtiger/examples/c/ex_async.c b/src/third_party/wiredtiger/examples/c/ex_async.c index 54df30e3ef2..b4d01d6d57f 100644 --- a/src/third_party/wiredtiger/examples/c/ex_async.c +++ b/src/third_party/wiredtiger/examples/c/ex_async.c @@ -110,10 +110,8 @@ main(int argc, char *argv[]) home = example_setup(argc, argv); /*! [async example connection] */ - error_check(wiredtiger_open(home, NULL, - "create,cache_size=100MB," - "async=(enabled=true,ops_max=20,threads=2)", - &conn)); + error_check(wiredtiger_open( + home, NULL, "create,cache_size=100MB,async=(enabled=true,ops_max=20,threads=2)", &conn)); /*! [async example connection] */ /*! [async example table create] */ diff --git a/src/third_party/wiredtiger/examples/c/ex_call_center.c b/src/third_party/wiredtiger/examples/c/ex_call_center.c index c3475535ab2..b73ba5d7282 100644 --- a/src/third_party/wiredtiger/examples/c/ex_call_center.c +++ b/src/third_party/wiredtiger/examples/c/ex_call_center.c @@ -95,10 +95,7 @@ main(int argc, char *argv[]) * in two groups: "main" and "address", created below. */ error_check(session->create(session, "table:customers", - "key_format=r," - "value_format=SSS," - "columns=(id,name,address,phone)," - "colgroups=(main,address)")); + "key_format=r,value_format=SSS,columns=(id,name,address,phone),colgroups=(main,address)")); /* Create the main column group with value columns except address. */ error_check(session->create(session, "colgroup:customers:main", "columns=(name,phone)")); @@ -122,9 +119,7 @@ main(int argc, char *argv[]) * together, so no column groups are declared. */ error_check(session->create(session, "table:calls", - "key_format=r," - "value_format=qrrSS," - "columns=(id,call_date,cust_id,emp_id,call_type,notes)")); + "key_format=r,value_format=qrrSS,columns=(id,call_date,cust_id,emp_id,call_type,notes)")); /* * Create an index on the calls table with a composite key of cust_id and call_date. diff --git a/src/third_party/wiredtiger/examples/c/ex_cursor.c b/src/third_party/wiredtiger/examples/c/ex_cursor.c index beb4c9cc007..61861a05264 100644 --- a/src/third_party/wiredtiger/examples/c/ex_cursor.c +++ b/src/third_party/wiredtiger/examples/c/ex_cursor.c @@ -171,8 +171,7 @@ main(int argc, char *argv[]) error_check(conn->open_session(conn, NULL, NULL, &session)); error_check(session->create(session, "table:world", - "key_format=r,value_format=5sii," - "columns=(id,country,population,area)")); + "key_format=r,value_format=5sii,columns=(id,country,population,area)")); /*! [open cursor #1] */ error_check(session->open_cursor(session, "table:world", NULL, NULL, &cursor)); diff --git a/src/third_party/wiredtiger/examples/c/ex_encrypt.c b/src/third_party/wiredtiger/examples/c/ex_encrypt.c index 9512ad89600..66fb2504aba 100644 --- a/src/third_party/wiredtiger/examples/c/ex_encrypt.c +++ b/src/third_party/wiredtiger/examples/c/ex_encrypt.c @@ -431,25 +431,21 @@ main(int argc, char *argv[]) * Create and open some encrypted and not encrypted tables. Also use column store and * compression for some tables. */ - error_check( - session->create(session, "table:crypto1", "encryption=(name=rotn,keyid=" USER1_KEYID ")," - "columns=(key0,value0)," - "key_format=S,value_format=S")); - error_check(session->create(session, - "index:crypto1:byvalue", "encryption=(name=rotn,keyid=" USER1_KEYID ")," - "columns=(value0,key0)")); - error_check( - session->create(session, "table:crypto2", "encryption=(name=rotn,keyid=" USER2_KEYID ")," - "key_format=S,value_format=S")); + error_check(session->create(session, "table:crypto1", + "encryption=(name=rotn,keyid=" USER1_KEYID + "),columns=(key0,value0),key_format=S,value_format=S")); + error_check(session->create(session, "index:crypto1:byvalue", + "encryption=(name=rotn,keyid=" USER1_KEYID "),columns=(value0,key0)")); + error_check(session->create(session, "table:crypto2", + "encryption=(name=rotn,keyid=" USER2_KEYID "),key_format=S,value_format=S")); error_check(session->create(session, "table:nocrypto", "key_format=S,value_format=S")); /* * Send in an unknown keyid. WiredTiger will try to add in the new keyid, but the customize * function above will return an error since it is unrecognized. */ - ret = session->create(session, "table:cryptobad", "encryption=(name=rotn,keyid=" USERBAD_KEYID - ")," - "key_format=S,value_format=S"); + ret = session->create(session, "table:cryptobad", + "encryption=(name=rotn,keyid=" USERBAD_KEYID "),key_format=S,value_format=S"); if (ret == 0) { fprintf(stderr, "Did not detect bad/unknown keyid error\n"); exit(EXIT_FAILURE); diff --git a/src/third_party/wiredtiger/examples/c/ex_extractor.c b/src/third_party/wiredtiger/examples/c/ex_extractor.c index b4c74c35cfd..4530b97a395 100644 --- a/src/third_party/wiredtiger/examples/c/ex_extractor.c +++ b/src/third_party/wiredtiger/examples/c/ex_extractor.c @@ -183,8 +183,7 @@ setup_table(WT_SESSION *session) /* Create the primary table. It has a key of the unique ID. */ error_check(session->create(session, "table:presidents", - "key_format=I,value_format=SSHH," - "columns=(ID,last_name,first_name,term_begin,term_end)")); + "key_format=I,value_format=SSHH,columns=(ID,last_name,first_name,term_begin,term_end)")); /* * Create the index that is generated with an extractor. The index will generate an entry in the diff --git a/src/third_party/wiredtiger/examples/c/ex_file_system.c b/src/third_party/wiredtiger/examples/c/ex_file_system.c index 993e5b5f30c..1f213a07ff6 100644 --- a/src/third_party/wiredtiger/examples/c/ex_file_system.c +++ b/src/third_party/wiredtiger/examples/c/ex_file_system.c @@ -852,10 +852,8 @@ main(void) * function as the "config" value. */ open_config = - "create,log=(enabled=true),extensions=(local={" - "entry=demo_file_system_create,early_load=true," - "config={config_string=\"demo-file-system\",config_value=37}" - "})"; + "create,log=(enabled=true),extensions=(local={entry=demo_file_system_create,early_load=true," + "config={config_string=\"demo-file-system\",config_value=37}})"; /* Open a connection to the database, creating it if necessary. */ if ((ret = wiredtiger_open(home, NULL, open_config, &conn)) != 0) { fprintf(stderr, "Error connecting to %s: %s\n", home == NULL ? "." : home, diff --git a/src/third_party/wiredtiger/examples/c/ex_log.c b/src/third_party/wiredtiger/examples/c/ex_log.c index f02ffb15678..14c96fd839d 100644 --- a/src/third_party/wiredtiger/examples/c/ex_log.c +++ b/src/third_party/wiredtiger/examples/c/ex_log.c @@ -64,10 +64,8 @@ compare_tables(WT_SESSION *session, WT_SESSION *sess_copy) error_check(curs_copy->get_key(curs_copy, &key_copy)); error_check(curs_copy->get_value(curs_copy, &value_copy)); if (strcmp(key, key_copy) != 0 || strcmp(value, value_copy) != 0) { - fprintf(stderr, - "Mismatched: key %s, key_copy %s " - "value %s value_copy %s\n", - key, key_copy, value, value_copy); + fprintf(stderr, "Mismatched: key %s, key_copy %s value %s value_copy %s\n", key, + key_copy, value, value_copy); exit(1); } } diff --git a/src/third_party/wiredtiger/examples/c/ex_schema.c b/src/third_party/wiredtiger/examples/c/ex_schema.c index d9249efecc6..4d9e1aa0edc 100644 --- a/src/third_party/wiredtiger/examples/c/ex_schema.c +++ b/src/third_party/wiredtiger/examples/c/ex_schema.c @@ -72,10 +72,8 @@ main(int argc, char *argv[]) * string, uint16_t, uint64_t). See ::wiredtiger_struct_pack for details of the format strings. */ error_check(session->create(session, "table:poptable", - "key_format=r," - "value_format=5sHQ," - "columns=(id,country,year,population)," - "colgroups=(main,population)")); + "key_format=r,value_format=5sHQ,columns=(id,country,year,population),colgroups=(main," + "population)")); /* * Create two column groups: a primary column group with the country code, year and population |