Changeset: 48452474f33f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=48452474f33f
Modified Files:
monetdb5/mal/mal_import.h
monetdb5/mal/mal_private.h
monetdb5/modules/mal/wlcr.c
sql/backends/monet5/sql_wlcr.c
Branch: wlcr
Log Message:
Minor issues
diffs (146 lines):
diff --git a/monetdb5/mal/mal_import.h b/monetdb5/mal/mal_import.h
--- a/monetdb5/mal/mal_import.h
+++ b/monetdb5/mal/mal_import.h
@@ -14,6 +14,7 @@
#include "mal_session.h"
#include "mal_utils.h"
+mal_export str malInclude(Client c, str name, int listing);
mal_export void slash_2_dir_sep(str fname);
mal_export str evalFile(Client c, str fname, int listing);
mal_export str compileString(Symbol *fcn, Client c, str s);
diff --git a/monetdb5/mal/mal_private.h b/monetdb5/mal/mal_private.h
--- a/monetdb5/mal/mal_private.h
+++ b/monetdb5/mal/mal_private.h
@@ -36,8 +36,6 @@
__hidden str callFactory(Client cntxt, MalBlkPtr mb, ValPtr argv[],char flag)
__attribute__((__visibility__("hidden")));
-__hidden str malInclude(Client c, str name, int listing)
- __attribute__((__visibility__("hidden")));
#endif
__hidden void initResource(void)
diff --git a/monetdb5/modules/mal/wlcr.c b/monetdb5/modules/mal/wlcr.c
--- a/monetdb5/modules/mal/wlcr.c
+++ b/monetdb5/modules/mal/wlcr.c
@@ -95,6 +95,14 @@ WLCRloggerfile(Client cntxt)
FILE *fd;
(void) cntxt;
+ wlcr_batch++;
+ wlcr_tid = 0;
+ snprintf(path,PATHLENGTH,"%s%cwlcr_%06d",wlcr_dir,DIR_SEP,wlcr_batch);
+ mnstr_printf(cntxt->fdout,"#WLCRloggerfile batch %s\n",path);
+ wlcr_fd = open_wastream(path);
+ if( wlcr_fd == 0)
+ throw(MAL,"wlcr.logger","Could not create %s\n",path);
+
snprintf(path,PATHLENGTH,"%s%cwlcr",wlcr_dir, DIR_SEP);
mnstr_printf(cntxt->fdout,"#WLCRloggerfile %s\n",wlcr_dir);
fd = fopen(path,"w");
@@ -102,13 +110,6 @@ WLCRloggerfile(Client cntxt)
throw(MAL,"wlcr.logger","Could not access %s\n",path);
fprintf(fd,"%d %d\n", wlcr_batch, wlcr_threshold);
fclose(fd);
- wlcr_batch++;
- wlcr_tid = 0;
- snprintf(path,PATHLENGTH,"%s%cwlcr_%06d",wlcr_dir,DIR_SEP,wlcr_batch);
- mnstr_printf(cntxt->fdout,"#WLCRloggerfile batch %s\n",path);
- wlcr_fd = open_wastream(path);
- if( wlcr_fd == 0)
- throw(MAL,"wlcr.logger","Could not create %s\n",path);
return MAL_SUCCEED;
}
@@ -139,7 +140,6 @@ WLCRinit(Client cntxt)
// database is in master tracking mode
if( fscanf(fd,"%d %d", &wlcr_batch, &wlcr_threshold) ==
2){
wlcr_dir = dir;
- wlcr_batch++;
mnstr_printf(cntxt->fdout,"#Master control
active:%d %d\n", wlcr_batch, wlcr_threshold);
(void) fclose(fd);
msg = WLCRloggerfile(cntxt);
diff --git a/sql/backends/monet5/sql_wlcr.c b/sql/backends/monet5/sql_wlcr.c
--- a/sql/backends/monet5/sql_wlcr.c
+++ b/sql/backends/monet5/sql_wlcr.c
@@ -23,6 +23,7 @@
#include "sql.h"
#include "wlcr.h"
#include "sql_wlcr.h"
+#include "mal_parser.h"
#include "mal_client.h"
#define WLCR_REPLAY 1
@@ -91,20 +92,30 @@ WLCRprocess(void *arg)
c->prompt = GDKstrdup(""); /* do not produce visible prompts */
c->promptlength = 0;
c->listing = 0;
+ c->curprg = newFunction(putName("user"), putName("wlcr"),
FUNCTIONsymbol);
+
mnstr_printf(cntxt->fdout,"#Ready to start the replayagainst '%s'
batches %d threshold %d", wlcr_master, wlcr_replaybatches,
wlcr_replaythreshold);
for( i= 0; i < wlcr_replaybatches; i++){
snprintf(path,PATHLENGTH,"%s%cwlcr_%06d", wlcr_master,
DIR_SEP,i);
- mnstr_printf(cntxt->fdout,"#WLCR processing %s\n",path);
fd= open_rstream(path);
- if( c->fdin == NULL || MCpushClientInput(c, bstream_create(fd,
128 * BLOCK), 0, "") < 0){
- mnstr_printf(cntxt->fdout,"#wlcr.replay:'%s' can not be
accessed \n",path);
+ if( fd == NULL){
+ mnstr_printf(cntxt->fdout,"#wlcr.process:'%s' can not
be accessed \n",path);
+ continue;
}
+ if( MCpushClientInput(c, bstream_create(fd, 128 * BLOCK), 0,
"") < 0){
+ mnstr_printf(cntxt->fdout,"#wlcr.process: client can
not be initialized \n");
+ }
+ mnstr_printf(cntxt->fdout,"#wlcr.process:start processing log
file '%s'\n",path);
c->yycur = 0;
+ if( parseMAL(c, c->curprg, 1, 1) || c->curprg->def->errors){
+ mnstr_printf(cntxt->fdout,"#wlcr.process:parsing failed
'%s'\n",path);
+ }
// preload the complete file
// now parse the file line by line
close_stream(fd);
}
+ (void) mnstr_flush(cntxt->fdout);
}
str
@@ -132,7 +143,7 @@ WLCRreplay(Client cntxt, MalBlkPtr mb, M
close_stream(fd);
if (MT_create_thread(&wlcr_thread, WLCRprocess, (void*) cntxt,
MT_THR_JOINABLE) < 0) {
- throw(SQL,"wlcr.replay","can not be accessed \n");
+ throw(SQL,"wlcr.replay","replay process can not be
started\n");
}
return MAL_SUCCEED;
}
@@ -143,16 +154,13 @@ WLCRsynchronize(Client cntxt, MalBlkPtr
char path[PATHLENGTH];
stream *fd;
- if( wlcr_mode == WLCR_SYNC){
- throw(SQL,"wlcr.replay","System already in synchronization
mode");
- }
- if( wlcr_mode == WLCR_REPLAY){
- throw(SQL,"wlcr.replay","System already in replay mode");
+ if( wlcr_mode == WLCR_SYNC || wlcr_mode == WLCR_REPLAY){
+ throw(SQL,"wlcr.synchronize","System already in synchronization
mode");
}
snprintf(path,PATHLENGTH,"%s%cwlcr", wlcr_master, DIR_SEP);
fd= open_rstream(path);
if( fd == NULL){
- throw(SQL,"wlcr.replay","'%s' can not be accessed \n",path);
+ throw(SQL,"wlcr.synchronize","'%s' can not be accessed
\n",path);
}
close_stream(fd);
@@ -161,7 +169,7 @@ WLCRsynchronize(Client cntxt, MalBlkPtr
if( msg)
return msg;
if (MT_create_thread(&wlcr_thread, WLCRprocess, (void*) cntxt,
MT_THR_JOINABLE) < 0) {
- throw(SQL,"wlcr.synchronize","can not be started \n");
+ throw(SQL,"wlcr.synchronize","replay process can not be
started\n");
}
return MAL_SUCCEED;
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list