don't relay on histogram saved in intJobstat when reporting status
authorMiloš Mulač <mulac@civ.zcu.cz>
Mon, 30 Oct 2006 12:12:19 +0000 (12:12 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Mon, 30 Oct 2006 12:12:19 +0000 (12:12 +0000)
org.glite.lb.server/src/jobstat.c

index 50a8ed2..42b0747 100644 (file)
@@ -167,12 +167,19 @@ int edg_wll_JobStatus(
                if (1) {
                        char *out[2];
                        edg_wll_Stmt sh;
-                       int num_sub, num_f;
+                       int num_sub, num_f, i;
 
                        if (stat->children_hist == NULL) {
                                stat->children_hist = (int*) calloc(1+EDG_WLL_NUMBER_OF_STATCODES, sizeof(int));
                                stat->children_hist[0] = EDG_WLL_NUMBER_OF_STATCODES;
                        }
+                       else {
+                               /* If hist is loaded, it probably contain only incomplete histogram
+                                * builded in update_parent_status. Count it from scratch...
+                                */
+                               for (i=1; i<=EDG_WLL_NUMBER_OF_STATCODES; i++)
+                                       stat->children_hist[i] = 0;
+                       }       
                        if ((flags & EDG_WLL_STAT_CHILDREN) == 0) {
                                trio_asprintf(&stmt, "SELECT status FROM states "
                                                        "WHERE parent_job='%|Ss' AND version='%|Ss'",