diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-03-16 15:03:31 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2017-03-16 15:03:31 +1100 |
commit | b77f9cc3b7fe7c15445c13df9bef74f1dd39b991 (patch) | |
tree | 4bc4e49f25816b33ca77afddaab0a2789e5572b1 | |
parent | 28a883f7b4acd020a8d92a733cb9df415a6be482 (diff) | |
download | mongo-b77f9cc3b7fe7c15445c13df9bef74f1dd39b991.tar.gz |
WT-3218 Avoid adding duplicate handles to connection dhandle list (#3331)
* Recheck for existence after acquiring write lock when creating a new dhandle.
* Add a wtperf workload that reproduced the original failure.
-rw-r--r-- | bench/wtperf/runners/many-table-stress.wtperf | 19 | ||||
-rw-r--r-- | src/conn/conn_dhandle.c | 8 |
2 files changed, 27 insertions, 0 deletions
diff --git a/bench/wtperf/runners/many-table-stress.wtperf b/bench/wtperf/runners/many-table-stress.wtperf new file mode 100644 index 00000000000..51d0bb0dd9d --- /dev/null +++ b/bench/wtperf/runners/many-table-stress.wtperf @@ -0,0 +1,19 @@ +# Create a set of tables with uneven distribution of data +conn_config="cache_size=1G,eviction=(threads_max=8),file_manager=(close_idle_time=100000),checkpoint=(wait=20,log_size=2GB),statistics=(fast),statistics_log=(wait=5,json),session_max=1000" +table_config="type=file" +table_count=5000 +icount=0 +random_range=1000000000 +pareto=10 +range_partition=true +report_interval=5 + +run_ops=1000000 +populate_threads=0 +icount=0 +threads=((count=60,inserts=1)) + +# Warn if a latency over 1 second is seen +max_latency=1000 +sample_interval=5 +sample_rate=1 diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c index 6c8d66d63f8..c5480897494 100644 --- a/src/conn/conn_dhandle.c +++ b/src/conn/conn_dhandle.c @@ -42,6 +42,14 @@ __wt_conn_dhandle_alloc( WT_DECL_RET; uint64_t bucket; + /* + * Ensure no one beat us to creating the handle now that we hold the + * write lock. + */ + if ((ret = + __wt_conn_dhandle_find(session, uri, checkpoint)) != WT_NOTFOUND) + return (ret); + WT_RET(__wt_calloc_one(session, &dhandle)); __wt_rwlock_init(session, &dhandle->rwlock); |