diff options
author | Ramon Fernandez <ramon.fernandez@mongodb.com> | 2015-03-26 12:27:35 -0400 |
---|---|---|
committer | Ramon Fernandez <ramon.fernandez@mongodb.com> | 2015-03-26 12:27:35 -0400 |
commit | 61d6d65a8b6c18f38465e2379b9897cab8f3f5e8 (patch) | |
tree | 89911163de7a4e1a1fcfe9deaa966d6d93840b5f /src/third_party/wiredtiger/src/async | |
parent | 06b58e9c7c349ce81504cf6ce2823082205ab0f7 (diff) | |
download | mongo-61d6d65a8b6c18f38465e2379b9897cab8f3f5e8.tar.gz |
Import wiredtiger-wiredtiger-2.5.2-293-g3e37e1f.tar.gz from wiredtiger branch mongodb-3.0
Diffstat (limited to 'src/third_party/wiredtiger/src/async')
-rw-r--r-- | src/third_party/wiredtiger/src/async/async_api.c | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/async/async_op.c | 10 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/async/async_worker.c | 11 |
3 files changed, 19 insertions, 10 deletions
diff --git a/src/third_party/wiredtiger/src/async/async_api.c b/src/third_party/wiredtiger/src/async/async_api.c index e211f2352a4..44e492cb0e5 100644 --- a/src/third_party/wiredtiger/src/async/async_api.c +++ b/src/third_party/wiredtiger/src/async/async_api.c @@ -181,11 +181,13 @@ __async_config(WT_SESSION_IMPL *session, *runp = cval.val != 0; /* - * Even if async is turned off, we want to parse and store the - * default values so that reconfigure can just enable them. + * Even if async is turned off, we want to parse and store the default + * values so that reconfigure can just enable them. + * + * Bound the minimum maximum operations at 10. */ WT_RET(__wt_config_gets(session, cfg, "async.ops_max", &cval)); - conn->async_size = (uint32_t)cval.val; + conn->async_size = (uint32_t)WT_MAX(cval.val, 10); WT_RET(__wt_config_gets(session, cfg, "async.threads", &cval)); conn->async_workers = (uint32_t)cval.val; diff --git a/src/third_party/wiredtiger/src/async/async_op.c b/src/third_party/wiredtiger/src/async/async_op.c index 86797af635b..d0c58f584cc 100644 --- a/src/third_party/wiredtiger/src/async/async_op.c +++ b/src/third_party/wiredtiger/src/async/async_op.c @@ -267,11 +267,17 @@ __wt_async_op_enqueue(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op) conn = S2C(session); async = conn->async; + /* - * Enqueue op at the tail of the work queue. + * If an application re-uses a WT_ASYNC_OP, we end up here with an + * invalid object. */ - WT_ASSERT(session, op->state == WT_ASYNCOP_READY); + if (op->state != WT_ASYNCOP_READY) + WT_RET_MSG(session, EINVAL, + "application error: WT_ASYNC_OP already in use"); + /* + * Enqueue op at the tail of the work queue. * We get our slot in the ring buffer to use. */ my_alloc = WT_ATOMIC_ADD8(async->alloc_head, 1); diff --git a/src/third_party/wiredtiger/src/async/async_worker.c b/src/third_party/wiredtiger/src/async/async_worker.c index c68d0e8a838..543046f7a0c 100644 --- a/src/third_party/wiredtiger/src/async/async_worker.c +++ b/src/third_party/wiredtiger/src/async/async_worker.c @@ -18,8 +18,8 @@ __async_op_dequeue(WT_CONNECTION_IMPL *conn, WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL **op) { WT_ASYNC *async; - long sleep_usec; uint64_t cur_tail, last_consume, my_consume, my_slot, prev_slot; + uint64_t sleep_usec; uint32_t tries; async = conn->async; @@ -75,7 +75,8 @@ retry: */ my_slot = my_consume % async->async_qsize; prev_slot = last_consume % async->async_qsize; - *op = WT_ATOMIC_STORE8(async->async_queue[my_slot], NULL); + *op = (WT_ASYNC_OP_IMPL*)WT_ATOMIC_STORE8( + async->async_queue[my_slot], NULL); WT_ASSERT(session, async->cur_queue > 0); WT_ASSERT(session, *op != NULL); @@ -278,10 +279,10 @@ __async_worker_op(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op, } /* - * __async_worker -- + * __wt_async_worker -- * The async worker threads. */ -void * +WT_THREAD_RET __wt_async_worker(void *arg) { WT_ASYNC *async; @@ -354,5 +355,5 @@ err: WT_PANIC_MSG(session, ret, "async worker error"); __wt_free(session, ac); ac = acnext; } - return (NULL); + return (WT_THREAD_RET_VALUE); } |