removed legacy non-embrionic regitration and buffered insert support
authorMiloš Mulač <mulac@civ.zcu.cz>
Thu, 14 Feb 2008 16:51:54 +0000 (16:51 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Thu, 14 Feb 2008 16:51:54 +0000 (16:51 +0000)
org.glite.lb.server/Makefile
org.glite.lb.server/interface/store.h
org.glite.lb.server/src/db_store.c
org.glite.lb.server/src/jobstat.c
org.glite.lb.server/src/store.c.T

index 9cd80ac..cac2e0e 100644 (file)
@@ -41,13 +41,6 @@ else
        STATIC_LIB_BK:=libglite_lb_bkserver.a
 endif
 
-# Use embrionic DAG registration implicitely
-LB_DAG_FLAGS:=-DLB_DAG_EMBRIONIC
-
-ifdef LB_BUF
-       LB_BUF_FLAGS:=-DLB_BUF
-endif
-
 ifeq ($(GLITE_LB_SERVER_WITH_WS),yes)
        WS_CFLAGS=-DGLITE_LB_SERVER_WITH_WS 
        NSMAP=LoggingAndBookkeeping.nsmap
@@ -86,8 +79,7 @@ CFLAGS:= \
        -I${voms_prefix}/include \
        ${COVERAGE_FLAGS} \
        $(GRIDSITE_CFLAGS) \
-       -D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS} ${LB_DAG_FLAGS} \
-       ${LB_BUF_FLAGS} \
+       -D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS} \
        -I${globus_prefix}/include/${nothrflavour} #gridsite needs this
 
 ifdef LB_PROF
index 9518e00..03a7b49 100644 (file)
@@ -47,9 +47,6 @@ int handle_request(edg_wll_Context,char *);
 int create_reply(const edg_wll_Context,char **);
 int is_job_local(edg_wll_Context, glite_jobid_const_t jobId);
 int store_job_server_proxy(edg_wll_Context ctx, edg_wll_Event *event, int *register_to_JP);
-#ifndef LB_DAG_EMBRIONIC
-int register_subjobs(edg_wll_Context,const edg_wll_RegJobEvent *);
-#endif
 int register_subjobs_embryonic(edg_wll_Context,const edg_wll_RegJobEvent *);
 
 
index 2654e34..d450188 100644 (file)
@@ -108,11 +108,7 @@ rollback:;
                 ev->regJob.jobtype == EDG_WLL_REGJOB_COLLECTION) &&
                ev->regJob.nsubjobs > 0)  
 
-#ifdef LB_DAG_EMBRIONIC
                        if (register_subjobs_embryonic(ctx,&ev->regJob)) goto rollback2;
-#else
-                       if (register_subjobs(ctx,&ev->regJob)) goto rollback2;
-#endif
 
 rollback2:;
   } while (edg_wll_TransNeedRetry(ctx));
index b02e79c..39bc568 100644 (file)
@@ -654,11 +654,6 @@ edg_wll_ErrorCode edg_wll_StoreIntStateEmbryonic(edg_wll_Context ctx,
                if (ctx->rgma_export) write2rgma_status(&jobstat.pub);
 */
 
-#ifdef LB_BUF
-       if (edg_wll_bufferedInsert(bi, values))
-               goto cleanup;
-#else
-
        trio_asprintf(&stmt,
                "insert into states"
                "(jobid,status,seq,int_status,version"
@@ -667,7 +662,6 @@ edg_wll_ErrorCode edg_wll_StoreIntStateEmbryonic(edg_wll_Context ctx,
                icnames, values);
 
        if (edg_wll_ExecSQL(ctx,stmt,NULL) < 0) goto cleanup;
-#endif
 
 cleanup:
        free(stmt); 
index 5610b8e..2aadb2a 100644 (file)
@@ -36,9 +36,6 @@
 
 static int store_user(edg_wll_Context,const char *,const char *); 
 static int store_job(edg_wll_Context,glite_jobid_const_t,const char *, int, int, int, int);
-#ifdef LB_BUF
-static int store_job_block(edg_wll_Context, glite_jobid_const_t, const char *, glite_lbu_bufInsert *, int, int);
-#endif
 static int set_job_grey(edg_wll_Context ctx, char *jobid);
 static int store_flesh(edg_wll_Context,edg_wll_Event *,const char *ulm, char *,int);
 static int check_dup(edg_wll_Context,edg_wll_Event *);
@@ -240,31 +237,6 @@ err:
        return edg_wll_Error(ctx,NULL,NULL);
 }
 
-#ifdef LB_BUF
-static int store_job_block(edg_wll_Context ctx,glite_jobid_const_t job,const char *userid, glite_lbu_bufInsert *bi, int proxy, int server)
-{
-       char *jobstr = edg_wlc_JobIdUnparse(job);
-       char *jobid = edg_wlc_JobIdGetUnique(job);
-       char *row;
-
-/* debug Duplicate key on index: Duplicate entry '(nil)' for key 1
- */
-
-       assert(!ctx->greyjobs); /* XXX: should not happen */
-
-       if (jobid == NULL || jobstr == NULL) 
-               return edg_wll_SetError(ctx,EINVAL,"store_jobi_block()");
-
-       edg_wll_ResetError(ctx);
-
-       trio_asprintf(&row, "'%|Ss','%|Ss','%|Ss','%|Ss','%|Ss'", jobid,jobstr,userid,proxy,server);
-       edg_wll_bufferedInsert(bi, row); // no need to free row
-
-       free(jobstr);
-       free(jobid);
-       return edg_wll_Error(ctx,NULL,NULL);
-}
-#endif
 
 static int set_job_grey(edg_wll_Context ctx, char *jobid)
 {
@@ -579,95 +551,6 @@ clean:
        return edg_wll_Error(ctx,NULL,NULL);
 }
 
-#ifndef LB_DAG_EMBRIONIC
-int register_subjobs(edg_wll_Context ctx,const edg_wll_RegJobEvent *e)
-{
-       int     i,err;
-       edg_wlc_JobId   *subjobs;
-       struct timeval  now;
-
-       edg_wll_ResetError(ctx);
-       if (e->nsubjobs == 0) return 0;
-       if (e->nsubjobs < 0) return edg_wll_SetError(ctx,EINVAL,"negative number of subjobs");
-
-       if ((err = edg_wll_GenerateSubjobIds(ctx,e->jobId,e->nsubjobs,e->seed,&subjobs)))
-               return err;
-
-       gettimeofday(&now,NULL);
-
-/* XXX: increase the overall request timeout. */
-       ctx->p_tmp_timeout.tv_sec += e->nsubjobs;
-       if (ctx->p_tmp_timeout.tv_sec > 86400) ctx->p_tmp_timeout.tv_sec = 86400;
-
-       for (i=0; i<e->nsubjobs; i++) {
-               edg_wll_Event   e2;
-               int             seq;
-               char            *et,*ed,*job_s;
-
-               memset(&e2,0,sizeof e2);
-               e2.type = EDG_WLL_EVENT_REGJOB;
-               e2.any.jobId = subjobs[i]; subjobs[i] = NULL;
-               memcpy(&e2.regJob.timestamp,&now,sizeof now);
-               e2.any.host = strdup(ctx->srvName);
-               e2.any.level = e->level;
-               e2.any.priority = e->priority;
-               e2.any.seqcode = strdup(EDG_WLL_SEQ_NULL);
-               e2.any.user = strdup(e->user);
-               e2.any.source = e->source;
-               e2.any.src_instance = strdup(ctx->isProxy ? 
-                       "L&B proxy" : "L&B server");
-               e2.regJob.ns = strdup(e->ns);
-               edg_wlc_JobIdDup(e->jobId,&e2.regJob.parent);
-               e2.regJob.jobtype = EDG_WLL_REGJOB_SIMPLE;
-               e2.regJob.jdl = strdup("");
-
-               switch (edg_wll_StoreEvent(ctx,&e2,NULL,&seq)) {
-
-                       case 0: break;
-                       /* maybe some non-ignorable errors should be handled here */
-
-                       default: 
-                               edg_wll_Error(ctx,&et,&ed);
-                               job_s = edg_wlc_JobIdUnparse(e2.any.jobId);
-                               fprintf(stderr,"register subjob %s: %s (%s)\n",job_s,et,ed);
-                               syslog(LOG_ERR,"register subjob %s: %s (%s)",job_s,et,ed);
-                               free(job_s); free(et); free(ed);
-                               edg_wll_FreeEvent(&e2);
-                               edg_wll_ResetError(ctx);
-                               continue;
-               }
-
-               if (edg_wll_LockJob(ctx,e2.any.jobId)) {
-                       job_s = edg_wlc_JobIdUnparse(e2.any.jobId);
-                       fprintf(stderr,"lock job %s: %s (%s)\n",job_s,et,ed);
-                       syslog(LOG_ERR,"lock job %s: %s (%s)",job_s,et,ed);
-                       free(job_s); free(et); free(ed);
-                       edg_wll_FreeEvent(&e2);
-                       edg_wll_ResetError(ctx);
-                       continue;
-               }
-
-               if ((err = edg_wll_StepIntState(ctx,e2.any.jobId,&e2,seq,NULL)))
-                       edg_wll_Error(ctx,&et,&ed);
-
-               edg_wll_UnlockJob(ctx,e2.any.jobId);
-               edg_wll_ResetError(ctx);
-
-               if (err) {
-                       job_s = edg_wlc_JobIdUnparse(e2.any.jobId);
-                       fprintf(stderr,"%s: %s (%s)\n",job_s,et,ed);
-                       syslog(LOG_ERR,"%s: %s (%s)",job_s,et,ed);
-                       free(job_s); free(et); free(ed);
-                       edg_wll_ResetError(ctx);
-               }
-
-               edg_wll_FreeEvent(&e2);
-       }
-
-       free(subjobs);
-       return edg_wll_Error(ctx,NULL,NULL);
-}
-#endif
 
 
 /*
@@ -725,11 +608,6 @@ int register_subjobs_embryonic(edg_wll_Context ctx,const edg_wll_RegJobEvent *e)
        struct timeval          now;
        char                    *jobid = NULL, *jobid_md5 = NULL, *jobid_md5_old = NULL;
        size_t                  jobid_len;
-#ifdef LB_BUF
-       glite_lbu_bufInsert     bi_j;
-       glite_lbu_bufInsert     *bi_jobs = &bi_j;
-               char                    *states_cols = NULL;
-#endif
        glite_lbu_bufInsert     bi_s, *bi_states = &bi_s;
        char                    *icnames = NULL, *values = NULL, *userid = NULL, *stmt = NULL;
        int                     server, proxy, membership = 0;
@@ -750,23 +628,6 @@ int register_subjobs_embryonic(edg_wll_Context ctx,const edg_wll_RegJobEvent *e)
        jobid_len = strlen(jobid_md5_old);
                
 
-#ifdef LB_BUF
-       /* init multirows insert mechanism for tables used here */
-       if (edg_wll_bufferedInsertInit(ctx, bi_jobs, NULL, "jobs", 4000, 1000,
-               "jobid, dg_jobid, userid, proxy, server"))
-       {
-               return edg_wll_SetError(ctx, EINVAL, "edg_wll_bufferedInsertInit()");
-       }
-
-       asprintf(&states_cols,"jobid, status, seq,int_status, version, parent_job%s", icnames);
-       if (edg_wll_bufferedInsertInit(ctx, bi_states, NULL, "states", 4000, 1000, states_cols))
-       {
-                return edg_wll_SetError(ctx, EINVAL, "edg_wll_bufferedInsertInit()");
-       }
-       free(states_cols);
-#endif         
-
-
        gettimeofday(&now,NULL);
 
        /* increase the overall request timeout. */
@@ -787,11 +648,7 @@ int register_subjobs_embryonic(edg_wll_Context ctx,const edg_wll_RegJobEvent *e)
                char            *et,*ed,*job_s,*p,*p1;
 
                /* save jobid-userid relation into jobs table */
-#ifdef LB_BUF
-               if ((err = store_job_block(ctx, subjobs[i], userid, bi_jobs, proxy, server)))
-#else
                if ((err = store_job(ctx, subjobs[i], userid, proxy, server, 0, 0)))
-#endif
                        if (edg_wll_Error(ctx,&et,&ed) == EDEADLOCK) goto err;
 
                /* interchange variable parts (jobids) in values */
@@ -832,12 +689,6 @@ err:
        if (sh) glite_lbu_FreeStmt(&sh);
        free(stmt);
 
-#ifdef LB_BUF
-       /* commit the rest of multirows insert and clean structures */
-       edg_wll_bufferedInsertClose(bi_jobs);
-       edg_wll_bufferedInsertClose(bi_states);
-#endif
-
        return edg_wll_Error(ctx,NULL,NULL);
 }