From 8ba4c02f5e520358fac3b431d5ed5c9640396883 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@llnl.gov>
Date: Mon, 12 Jan 2009 21:01:52 +0000
Subject: [PATCH] svn merge -r16181:16186
 https://eris.llnl.gov/svn/slurm/branches/slurm-1.3

---
 .../mysql/accounting_storage_mysql.c                  |  2 +-
 src/sacct/print.c                                     |  4 ++--
 src/slurmctld/job_mgr.c                               | 11 +++++++++++
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
index 9e72dc3cd2c..e91f1abf13c 100644
--- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
+++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
@@ -6284,7 +6284,7 @@ extern List acct_storage_p_remove_clusters(mysql_conn_t *mysql_conn,
 	/* We should not need to delete any cluster usage just set it
 	 * to deleted */
 	xstrfmtcat(query,
-		   "update %s set period_end=%d where (%s);"
+		   "update %s set period_end=%d where period_end=0 && (%s);"
 		   "update %s set mod_time=%d, deleted=1 where (%s);"
 		   "update %s set mod_time=%d, deleted=1 where (%s);"
 		   "update %s set mod_time=%d, deleted=1 where (%s);",
diff --git a/src/sacct/print.c b/src/sacct/print.c
index ebd0768250a..7291034d544 100644
--- a/src/sacct/print.c
+++ b/src/sacct/print.c
@@ -73,11 +73,11 @@ void _elapsed_time(long secs, long usecs, char *str)
 		         days, hours, minutes, seconds);
 	else if (hours)
 		snprintf(str, FORMAT_STRING_SIZE,
-			 "%ld:%2.2ld:%2.2ld",
+			 "%2.2ld:%2.2ld:%2.2ld",
 		         hours, minutes, seconds);
 	else
 		snprintf(str, FORMAT_STRING_SIZE,
-			 "%ld:%2.2ld.%3.3ld",
+			 "%2.2ld:%2.2ld.%3.3ld",
 		         minutes, seconds, subsec);
 }
 
diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index daa7c3026cc..29bbcf9ef80 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -1266,10 +1266,16 @@ extern int kill_running_job_by_node_name(char *node_name)
 				job_ptr->job_state  = JOB_NODE_FAIL;
 				deallocate_nodes(job_ptr, false, suspended);
 				job_completion_logger(job_ptr);
+				job_ptr->db_index = 0;
 				job_ptr->job_state = JOB_PENDING;
 				if (job_ptr->node_cnt)
 					job_ptr->job_state |= JOB_COMPLETING;
 				job_ptr->details->submit_time = now;
+				/* Since the job completion logger
+				   removes the submit we need to add it
+				   again.
+				*/
+				acct_policy_add_job_submit(job_ptr);
 			} else {
 				info("Killing job_id %u on failed node %s",
 				     job_ptr->job_id, node_name);
@@ -5876,10 +5882,15 @@ extern int job_requeue (uid_t uid, uint32_t job_id, slurm_fd conn_fd)
 	deallocate_nodes(job_ptr, false, suspended);
 	xfree(job_ptr->details->req_node_layout);
 	job_completion_logger(job_ptr);
+	job_ptr->db_index = 0;
 	job_ptr->job_state = JOB_PENDING;
 	if (job_ptr->node_cnt)
 		job_ptr->job_state |= JOB_COMPLETING;
 	job_ptr->details->submit_time = now;
+	/* Since the job completion logger removes the submit we need
+	   to add it again.
+	*/
+	acct_policy_add_job_submit(job_ptr);
 
     reply:
 	if (conn_fd >= 0) {
-- 
GitLab