示例#1
0
static int
check_timing(CONFIG *cfg,
    const char *name, struct timespec start, struct timespec *stop)
{
	uint64_t last_interval;
	int ret;

	if ((ret = __wt_epoch(NULL, stop)) != 0) {
		lprintf(cfg, ret, 0,
		    "Get time failed in cycle_idle_tables.");
		cfg->error = ret;
		return (ret);
	}

	last_interval = (uint64_t)(WT_TIMEDIFF_SEC(*stop, start));

	if (last_interval > cfg->idle_table_cycle) {
		lprintf(cfg, ret, 0,
		    "Cycling idle table failed because %s took %" PRIu64
		    " seconds which is longer than configured acceptable"
		    " maximum of %" PRIu32 ".",
		    name, last_interval, cfg->idle_table_cycle);
		cfg->error = ETIMEDOUT;
		return (ETIMEDOUT);
	}
	return (0);
}
示例#2
0
/*
 * __wt_session_compact_check_timeout --
 *	Check if the timeout has been exceeded.
 */
int
__wt_session_compact_check_timeout(WT_SESSION_IMPL *session)
{
	struct timespec end;

	if (session->compact->max_time == 0)
		return (0);

	__wt_epoch(session, &end);
	return (session->compact->max_time >
	    WT_TIMEDIFF_SEC(end, session->compact->begin) ? 0 : ETIMEDOUT);
}