diff options
author | Susan LoVerso <sue@wiredtiger.com> | 2015-05-21 15:46:07 -0400 |
---|---|---|
committer | Susan LoVerso <sue@wiredtiger.com> | 2015-05-21 15:46:07 -0400 |
commit | 99a89c1e4e089fe3dd56b1361110e92a8033ca65 (patch) | |
tree | 4e2ee680fdca8076332fdf34918f74327d6ec69a | |
parent | 25f64abf748482487024361ce39abaa8e33cdbdc (diff) | |
download | mongo-99a89c1e4e089fe3dd56b1361110e92a8033ca65.tar.gz |
Initial changes for per-table logging.
-rw-r--r-- | bench/wtperf/runners/medium-multi-btree-log-partial.wtperf | 12 | ||||
-rw-r--r-- | bench/wtperf/runners/medium-multi-btree-log.wtperf | 11 | ||||
-rw-r--r-- | bench/wtperf/wtperf.c | 20 | ||||
-rw-r--r-- | bench/wtperf/wtperf.h | 2 | ||||
-rw-r--r-- | bench/wtperf/wtperf_opt.i | 1 | ||||
-rw-r--r-- | dist/api_data.py | 5 | ||||
-rw-r--r-- | src/btree/bt_handle.c | 16 | ||||
-rw-r--r-- | src/config/config_def.c | 19 | ||||
-rw-r--r-- | src/docs/wtperf.dox | 2 | ||||
-rw-r--r-- | src/include/btree.h | 7 | ||||
-rw-r--r-- | src/include/wiredtiger.in | 4 | ||||
-rw-r--r-- | src/txn/txn_log.c | 3 |
12 files changed, 86 insertions, 16 deletions
diff --git a/bench/wtperf/runners/medium-multi-btree-log-partial.wtperf b/bench/wtperf/runners/medium-multi-btree-log-partial.wtperf new file mode 100644 index 00000000000..501cdcd9288 --- /dev/null +++ b/bench/wtperf/runners/medium-multi-btree-log-partial.wtperf @@ -0,0 +1,12 @@ +# wtperf options file: medium lsm configuration, with multiple tables. +conn_config="cache_size=1G,log=(enabled,file_max=10MB)" +table_config="type=file,os_cache_dirty_max=16MB" +icount=5000000 +log_partial=true +populate_threads=5 +populate_ops_per_txn=100 +#compact=true +#threads=((count=8,read=1),(count=8,update=1)) +#run_time=180 +report_interval=5 +table_count=4 diff --git a/bench/wtperf/runners/medium-multi-btree-log.wtperf b/bench/wtperf/runners/medium-multi-btree-log.wtperf new file mode 100644 index 00000000000..622d1ba823a --- /dev/null +++ b/bench/wtperf/runners/medium-multi-btree-log.wtperf @@ -0,0 +1,11 @@ +# wtperf options file: medium lsm configuration, with multiple tables. +conn_config="cache_size=1G,log=(enabled,file_max=10MB)" +table_config="type=file,os_cache_dirty_max=16MB" +icount=5000000 +populate_threads=5 +populate_ops_per_txn=100 +#compact=true +#threads=((count=8,read=1),(count=8,update=1)) +#run_time=180 +report_interval=5 +table_count=4 diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c index 3a2e1709ddc..251857771c1 100644 --- a/bench/wtperf/wtperf.c +++ b/bench/wtperf/wtperf.c @@ -32,6 +32,7 @@ static const CONFIG default_cfg = { "WT_TEST", /* home */ "WT_TEST", /* monitor dir */ + NULL, /* partial logging */ NULL, /* base_uri */ NULL, /* uris */ NULL, /* helium_mount */ @@ -1673,7 +1674,14 @@ create_tables(CONFIG *cfg) } for (i = 0; i < cfg->table_count; i++) { - if ((ret = session->create( + if (cfg->log_partial && i > 0) { + if (((ret = session->create(session, + cfg->uris[i], cfg->partial_config)) != 0)) { + lprintf(cfg, ret, 0, + "Error creating table %s", cfg->uris[i]); + return (ret); + } + } else if ((ret = session->create( session, cfg->uris[i], cfg->table_config)) != 0) { lprintf(cfg, ret, 0, "Error creating table %s", cfg->uris[i]); @@ -2155,6 +2163,16 @@ main(int argc, char *argv[]) if ((ret = config_opt_str(cfg, "table_config", tc_buf)) != 0) goto err; } + if (cfg->log_partial && cfg->table_count > 1) { + req_len = strlen(cfg->table_config) + + strlen(LOG_PARTIAL_CONFIG) + 1; + if ((cfg->partial_config = calloc(req_len, 1)) == NULL) { + ret = enomem(cfg); + goto err; + } + snprintf(cfg->partial_config, req_len, "%s%s", + cfg->table_config, LOG_PARTIAL_CONFIG); + } /* Sanity-check the configuration. */ if ((ret = config_sanity(cfg)) != 0) diff --git a/bench/wtperf/wtperf.h b/bench/wtperf/wtperf.h index f176f62320e..03b19f765ea 100644 --- a/bench/wtperf/wtperf.h +++ b/bench/wtperf/wtperf.h @@ -98,6 +98,7 @@ typedef struct { uint8_t ops[100]; /* Operation schedule */ } WORKLOAD; +#define LOG_PARTIAL_CONFIG ",logging=false" /* * NOTE: If you add any fields to this structure here, you must also add * an initialization in wtperf.c in the default_cfg. @@ -105,6 +106,7 @@ typedef struct { struct __config { /* Configuration structure */ const char *home; /* WiredTiger home */ const char *monitor_dir; /* Monitor output dir */ + const char *partial_config; /* Config string for partial logging */ char *base_uri; /* Object URI */ char **uris; /* URIs if multiple tables */ const char *helium_mount; /* Optional Helium mount point */ diff --git a/bench/wtperf/wtperf_opt.i b/bench/wtperf/wtperf_opt.i index cc3fd34e227..6cb39ac3cc4 100644 --- a/bench/wtperf/wtperf_opt.i +++ b/bench/wtperf/wtperf_opt.i @@ -115,6 +115,7 @@ DEF_OPT_AS_BOOL(index, 0, DEF_OPT_AS_BOOL(insert_rmw, 0, "execute a read prior to each insert in workload phase") DEF_OPT_AS_UINT32(key_sz, 20, "key size") +DEF_OPT_AS_BOOL(log_partial, 0, "perform partial logging on first table only.") DEF_OPT_AS_UINT32(min_throughput, 0, "abort if any throughput measured is less than this amount. Requires " "sample_interval to be configured") diff --git a/dist/api_data.py b/dist/api_data.py index fbf71581fe9..fb755045322 100644 --- a/dist/api_data.py +++ b/dist/api_data.py @@ -236,6 +236,11 @@ file_config = format_meta + [ Config('leaf_item_max', '0', r''' historic term for leaf_key_max and leaf_value_max''', min=0, undoc=True), + Config('logging', 'true', r''' + the logging setting for this table. Only valid if logging is + enabled on the connection. If logging is disabled this table + has checkpoint-level durability.''', + type='boolean'), Config('memory_page_max', '5MB', r''' the maximum size a page can grow to in memory before being reconciled to disk. The specified size will be adjusted to a lower diff --git a/src/btree/bt_handle.c b/src/btree/bt_handle.c index 7c4a4a57e3a..7c2838293d2 100644 --- a/src/btree/bt_handle.c +++ b/src/btree/bt_handle.c @@ -255,15 +255,25 @@ __btree_conf(WT_SESSION_IMPL *session, WT_CKPT *ckpt) /* Page sizes */ WT_RET(__btree_page_sizes(session)); - /* Eviction; the metadata file is never evicted. */ - if (WT_IS_METADATA(btree->dhandle)) + /* + * Set special flags for the metadata file. + * Eviction; the metadata file is never evicted. + * Logging; the metadata file is always logged if possible. + */ + if (WT_IS_METADATA(btree->dhandle)) { F_SET(btree, WT_BTREE_IN_MEMORY | WT_BTREE_NO_EVICTION); - else { + F_CLR(btree, WT_BTREE_NO_LOGGING); + } else { WT_RET(__wt_config_gets(session, cfg, "cache_resident", &cval)); if (cval.val) F_SET(btree, WT_BTREE_IN_MEMORY | WT_BTREE_NO_EVICTION); else F_CLR(btree, WT_BTREE_IN_MEMORY | WT_BTREE_NO_EVICTION); + WT_RET(__wt_config_gets(session, cfg, "logging", &cval)); + if (cval.val) + F_CLR(btree, WT_BTREE_NO_LOGGING); + else + F_SET(btree, WT_BTREE_NO_LOGGING); } /* Checksums */ diff --git a/src/config/config_def.c b/src/config/config_def.c index 845b4e65825..4365b37e1fd 100644 --- a/src/config/config_def.c +++ b/src/config/config_def.c @@ -228,6 +228,7 @@ static const WT_CONFIG_CHECK confchk_WT_SESSION_create[] = { NULL, "min=512B,max=512MB", NULL, 0 }, { "leaf_value_max", "int", NULL, "min=0", NULL, 0 }, + { "logging", "boolean", NULL, NULL, NULL, 0 }, { "lsm", "category", NULL, NULL, confchk_WT_SESSION_create_lsm_subconfigs, 11 }, @@ -344,6 +345,7 @@ static const WT_CONFIG_CHECK confchk_file_meta[] = { NULL, "min=512B,max=512MB", NULL, 0 }, { "leaf_value_max", "int", NULL, "min=0", NULL, 0 }, + { "logging", "boolean", NULL, NULL, NULL, 0 }, { "memory_page_max", "int", NULL, "min=512B,max=10TB", NULL, 0 }, @@ -786,14 +788,14 @@ static const WT_CONFIG_ENTRY config_entries[] = { "huffman_value=,immutable=0,internal_item_max=0," "internal_key_max=0,internal_key_truncate=,internal_page_max=4KB," "key_format=u,key_gap=10,leaf_item_max=0,leaf_key_max=0," - "leaf_page_max=32KB,leaf_value_max=0,lsm=(auto_throttle=,bloom=," - "bloom_bit_count=16,bloom_config=,bloom_hash_count=8," + "leaf_page_max=32KB,leaf_value_max=0,logging=,lsm=(auto_throttle=" + ",bloom=,bloom_bit_count=16,bloom_config=,bloom_hash_count=8," "bloom_oldest=0,chunk_count_limit=0,chunk_max=5GB,chunk_size=10MB" ",merge_max=15,merge_min=0),memory_page_max=5MB," "os_cache_dirty_max=0,os_cache_max=0,prefix_compression=0," "prefix_compression_min=4,source=,split_deepen_min_child=0," "split_deepen_per_child=0,split_pct=75,type=file,value_format=u", - confchk_WT_SESSION_create, 39 + confchk_WT_SESSION_create, 40 }, { "WT_SESSION.drop", "force=0,remove_files=", @@ -853,11 +855,12 @@ static const WT_CONFIG_ENTRY config_entries[] = { "huffman_value=,id=,internal_item_max=0,internal_key_max=0," "internal_key_truncate=,internal_page_max=4KB,key_format=u," "key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB," - "leaf_value_max=0,memory_page_max=5MB,os_cache_dirty_max=0," - "os_cache_max=0,prefix_compression=0,prefix_compression_min=4," - "split_deepen_min_child=0,split_deepen_per_child=0,split_pct=75," - "value_format=u,version=(major=0,minor=0)", - confchk_file_meta, 36 + "leaf_value_max=0,logging=,memory_page_max=5MB," + "os_cache_dirty_max=0,os_cache_max=0,prefix_compression=0," + "prefix_compression_min=4,split_deepen_min_child=0," + "split_deepen_per_child=0,split_pct=75,value_format=u," + "version=(major=0,minor=0)", + confchk_file_meta, 37 }, { "index.meta", "app_metadata=,collator=,columns=,extractor=,immutable=0," diff --git a/src/docs/wtperf.dox b/src/docs/wtperf.dox index 0bca48bd18c..100857a985d 100644 --- a/src/docs/wtperf.dox +++ b/src/docs/wtperf.dox @@ -179,6 +179,8 @@ Whether to create an index on the value field. execute a read prior to each insert in workload phase @par key_sz (unsigned int, default=20) key size +@par log_partial (boolean, default=false) +perform partial logging on first table only. @par min_throughput (unsigned int, default=0) abort if any throughput measured is less than this amount. Requires sample_interval to be configured diff --git a/src/include/btree.h b/src/include/btree.h index 2db14e293ed..75fefa75949 100644 --- a/src/include/btree.h +++ b/src/include/btree.h @@ -147,9 +147,10 @@ struct __wt_btree { #define WT_BTREE_BULK 0x00100 /* Bulk-load handle */ #define WT_BTREE_IN_MEMORY 0x00200 /* Cache-resident object */ #define WT_BTREE_NO_EVICTION 0x00400 /* Disable eviction */ -#define WT_BTREE_SALVAGE 0x00800 /* Handle is for salvage */ -#define WT_BTREE_UPGRADE 0x01000 /* Handle is for upgrade */ -#define WT_BTREE_VERIFY 0x02000 /* Handle is for verify */ +#define WT_BTREE_NO_LOGGING 0x00800 /* Disable logging */ +#define WT_BTREE_SALVAGE 0x01000 /* Handle is for salvage */ +#define WT_BTREE_UPGRADE 0x02000 /* Handle is for upgrade */ +#define WT_BTREE_VERIFY 0x04000 /* Handle is for verify */ uint32_t flags; }; diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index a6f80039c10..344bbdeecaf 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -1104,6 +1104,10 @@ struct __wt_session { * temporarily ignored when large values are written. The default is * one-half the size of a newly split leaf page., an integer greater * than or equal to 0; default \c 0.} + * @config{logging, the logging setting for this table. Only valid if + * logging is enabled on the connection. If logging is disabled this + * table has checkpoint-level durability., a boolean flag; default \c + * true.} * @config{lsm = (, options only relevant for LSM data sources., a set * of related configuration options defined below.} * @config{ auto_throttle, Throttle inserts into diff --git a/src/txn/txn_log.c b/src/txn/txn_log.c index d76725d13f2..0a4843a6d51 100644 --- a/src/txn/txn_log.c +++ b/src/txn/txn_log.c @@ -156,7 +156,8 @@ __wt_txn_log_op(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt) WT_TXN_OP *op; if (!FLD_ISSET(S2C(session)->log_flags, WT_CONN_LOG_ENABLED) || - F_ISSET(session, WT_SESSION_NO_LOGGING)) + F_ISSET(session, WT_SESSION_NO_LOGGING) || + F_ISSET(S2BT(session), WT_BTREE_NO_LOGGING)) return (0); txn = &session->txn; |