Return EIDRM rather than an empty jobstate structure for zombies.
authorZdeněk Šustr <sustr4@cesnet.cz>
Tue, 18 Jan 2011 16:40:31 +0000 (16:40 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Tue, 18 Jan 2011 16:40:31 +0000 (16:40 +0000)
org.glite.lb.client/src/connection.c
org.glite.lb.common/interface/mini_http.h
org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/lb_proto.c
org.glite.lb.server/src/query.c

index ea73bb6..e5ab489 100644 (file)
@@ -548,6 +548,7 @@ int http_check_status(
                        break;
                /* soft errors - some useful data may be returned too */
                case HTTP_UNAUTH: /* EPERM */
+               case HTTP_GONE: /*EIDRM*/
                case HTTP_NOTFOUND: /* ENOENT */
                case HTTP_NOTIMPL: /* ENOSYS */
                case HTTP_UNAVAIL: /* EAGAIN */
index 1ee062c..7dc66aa 100644 (file)
@@ -47,6 +47,7 @@ limitations under the License.
 #define HTTP_UNAUTH            401
 #define HTTP_NOTFOUND          404
 #define HTTP_NOTALLOWED                405
+#define HTTP_GONE              410
 #define HTTP_UNSUPPORTED       415 
 #define HTTP_INTERNAL          500
 #define HTTP_NOTIMPL           501
index 7b49fa6..7393550 100644 (file)
@@ -1475,9 +1475,7 @@ static int handle_server_error(edg_wll_Context ctx)
        case EEXIST:
        case EDG_WLL_ERROR_NOINDEX:
        case E2BIG:
-               glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_WARN,
-                       "[%d] %s (%s)", getpid(), errt, errd);
-               break;
+       case EIDRM:
        case EINVAL:
        case EDG_WLL_ERROR_PARSE_BROKEN_ULM:
        case EDG_WLL_ERROR_PARSE_EVENT_UNDEF:
index 4519b06..cad2453 100644 (file)
@@ -101,6 +101,7 @@ char *edg_wll_HTTPErrorMessage(int errCode)
                case HTTP_INTERNAL: msg = "Internal Server Error"; break;
                case HTTP_UNAVAIL: msg = "Service Unavailable"; break;
                case HTTP_INVALID: msg = "Invalid Data"; break;
+               case HTTP_GONE: msg = "Gone"; break;
                default: msg = "Unknown error"; break;
        }
 
@@ -535,6 +536,7 @@ edg_wll_ErrorCode edg_wll_ProtoV21(edg_wll_Context ctx,
                                                break;
                                        case ENOENT: ret = HTTP_NOTFOUND; break;
                                        case EPERM: ret = HTTP_UNAUTH; break;
+                                       case EIDRM: ret = HTTP_GONE; break;
                                        case EDG_WLL_ERROR_NOINDEX: ret = HTTP_UNAUTH; break;
                                        case ENOMEM: fatal = 1; ret = HTTP_INTERNAL; break;
                                        default: ret = HTTP_INTERNAL; break;
@@ -656,6 +658,7 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx,
                                        break;
                                case ENOENT: ret = HTTP_NOTFOUND; break;
                                case EPERM: ret = HTTP_UNAUTH; break;
+                               case EIDRM: ret = HTTP_GONE; break;
                                case EDG_WLL_ERROR_NOINDEX: ret = HTTP_UNAVAIL; break;
                                default: ret = HTTP_INTERNAL; break;
                        }
@@ -721,6 +724,7 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx,
                                case ENOENT: ret = HTTP_NOTFOUND; break;
                                case EINVAL: ret = HTTP_INVALID; break;
                                case EPERM : ret = HTTP_UNAUTH; break;
+                               case EIDRM : ret = HTTP_GONE; break;
                                default: ret = HTTP_INTERNAL; break;
                        }
                        if (!html && (ret != HTTP_INTERNAL))
@@ -902,6 +906,7 @@ edg_wll_ErrorCode edg_wll_Proto(edg_wll_Context ctx,
                                        case EINVAL: ret = HTTP_UNAUTH; break;
                                        case EDG_WLL_ERROR_NOINDEX: ret = HTTP_UNAUTH; break;
                                        case ENOMEM: fatal = 1; ret = HTTP_INTERNAL; break;
+                                       case EIDRM: ret = HTTP_GONE; break;
                                        default: ret = HTTP_INTERNAL; break;
                                }
                                if (!html && !fatal)
index 648bfea..1020b5e 100644 (file)
@@ -443,6 +443,7 @@ int edg_wll_QueryJobsServerStream(
                                                j = 0,
                                                ret = 0,
                                                eperm = 0,
+                                               eidrm = 0,
                                                limit = 0, offset = 0,
                                                limit_loop = 1,
                                                where_flags = 0,
@@ -653,25 +654,19 @@ limit_cycle_cleanup:
                                LOG_PRIORITY_DEBUG, zquery);
                        j = edg_wll_ExecSQL(ctx,zquery,&sh);
 
-                       if (j > 0) {
-                               n = 0;
-                               while ( (ret=edg_wll_FetchRow(ctx,sh,sizofa(res),NULL,res)) > 0 ) {
-                                       edg_wlc_JobIdParse(res[0], &jobid);
-                                       edg_wlc_JobIdParse(res[0], &status.jobId);
-                                       status.state = EDG_WLL_JOB_PURGED;
-                                       free(res[0]); free(res[1]); free(res[2]);
-                                       if (cb(ctx, jobid, &status, data) != 0)
-                                               goto cleanup;
-                                       n++;
-                               }
-                       }
+                       if (j > 0) eidrm = 1;
+
                        glite_lbu_FreeStmt(&sh);
+                       free (zquery);
                }
        }
 
        if ( !n ) {
                if (eperm) edg_wll_SetError(ctx, EPERM, "matching jobs found but authorization failed");
-               else edg_wll_SetError(ctx, ENOENT, "no matching jobs found");
+               else {
+                       if (eidrm) edg_wll_SetError(ctx, EIDRM, "matching job already purged");
+                       else edg_wll_SetError(ctx, ENOENT, "no matching jobs found");
+               }
        }
 
        // finish