summaryrefslogtreecommitdiff
path: root/src/async
diff options
context:
space:
mode:
authorSusan LoVerso <sue@wiredtiger.com>2014-04-07 15:31:14 -0400
committerSusan LoVerso <sue@wiredtiger.com>2014-04-07 15:31:14 -0400
commit733cf25bc9ac9fb5960f4eb4a6cbe051e1c1fef4 (patch)
tree1d8157bac8a792236916853a2f7c331d695f9786 /src/async
parentf4d482a2346bd6a8f7f0f743341bc0f90aee207c (diff)
downloadmongo-733cf25bc9ac9fb5960f4eb4a6cbe051e1c1fef4.tar.gz
Add the uri/config/format cached queue for async ops.
Diffstat (limited to 'src/async')
-rw-r--r--src/async/async_api.c20
-rw-r--r--src/async/async_worker.c13
2 files changed, 26 insertions, 7 deletions
diff --git a/src/async/async_api.c b/src/async/async_api.c
index b7ae57f7c8c..cd0f2f92ea5 100644
--- a/src/async/async_api.c
+++ b/src/async/async_api.c
@@ -168,7 +168,8 @@ __async_set_key(WT_ASYNC_OP *asyncop, ...)
ASYNCOP_API_CALL(O2C(op), session, set_key);
va_start(ap, asyncop);
__async_set_keyv(asyncop, asyncop->flags, ap);
- fprintf(stderr, "async_set_key: id %d unique %" PRIu64 " key %s\n",
+ fprintf(stderr, "async_set_key: key_format %s id %d unique %"
+ PRIu64 " key %s\n", op->iface.key_format,
op->internal_id, op->unique_id, (char *)asyncop->key.data);
va_end(ap);
if (0) {
@@ -203,6 +204,23 @@ err: asyncop->saved_err = ret;
}
/*
+ * __wt_async_set_raw_value --
+ * Set value via WT_ITEM.
+ */
+void
+__wt_async_set_raw_value(WT_ASYNC_OP *asyncop, WT_ITEM *value)
+{
+ int raw_set;
+
+ raw_set = F_ISSET(asyncop, WT_ASYNCOP_RAW) ? 1 : 0;
+ if (!raw_set)
+ F_SET(asyncop, WT_ASYNCOP_RAW);
+ asyncop->set_value(asyncop, value);
+ if (!raw_set)
+ F_CLR(asyncop, WT_ASYNCOP_RAW);
+}
+
+/*
* __async_op_wrap --
* Common wrapper for all async operations.
*/
diff --git a/src/async/async_worker.c b/src/async/async_worker.c
index e19c7756fcc..bd29c38c80c 100644
--- a/src/async/async_worker.c
+++ b/src/async/async_worker.c
@@ -46,9 +46,10 @@ __async_worker_cursor(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op,
wt_session = (WT_SESSION *)session;
*cursorp = NULL;
+ WT_ASSERT(session, op->format != NULL);
STAILQ_FOREACH(ac, &worker->cursorqh, q) {
- if (op->cfg_hash == ac->cfg_hash &&
- op->uri_hash == ac->uri_hash) {
+ if (op->format->cfg_hash == ac->cfg_hash &&
+ op->format->uri_hash == ac->uri_hash) {
*cursorp = ac->c;
return (0);
}
@@ -59,9 +60,9 @@ __async_worker_cursor(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op,
*/
WT_RET(__wt_calloc_def(session, 1, &ac));
WT_ERR(wt_session->open_cursor(
- wt_session, op->uri, NULL, op->config, &c));
- ac->cfg_hash = op->cfg_hash;
- ac->uri_hash = op->uri_hash;
+ wt_session, op->format->uri, NULL, op->format->config, &c));
+ ac->cfg_hash = op->format->cfg_hash;
+ ac->uri_hash = op->format->uri_hash;
ac->c = c;
STAILQ_INSERT_HEAD(&worker->cursorqh, ac, q);
worker->num_cursors++;
@@ -104,7 +105,7 @@ __async_worker_execop(WT_SESSION_IMPL *session, WT_ASYNC_OP_IMPL *op,
* the op for op->get_value.
*/
__wt_cursor_get_raw_value(cursor, &val);
- asyncop->set_value(asyncop, &val);
+ __wt_async_set_raw_value(asyncop, &val);
break;
default:
WT_ERR_MSG(session, EINVAL, "Unknown async optype %d\n",