/* just lock one row corresponding to job in table jobs
* lock_mode: 0 = lock in share mode / 1 = for update
*/
-int edg_wll_LockJobRow(edg_wll_Context ctx, glite_jobid_const_t job, int lock_mode)
+int edg_wll_LockJobRow(edg_wll_Context ctx, const char *job, int lock_mode)
{
- char *jobid_md5 = NULL;
char *stmt = NULL;
glite_lbu_Statement sh;
int nr;
edg_wll_ResetError(ctx);
- jobid_md5 = edg_wlc_JobIdGetUnique(job);
if (lock_mode)
- trio_asprintf(&stmt, "select count(*) from jobs where jobid='%|Ss' for update", jobid_md5);
+ trio_asprintf(&stmt, "select count(*) from jobs where jobid='%|Ss' for update", job);
else
- trio_asprintf(&stmt, "select count(*) from jobs where jobid='%|Ss' lock in share mode", jobid_md5);
+ trio_asprintf(&stmt, "select count(*) from jobs where jobid='%|Ss' lock in share mode", job);
if ((nr = edg_wll_ExecSQL(ctx,stmt,&sh)) < 0) goto cleanup;
if (nr == 0) {
cleanup:
if (sh) glite_lbu_FreeStmt(&sh);
free(stmt); stmt = NULL;
- free(jobid_md5);
return edg_wll_Error(ctx, NULL, NULL);
}
#define edg_wll_LockJobRowInShareMode(X,Y) edg_wll_LockJobRow(X,Y,0)
#define edg_wll_LockJobRowForUpdate(X,Y) edg_wll_LockJobRow(X,Y,1)
-int edg_wll_LockJobRow(edg_wll_Context ctx, glite_jobid_const_t job, int lock_mode);
+int edg_wll_LockJobRow(edg_wll_Context ctx, const char *job, int lock_mode);
#endif /* GLITE_LB_LB_CALLS_H */
whole_cycle = 0;
if (edg_wll_Transaction(ctx)) goto rollback;
- if (edg_wll_LockJobRowInShareMode(ctx, job)) goto rollback;;
+ if (edg_wll_LockJobRowInShareMode(ctx, md5_jobid)) goto rollback;;
if (edg_wll_GetACL(ctx, job, &acl)) goto rollback;
if (edg_wll_QueryEventsServer(ctx,1, (const edg_wll_QueryRec **)jqra, NULL, &events)) {
free(string_jobid);
free(jqra);
- free(intstat->pub.owner);
+ free(intstat->pub.owner); intstat->pub.owner = NULL;
return edg_wll_Error(ctx, NULL, NULL);
}
free(jqra);
if (num_events == 0) {
free(string_jobid);
- free(intstat->pub.owner);
+ free(intstat->pub.owner); intstat->pub.owner = NULL;
return edg_wll_SetError(ctx,ENOENT,NULL);
}
jobid_md5 = edg_wlc_JobIdGetUnique(jobid);
if (lock) {
- edg_wll_LockJobRowForUpdate(ctx,jobid);
+ edg_wll_LockJobRowForUpdate(ctx,jobid_md5);
}
if (seq == -1) {