/* * __wt_las_create -- * Initialize the database's lookaside store. */ int __wt_las_create(WT_SESSION_IMPL *session) { WT_CONNECTION_IMPL *conn; uint32_t session_flags; const char *drop_cfg[] = { WT_CONFIG_BASE(session, WT_SESSION_drop), "force=true", NULL }; conn = S2C(session); /* * Done at startup: we cannot do it on demand because we require the * schema lock to create and drop the table, and it may not always be * available. * * Discard any previous incarnation of the table. */ WT_RET(__wt_session_drop(session, WT_LAS_URI, drop_cfg)); /* Re-create the table. */ WT_RET(__wt_session_create(session, WT_LAS_URI, WT_LAS_FORMAT)); /* * Open a shared internal session used to access the lookaside table. * This session should never be tapped for eviction. */ session_flags = WT_SESSION_LOOKASIDE_CURSOR | WT_SESSION_NO_EVICTION; WT_RET(__wt_open_internal_session( conn, "lookaside table", true, session_flags, &conn->las_session)); /* Flag that the lookaside table has been created. */ F_SET(conn, WT_CONN_LAS_OPEN); return (0); }
/* * __wt_las_create -- * Initialize the database's lookaside store. */ int __wt_las_create(WT_SESSION_IMPL *session) { WT_CONNECTION_IMPL *conn; WT_DECL_RET; const char *drop_cfg[] = { WT_CONFIG_BASE(session, WT_SESSION_drop), "force=true", NULL }; conn = S2C(session); /* * Done at startup: we cannot do it on demand because we require the * schema lock to create and drop the file, and it may not always be * available. * * Open an internal session, used for the shared lookaside cursor. * * Sessions associated with a lookaside cursor should never be tapped * for eviction. */ WT_RET(__wt_open_internal_session( conn, "lookaside table", 1, 1, &conn->las_session)); session = conn->las_session; F_SET(session, WT_SESSION_LOOKASIDE_CURSOR | WT_SESSION_NO_EVICTION); /* Discard any previous incarnation of the file. */ WT_RET(__wt_session_drop(session, WT_LAS_URI, drop_cfg)); /* Re-create the file. */ WT_RET(__wt_session_create(session, WT_LAS_URI, WT_LAS_FORMAT)); /* Open the shared cursor. */ WT_WITHOUT_DHANDLE(session, ret = __las_cursor_create(session, &conn->las_cursor)); return (ret); }