summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/conn/conn_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/conn/conn_api.c')
-rw-r--r--src/third_party/wiredtiger/src/conn/conn_api.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/src/conn/conn_api.c b/src/third_party/wiredtiger/src/conn/conn_api.c
index eb43ab1ab82..9f2f68b099e 100644
--- a/src/third_party/wiredtiger/src/conn/conn_api.c
+++ b/src/third_party/wiredtiger/src/conn/conn_api.c
@@ -1115,6 +1115,12 @@ err:
conn->cache->eviction_dirty_trigger = 1.0;
conn->cache->eviction_dirty_target = 0.1;
+ if (conn->default_session->event_handler->handle_general != NULL &&
+ F_ISSET(conn, WT_CONN_MINIMAL | WT_CONN_READY))
+ WT_TRET(conn->default_session->event_handler->handle_general(
+ conn->default_session->event_handler, &conn->iface, NULL, WT_EVENT_CONN_CLOSE));
+ F_CLR(conn, WT_CONN_MINIMAL | WT_CONN_READY);
+
/*
* Rollback all running transactions. We do this as a separate pass because an active
* transaction in one session could cause trouble when closing a file, even if that session
@@ -1139,6 +1145,15 @@ err:
WT_TRET(__wt_session_close_internal(s));
}
+ /*
+ * Set MINIMAL again and call the event handler so that statistics can monitor any end of
+ * connection activity (like the final checkpoint).
+ */
+ F_SET(conn, WT_CONN_MINIMAL);
+ if (conn->default_session->event_handler->handle_general != NULL)
+ WT_TRET(conn->default_session->event_handler->handle_general(
+ conn->default_session->event_handler, wt_conn, NULL, WT_EVENT_CONN_READY));
+
/* Wait for in-flight operations to complete. */
WT_TRET(__wt_txn_activity_drain(session));
@@ -1168,6 +1183,12 @@ err:
/* Perform a final checkpoint and shut down the global transaction state. */
WT_TRET(__wt_txn_global_shutdown(session, cfg));
+ /* We know WT_CONN_MINIMAL is set a few lines above no need to check again. */
+ if (conn->default_session->event_handler->handle_general != NULL)
+ WT_TRET(conn->default_session->event_handler->handle_general(
+ conn->default_session->event_handler, wt_conn, NULL, WT_EVENT_CONN_CLOSE));
+ F_CLR(conn, WT_CONN_MINIMAL);
+
/*
* See if close should wait for tiered storage to finish any flushing after the final
* checkpoint.
@@ -3019,6 +3040,11 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, const char *c
*/
WT_ERR(__wt_backup_open(session));
+ F_SET(conn, WT_CONN_MINIMAL);
+ if (event_handler != NULL && event_handler->handle_general != NULL)
+ WT_ERR(
+ event_handler->handle_general(event_handler, &conn->iface, NULL, WT_EVENT_CONN_READY));
+
/* Start the worker threads and run recovery. */
WT_ERR(__wt_connection_workers(session, cfg));
@@ -3036,6 +3062,8 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler, const char *c
F_SET(session, WT_SESSION_NO_DATA_HANDLES);
WT_STATIC_ASSERT(offsetof(WT_CONNECTION_IMPL, iface) == 0);
+ F_SET(conn, WT_CONN_READY);
+ F_CLR(conn, WT_CONN_MINIMAL);
*connectionp = &conn->iface;
err:
@@ -3064,6 +3092,12 @@ err:
__wt_free(session, conn->partial_backup_remove_ids);
if (ret != 0) {
+ if (conn->default_session->event_handler->handle_general != NULL &&
+ F_ISSET(conn, WT_CONN_MINIMAL | WT_CONN_READY))
+ WT_TRET(conn->default_session->event_handler->handle_general(
+ conn->default_session->event_handler, &conn->iface, NULL, WT_EVENT_CONN_CLOSE));
+ F_CLR(conn, WT_CONN_MINIMAL | WT_CONN_READY);
+
/*
* Set panic if we're returning the run recovery error or if recovery did not complete so
* that we don't try to checkpoint data handles. We need an explicit flag instead of