Changeset: f7c8721adace for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f7c8721adace Modified Files: sql/backends/monet5/wlr.c Branch: Nov2019 Log Message:
sent error output to merovingian diffs (198 lines): diff --git a/sql/backends/monet5/wlr.c b/sql/backends/monet5/wlr.c --- a/sql/backends/monet5/wlr.c +++ b/sql/backends/monet5/wlr.c @@ -27,6 +27,7 @@ #include "opt_prelude.h" #include "mal_parser.h" #include "mal_client.h" +#include "mal_authorize.h" #include "querylog.h" #define WLR_START 0 @@ -37,6 +38,8 @@ #define WLC_ROLLBACK 50 #define WLC_ERROR 60 +#define _WLR_DEBUG_ + /* The current status of the replica processing */ static char wlr_master[IDLENGTH]; static char wlr_error[FILENAME_MAX]; // errors should stop the process @@ -131,6 +134,9 @@ WLRsetConfig(void){ * At any time we should be able to restart the synchronization * process by grabbing a new set of log files. * This calls for keeping track in the replica what log files have been applied. + * + * Given that the replication thread runs independently, all errors encountered + * should be sent to the system log. */ static str WLRgetMaster(void) @@ -217,27 +223,26 @@ WLRprocess(void *arg) msg = SQLinitClient(c); if( msg != MAL_SUCCEED) - mnstr_printf(GDKerr,"#Failed to initialize the client\n"); + fprintf(stderr,"#Failed to initialize the client\n"); msg = getSQLContext(c, mb, &sql, NULL); if( msg) - mnstr_printf(GDKerr,"#Failed to access the transaction context: %s\n",msg); + fprintf(stderr,"#Failed to access the transaction context: %s\n",msg); if ((msg = checkSQLContext(c)) != NULL) - mnstr_printf(GDKerr,"#Inconsitent SQL context: %s\n",msg); + fprintf(stderr,"#Inconsistent SQL context: %s\n",msg); #ifdef _WLR_DEBUG_ - mnstr_printf(c->fdout,"#Ready to start the replay against '%s' batches %d:%d\n", - wlr_archive, wlr_firstbatch, wlr_batches ); + mnstr_printf(c->fdout,"#Ready to start the replay against batches %d:%d\n", wlr_batches, wlc_batches ); #endif path[0]=0; for( i= wlr_batches; wlr_state == WLR_RUN && i < wlc_batches && ! GDKexiting(); i++){ len = snprintf(path,FILENAME_MAX,"%s%c%s_%012d", wlc_dir, DIR_SEP, wlr_master, i); if (len == -1 || len >= FILENAME_MAX) { - mnstr_printf(GDKerr,"#wlr.process: filename path is too large\n"); + fprintf(stderr,"#wlr.process: filename path is too large\n"); continue; } fd= open_rastream(path); if( fd == NULL){ - mnstr_printf(GDKerr,"#wlr.process:'%s' can not be accessed \n",path); + fprintf(stderr,"#wlr.process:'%s' can not be accessed \n",path); // Be careful not to miss log files. // In the future wait for more files becoming available. continue; @@ -245,16 +250,16 @@ WLRprocess(void *arg) sz = getFileSize(fd); if (sz > (size_t) 1 << 29) { close_stream(fd); - mnstr_printf(GDKerr, "wlr.process File %s too large to process", path); + fprintf(stderr, "#wlr.process File %s too large to process", path); continue; } if((c->fdin = bstream_create(fd, sz == 0 ? (size_t) (2 * 128 * BLOCK) : sz)) == NULL) { close_stream(fd); - mnstr_printf(GDKerr, "wlr.process Failed to open stream for file %s", path); + fprintf(stderr, "#wlr.process Failed to open stream for file %s", path); continue; } if (bstream_next(c->fdin) < 0) - mnstr_printf(GDKerr, "!WARNING: could not read %s\n", path); + fprintf(stderr, "!WARNING: could not read %s\n", path); c->yycur = 0; #ifdef _WLR_DEBUG_ @@ -270,7 +275,7 @@ WLRprocess(void *arg) char line[FILENAME_MAX]; snprintf(line, FILENAME_MAX,"#wlr.process:failed further parsing '%s':\n",path); snprintf(wlr_error, FILENAME_MAX, "%.*s", FILENAME_MAX, line); - mnstr_printf(GDKerr,"%s",line); + fprintf(stderr,"%s",line); printFunction(GDKerr, mb, 0, LIST_MAL_DEBUG ); } q= getInstrPtr(mb, mb->stop-1); @@ -283,7 +288,7 @@ WLRprocess(void *arg) ){ /* stop execution of the transactions if your reached the limit */ #ifdef _WLR_DEBUG_ - mnstr_printf(GDKerr,"#skip tlimit %s tag %s\n", wlr_timelimit,getVarConstant(mb, getArg(q,2)).val.sval); + mnstr_printf(cntxt->fdout,"#skip tlimit %s tag %s\n", wlr_timelimit,getVarConstant(mb, getArg(q,2)).val.sval); #endif resetMalBlkAndFreeInstructions(mb, 1); trimMalVariables(mb, NULL); @@ -294,7 +299,7 @@ WLRprocess(void *arg) snprintf(wlr_read, sizeof(wlr_read), "%s", getVarConstant(mb, getArg(q,2)).val.sval); wlr_tag = getVarConstant(mb, getArg(q,1)).val.lval; #ifdef _WLR_DEBUG_ - mnstr_printf(GDKerr,"#run tlimit %s tag %s\n", wlr_timelimit, wlr_read); + mnstr_printf(cntxt->fdout,"#run tlimit %s tag %s\n", wlr_timelimit, wlr_read); #endif } // only re-execute successful transactions. @@ -310,9 +315,8 @@ WLRprocess(void *arg) sql->session->ac_on_commit = 1; sql->session->level = 0; if(mvc_trans(sql) < 0) { - mnstr_printf(GDKerr,"Allocation failure while starting the transaction \n"); + fprintf(stderr,"#Allocation failure while starting the transaction \n"); } else { - //printFunction(GDKerr, mb, 0, LIST_MAL_DEBUG ); msg= runMAL(c,mb,0,0); wlr_tag++; if( msg == MAL_SUCCEED) @@ -322,18 +326,18 @@ WLRprocess(void *arg) msg = MAL_SUCCEED; if( msg != MAL_SUCCEED){ // they should always succeed - mnstr_printf(GDKerr,"ERROR in processing batch %d :%s\n", i, msg); + fprintf(stderr,"ERROR in processing batch %d :%s\n", i, msg); printFunction(GDKerr, mb, 0, LIST_MAL_DEBUG ); if((other = mvc_rollback(sql,0,NULL, false)) != MAL_SUCCEED) //an error was already established GDKfree(other); // cleanup - fprintFunction(stderr,mb,0,63); + printFunction(GDKerr,mb,0,63); resetMalBlkAndFreeInstructions(mb, 1); trimMalVariables(mb, NULL); pc = 0; } else if((msg = mvc_commit(sql, 0, 0, false)) != MAL_SUCCEED) { - mnstr_printf(GDKerr,"#wlr.process transaction commit failed: %s\n", msg); + fprintf(stderr,"#wlr.process transaction commit failed: %s\n", msg); freeException(msg); } } @@ -341,7 +345,7 @@ WLRprocess(void *arg) char line[FILENAME_MAX]; snprintf(line, FILENAME_MAX,"#wlr.process:typechecking failed '%s':\n",path); snprintf(wlr_error, FILENAME_MAX, "%s", line); - mnstr_printf(GDKerr,"%s",line); + fprintf(stderr,"%s",line); printFunction(GDKerr, mb, 0, LIST_MAL_DEBUG ); } // cleanup @@ -362,7 +366,7 @@ WLRprocess(void *arg) // skip to next file when all is read wlr_batches++; if((msg = WLRsetConfig()) != MAL_SUCCEED) { - mnstr_printf(GDKerr,"%s\n",msg); + fprintf(stderr,"%s\n",msg); freeException(msg); } // stop when we are about to read beyond the limited transaction (timestamp) @@ -399,7 +403,7 @@ WLRprocessScheduler(void *arg) str msg; if((msg = WLRgetConfig()) != MAL_SUCCEED) { - mnstr_printf(GDKerr,"%s\n",msg); + fprintf(stderr,"%s\n",msg); freeException(msg); } wlr_state = WLR_RUN; @@ -428,7 +432,7 @@ WLRprocessScheduler(void *arg) } if( wlr_master[0] && wlr_state != WLR_PAUSE){ if((msg = WLRgetMaster()) != MAL_SUCCEED) { - mnstr_printf(GDKerr,"%s\n",msg); + fprintf(stderr,"%s\n",msg); freeException(msg); } if( wlrprocessrunning == 0 && @@ -447,7 +451,7 @@ str WLRinit(void) { str msg; - Client cntxt = &mal_clients[0]; + Client cntxt = MCinitClient(MAL_ADMIN, NULL,NULL); if((msg = WLRgetConfig()) != MAL_SUCCEED) return msg; if( wlr_master[0] == 0) @@ -475,7 +479,7 @@ WLRreplicate(Client cntxt, MalBlkPtr mb, if( wlr_state != WLR_START){ wlr_state = WLR_PAUSE; while(wlr_state != WLR_START){ - mnstr_printf(cntxt->fdout,"#Waiting for replay scheduler to stop\n"); + mnstr_printf(cntxt->fdout,"#Waiting for replay scheduler to stop at %s\n", wlr_timelimit); MT_sleep_ms( 200); } } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list