diff --git a/src/common/slurmdbd_defs.c b/src/common/slurmdbd_defs.c
index 9b61450b182bfd8265f7ce466fe08da5489ddcea..0b71e38c2bc81f798a16d99fae4465eccde6f47f 100644
--- a/src/common/slurmdbd_defs.c
+++ b/src/common/slurmdbd_defs.c
@@ -270,8 +270,8 @@ extern int slurm_send_slurmdbd_msg(slurmdbd_msg_t *req)
 	    (difftime(time(NULL), syslog_time) > 120)) {
 		/* Record critical error every 120 seconds */
 		syslog_time = time(NULL);
-		error("slurmdbd: agent queue filling, RESTART SLURM DBD NOW");
-		syslog(LOG_CRIT, "*** RESTART SLURM DBD NOW ***");
+		error("slurmdbd: agent queue filling, RESTART SLURMDBD NOW");
+		syslog(LOG_CRIT, "*** RESTART SLURMDBD NOW ***");
 	}
 	if (cnt == (MAX_AGENT_QUEUE - 1))
 		cnt -= _purge_job_start_req();
@@ -1004,7 +1004,7 @@ static void *_agent(void *x)
 		slurm_mutex_unlock(&slurmdbd_lock);
 
 		slurm_mutex_lock(&agent_lock);
-		if (agent_list && (rc != EAGAIN)) {
+		if (agent_list && (rc == SLURM_SUCCESS)) {
 			buffer = (Buf) list_dequeue(agent_list);
 			free_buf(buffer);
 			fail_time = 0;
diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
index 7a82fca87bd3c322b577b9bd3950496bb5b0d69b..5f162185d02b628169934925bac4be46b14d9ea5 100644
--- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
+++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
@@ -5409,9 +5409,10 @@ extern int acct_storage_p_update_shares_used(mysql_conn_t *mysql_conn,
 extern int acct_storage_p_flush_jobs_on_cluster(
 	mysql_conn_t *mysql_conn, char *cluster, time_t event_time)
 {
+	int rc = SLURM_SUCCESS;
+#ifdef HAVE_MYSQL
 	/* put end times for a clean start */
 	char *query = NULL;
-	int rc = SLURM_SUCCESS;
 
 	if(!mysql_conn) {
 		error("We need a connection to run this");
@@ -5426,13 +5427,16 @@ extern int acct_storage_p_flush_jobs_on_cluster(
 		}
 	}
 
-	query = xstrdup_printf("update %s as t1, %s as t2 set t1.end=%u where "
+	query = xstrdup_printf("update %s as t1, %s as t2 set "
+			       "t1.state=%u, t1.end=%u where "
 			       "t2.id=t1.associd and t2.cluster='%s' "
 			       "&& t1.end=0;",
-			       job_table, assoc_table, event_time, cluster);
+			       job_table, assoc_table, JOB_CANCELLED, 
+			       event_time, cluster);
 
 	rc = mysql_db_query(mysql_conn->acct_mysql_db, query);
 	xfree(query);
+#endif
 
 	return rc;
 }
diff --git a/src/plugins/accounting_storage/mysql/mysql_rollup.c b/src/plugins/accounting_storage/mysql/mysql_rollup.c
index 452d1bb9aa22b9c1732e29ab6c17febe6b67e7f9..8c6163647c6023480185f4d8f11db98f05803bd5 100644
--- a/src/plugins/accounting_storage/mysql/mysql_rollup.c
+++ b/src/plugins/accounting_storage/mysql/mysql_rollup.c
@@ -149,12 +149,13 @@ extern int mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 	c_itr = list_iterator_create(cluster_usage_list);
 	while(curr_start < end) {
 		int last_id = 0;
+		int seconds = 0;
 		local_cluster_usage_t *c_usage = NULL;
 		local_assoc_usage_t *a_usage = NULL;
 
 		// first get the events during this time
 		query = xstrdup_printf("select %s from %s where "
-				       "(period_start <= %d "
+				       "(period_start < %d "
 				       "&& period_end >= %d) "
 				       "|| period_end = 0 "
 				       "order by node_name, period_start",
@@ -204,22 +205,20 @@ extern int mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 
 					if((local_end - local_start) < 1)
 						continue;
+					/* need to add 1 sec to the
+					   subtraction to get the
+					   total time */
+					seconds = (local_end - local_start)+1;
 
 					info("node %s adds (%d)(%d-%d) * %d = %d "
 					     "to %d",
 					     row[EVENT_REQ_NAME],
-					     (local_end - local_start)+1,
+					     seconds,
 					     local_end, local_start,
 					     row_cpu, 
-					     ((local_end - local_start)+1)
-					     * row_cpu, 
+					     seconds * row_cpu, 
 					     row_cpu);
-					/* need to add 1 sec to the
-					   subtraction to get the
-					   total time */
-					c_usage->d_cpu += 
-						((local_end - local_start) + 1)
-						* row_cpu;
+					c_usage->d_cpu += seconds * row_cpu;
 					
 					/* don't break here just
 					   incase the cpu count changed during
@@ -292,19 +291,22 @@ extern int mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 
 					if((local_end - local_start) < 1)
 						goto calc_resv;
+
+					/* need to add 1 sec to the
+					   subtraction to get the
+					   total time */
+					seconds = (local_end - local_start)+1;
+
 					info("%d assoc %d adds (%d)(%d-%d) * %d = %d "
 					     "to %d",
 					     job_id,
 					     assoc_id,
-					     local_end - local_start,
+					     seconds,
 					     local_end, local_start,
 					     row_acpu,
-					     (local_end - local_start)
-					     * row_acpu,
+					     seconds * row_acpu,
 					     row_acpu);
-					c_usage->a_cpu +=
-						(local_end - local_start)
-						* row_acpu;
+					c_usage->a_cpu += seconds * row_acpu;
 				calc_resv:
 					/* now reserved time */
 					if(row_start < c_usage->start)
@@ -319,20 +321,21 @@ extern int mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 					if((local_end - local_start) < 1)
 						continue;
 					
+					/* need to add 1 sec to the
+					   subtraction to get the
+					   total time */
+					seconds = (local_end - local_start)+1;
+
 					info("%d assoc %d reserved (%d)(%d-%d) * %d = %d "
 					     "to %d",
 					     job_id,
 					     assoc_id,
-					     (local_end - local_start),
+					     seconds,
 					     local_end, local_start,
 					     row_rcpu,
-					     (local_end - local_start)
-					     * row_rcpu,
+					     seconds * row_rcpu,
 					     row_rcpu);
-					c_usage->r_cpu +=
-						(local_end - local_start)
-						* row_rcpu;
-
+					c_usage->r_cpu += seconds * row_rcpu;
 
 					/* don't break here just
 					   incase the cpu count changed during