Changeset: 8108c113fb83 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8108c113fb83
Modified Files:
clients/Tests/exports.stable.out
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
monetdb5/mal/mal_profiler.c
monetdb5/mal/mal_session.c
monetdb5/modules/mal/tablet.c
monetdb5/modules/mal/wlc.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_gencode.h
sql/backends/monet5/wlr.c
sql/server/sql_scan.c
Branch: default
Log Message:
Merge with Apr2019 branch.
diffs (158 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1425,7 +1425,6 @@ Client MCforkClient(Client father);
Client MCgetClient(int id);
void MCinit(void);
Client MCinitClient(oid user, bstream *fin, stream *fout);
-Client MCinitClientRecord(Client c, oid user, bstream *fin, stream *fout);
int MCinitClientThread(Client c);
int MCpushClientInput(Client c, bstream *new_input, int listing, char *prompt);
int MCshutdowninprogress(void);
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -198,7 +198,7 @@ MCexitClient(Client c)
}
}
-Client
+static Client
MCinitClientRecord(Client c, oid user, bstream *fin, stream *fout)
{
const char *prompt;
@@ -212,6 +212,9 @@ MCinitClientRecord(Client c, oid user, b
c->fdin = fin ? fin : bstream_create(GDKin, 0);
if ( c->fdin == NULL){
+ MT_lock_set(&mal_contextLock);
+ c->mode = FREECLIENT;
+ MT_lock_unset(&mal_contextLock);
showException(GDKout, MAL, "initClientRecord", MAL_MALLOC_FAIL);
return NULL;
}
@@ -243,6 +246,13 @@ MCinitClientRecord(Client c, oid user, b
prompt = !fin ? GDKgetenv("monet_prompt") : PROMPT1;
c->prompt = GDKstrdup(prompt);
if ( c->prompt == NULL){
+ if (fin == NULL) {
+ c->fdin->s = NULL;
+ bstream_destroy(c->fdin);
+ MT_lock_set(&mal_contextLock);
+ c->mode = FREECLIENT;
+ MT_lock_unset(&mal_contextLock);
+ }
showException(GDKout, MAL, "initClientRecord", MAL_MALLOC_FAIL);
return NULL;
}
@@ -447,7 +457,7 @@ freeClient(Client c)
* When the server is about to shutdown, we should softly terminate
* all outstanding session.
*/
-static int shutdowninprogress = 0;
+static volatile int shutdowninprogress = 0;
int
MCshutdowninprogress(void){
diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -201,7 +201,6 @@ mal_export int MCdefault;
mal_export Client MCgetClient(int id);
mal_export Client MCinitClient(oid user, bstream *fin, stream *fout);
-mal_export Client MCinitClientRecord(Client c, oid user, bstream *fin, stream
*fout);
mal_export int MCinitClientThread(Client c);
mal_export Client MCforkClient(Client father);
mal_export void MCstopClients(Client c);
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -1059,7 +1059,6 @@ static void profilerHeartbeat(void *dumm
}
profilerHeartbeatEvent("ping");
}
- ATOMIC_SET(&hbdelay, 0);
}
void setHeartbeat(int delay)
diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c
--- a/monetdb5/modules/mal/tablet.c
+++ b/monetdb5/modules/mal/tablet.c
@@ -402,16 +402,14 @@ tablet_read_more(bstream *in, stream *ou
do {
/* query is not finished ask for more */
/* we need more query text */
+ if (in->eof) {
+ if (mnstr_write(out, PROMPT2, sizeof(PROMPT2) -
1, 1) < 0 ||
+ mnstr_flush(out) < 0)
+ return false;
+ in->eof = false;
+ }
if (bstream_next(in) < 0)
return false;
- if (in->eof) {
- if (mnstr_write(out, PROMPT2, sizeof(PROMPT2) -
1, 1) == 1)
- mnstr_flush(out);
- in->eof = false;
- /* we need more query text */
- if (bstream_next(in) <= 0)
- return false;
- }
} while (in->len <= in->pos);
} else if (bstream_read(in, n) <= 0) {
return false;
diff --git a/monetdb5/modules/mal/wlc.c b/monetdb5/modules/mal/wlc.c
--- a/monetdb5/modules/mal/wlc.c
+++ b/monetdb5/modules/mal/wlc.c
@@ -313,12 +313,13 @@ WLClogger(void *arg)
(void) arg;
while(!GDKexiting()){
if( wlc_dir[0] && wlc_fd ){
- MT_lock_set(&wlc_lock);
- if((msg = WLCcloselogger()) != MAL_SUCCEED) {
- GDKerror("%s",msg);
- }
- MT_lock_unset(&wlc_lock);
+ MT_lock_set(&wlc_lock);
+ if((msg = WLCcloselogger()) != MAL_SUCCEED) {
+ GDKerror("%s",msg);
+ freeException(msg);
}
+ MT_lock_unset(&wlc_lock);
+ }
for( seconds = 0; (wlc_beat == 0 || seconds < wlc_beat) && !
GDKexiting(); seconds++)
MT_sleep_ms( 1000);
}
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
@@ -405,19 +405,21 @@ WLRprocessScheduler(void *arg)
if(strncmp(clktxt, wlr_timelimit,26) >= 0)
MT_sleep_ms(duration);
} else
- for( ; duration > 0 && wlr_state == WLR_PAUSE; duration -=
100){
- MT_sleep_ms( 100);
- }
+ for( ; duration > 0 && wlr_state == WLR_PAUSE;
duration -= 100){
+ MT_sleep_ms( 100);
+ }
if( wlr_master[0] && wlr_state != WLR_PAUSE){
if((msg = WLRgetMaster()) != MAL_SUCCEED) {
mnstr_printf(GDKerr,"%s\n",msg);
freeException(msg);
}
if( wlrprocessrunning == 0 &&
- ( (wlr_batches == wlc_batches && wlr_tag <
wlr_limit) || wlr_limit > wlr_tag ||
- (wlr_limit == -1 && wlr_timelimit[0] == 0 &&
wlr_batches < wlc_batches) ||
- (wlr_timelimit[0] && strncmp(clktxt,
wlr_timelimit, 26)> 0) ) )
- WLRprocess(cntxt);
+ ( (wlr_batches == wlc_batches && wlr_tag <
wlr_limit) || wlr_limit > wlr_tag ||
+ (wlr_limit == -1 && wlr_timelimit[0] == 0 &&
wlr_batches < wlc_batches) ||
+ (wlr_timelimit[0] && strncmp(clktxt,
wlr_timelimit, 26)> 0) ) ) {
+ MT_thread_setworking("processing");
+ WLRprocess(cntxt);
+ }
}
}
wlr_state = WLR_START;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list