Exemple #1
0
/*
 * __wt_connection_workers --
 *	Start the worker threads.
 */
int
__wt_connection_workers(WT_SESSION_IMPL *session, const char *cfg[])
{
	/*
	 * Start the optional statistics thread.  Start statistics first so that
	 * other optional threads can know if statistics are enabled or not.
	 */
	WT_RET(__wt_statlog_create(session, cfg));
	WT_RET(__wt_logmgr_create(session, cfg));

	/*
	 * Run recovery.
	 * NOTE: This call will start (and stop) eviction if recovery is
	 * required.  Recovery must run before the lookaside table is created
	 * (because recovery will update the metadata), and before eviction is
	 * started for real.
	 */
	WT_RET(__wt_txn_recover(session));

	/*
	 * Start the optional logging/archive threads.
	 * NOTE: The log manager must be started before checkpoints so that the
	 * checkpoint server knows if logging is enabled.  It must also be
	 * started before any operation that can commit, or the commit can
	 * block.
	 */
	WT_RET(__wt_logmgr_open(session));

	/* Initialize metadata tracking, required before creating tables. */
	WT_RET(__wt_meta_track_init(session));

	/* Create the lookaside table. */
	WT_RET(__wt_las_create(session));

	/*
	 * Start eviction threads.
	 * NOTE: Eviction must be started after the lookaside table is created.
	 */
	WT_RET(__wt_evict_create(session));

	/* Start the handle sweep thread. */
	WT_RET(__wt_sweep_create(session));

	/* Start the optional async threads. */
	WT_RET(__wt_async_create(session, cfg));

	/* Start the optional checkpoint thread. */
	WT_RET(__wt_checkpoint_server_create(session, cfg));

	return (0);
}
Exemple #2
0
/*
 * __wt_conn_reconfig --
 *	Reconfigure a connection (internal version).
 */
int
__wt_conn_reconfig(WT_SESSION_IMPL *session, const char **cfg)
{
	WT_CONNECTION_IMPL *conn;
	WT_DECL_RET;
	const char *p;

	conn = S2C(session);

	/* Serialize reconfiguration. */
	__wt_spin_lock(session, &conn->reconfig_lock);

	/*
	 * The configuration argument has been checked for validity, update the
	 * previous connection configuration.
	 *
	 * DO NOT merge the configuration before the reconfigure calls.  Some
	 * of the underlying reconfiguration functions do explicit checks with
	 * the second element of the configuration array, knowing the defaults
	 * are in slot #1 and the application's modifications are in slot #2.
	 *
	 * Replace the base configuration set up by CONNECTION_API_CALL with
	 * the current connection configuration, otherwise reconfiguration
	 * functions will find the base value instead of previously configured
	 * value.
	 */
	cfg[0] = conn->cfg;

	/*
	 * Reconfigure the system.
	 *
	 * The compatibility version check is special: upgrade / downgrade
	 * cannot be done with transactions active, and checkpoints must not
	 * span a version change.  Hold the checkpoint lock to avoid conflicts
	 * with WiredTiger's checkpoint thread, and rely on the documentation
	 * specifying that no new operations can start until the upgrade /
	 * downgrade completes.
	 */
	WT_WITH_CHECKPOINT_LOCK(session,
	    ret = __wt_conn_compat_config(session, cfg));
	WT_ERR(ret);
	WT_ERR(__wt_conn_statistics_config(session, cfg));
	WT_ERR(__wt_async_reconfig(session, cfg));
	WT_ERR(__wt_cache_config(session, true, cfg));
	WT_ERR(__wt_checkpoint_server_create(session, cfg));
	WT_ERR(__wt_logmgr_reconfig(session, cfg));
	WT_ERR(__wt_lsm_manager_reconfig(session, cfg));
	WT_ERR(__wt_statlog_create(session, cfg));
	WT_ERR(__wt_sweep_config(session, cfg));
	WT_ERR(__wt_verbose_config(session, cfg));
	WT_ERR(__wt_timing_stress_config(session, cfg));

	/* Third, merge everything together, creating a new connection state. */
	WT_ERR(__wt_config_merge(session, cfg, NULL, &p));
	__wt_free(session, conn->cfg);
	conn->cfg = p;

err:	__wt_spin_unlock(session, &conn->reconfig_lock);

	return (ret);
}