summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2013-03-15 11:03:06 +1100
committerAlex Gorrod <alexg@wiredtiger.com>2013-03-15 11:03:06 +1100
commitccf052860e8178b2b3fe3a1b9f75cae193630d08 (patch)
tree3f2fe91831db63d259743bd1cfcf1a896fc95664
parent802ceb1be5de693603529530eb8a4818ccb5d50d (diff)
downloadmongo-ccf052860e8178b2b3fe3a1b9f75cae193630d08.tar.gz
Try harder to cleanup after a failed wiredtiger_open call.
References issue #427
-rw-r--r--src/conn/conn_api.c2
-rw-r--r--src/conn/conn_cache_pool.c10
-rw-r--r--src/txn/txn.c3
3 files changed, 12 insertions, 3 deletions
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index 3e64e63107a..7b8eeb05600 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -991,7 +991,7 @@ err: if (cbuf != NULL)
__wt_buf_free(session, &exconfig);
if (ret != 0 && conn != NULL)
- WT_TRET(__wt_connection_destroy(conn));
+ WT_TRET(__wt_connection_close(conn));
/* Let the server threads proceed. */
if (ret == 0)
diff --git a/src/conn/conn_cache_pool.c b/src/conn/conn_cache_pool.c
index d570c6b3593..02f54e8bad0 100644
--- a/src/conn/conn_cache_pool.c
+++ b/src/conn/conn_cache_pool.c
@@ -254,7 +254,15 @@ __wt_conn_cache_pool_destroy(WT_CONNECTION_IMPL *conn)
cp->currently_used -= conn->cache_size;
}
- WT_ASSERT(session, cp->refs > 0);
+ /*
+ * If there are no references, we are cleaning up after a failed
+ * wiredtiger_open, there is nothing further to do.
+ */
+ if (cp->refs < 1) {
+ __wt_spin_unlock(session, &cp->cache_pool_lock);
+ return (0);
+ }
+
if (--cp->refs == 0) {
WT_ASSERT(session, TAILQ_EMPTY(&cp->cache_pool_qh));
F_CLR(cp, WT_CACHE_POOL_RUN);
diff --git a/src/txn/txn.c b/src/txn/txn.c
index 2b0bef4f44f..9cc00e0c6a1 100644
--- a/src/txn/txn.c
+++ b/src/txn/txn.c
@@ -461,5 +461,6 @@ __wt_txn_global_destroy(WT_CONNECTION_IMPL *conn)
session = conn->default_session;
txn_global = &conn->txn_global;
- __wt_free(session, txn_global->states);
+ if (txn_global && txn_global->states != NULL)
+ __wt_free(session, txn_global->states);
}