From a556643d583dd7c1f9590710c5a37124fe58f1fa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Tue, 18 Jan 2011 16:40:31 +0000 Subject: [PATCH] Return EIDRM rather than an empty jobstate structure for zombies. --- org.glite.lb.client/src/connection.c | 1 + org.glite.lb.common/interface/mini_http.h | 1 + org.glite.lb.server/src/bkserverd.c | 4 +--- org.glite.lb.server/src/lb_proto.c | 5 +++++ org.glite.lb.server/src/query.c | 21 ++++++++------------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/org.glite.lb.client/src/connection.c b/org.glite.lb.client/src/connection.c index ea73bb6..e5ab489 100644 --- a/org.glite.lb.client/src/connection.c +++ b/org.glite.lb.client/src/connection.c @@ -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 */ diff --git a/org.glite.lb.common/interface/mini_http.h b/org.glite.lb.common/interface/mini_http.h index 1ee062c..7dc66aa 100644 --- a/org.glite.lb.common/interface/mini_http.h +++ b/org.glite.lb.common/interface/mini_http.h @@ -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 diff --git a/org.glite.lb.server/src/bkserverd.c b/org.glite.lb.server/src/bkserverd.c index 7b49fa6..7393550 100644 --- a/org.glite.lb.server/src/bkserverd.c +++ b/org.glite.lb.server/src/bkserverd.c @@ -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: diff --git a/org.glite.lb.server/src/lb_proto.c b/org.glite.lb.server/src/lb_proto.c index 4519b06..cad2453 100644 --- a/org.glite.lb.server/src/lb_proto.c +++ b/org.glite.lb.server/src/lb_proto.c @@ -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) diff --git a/org.glite.lb.server/src/query.c b/org.glite.lb.server/src/query.c index 648bfea..1020b5e 100644 --- a/org.glite.lb.server/src/query.c +++ b/org.glite.lb.server/src/query.c @@ -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 -- 1.8.2.3