Changeset: 089189da222b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=089189da222b
Modified Files:
monetdb5/mal/mal.c
monetdb5/mal/mal_client.mx
monetdb5/mal/mal_session.c
Branch: Aug2011
Log Message:
clients: remove code related to client reuse, bug #1939
The client reuse code has caused numerous bugs sofar, and as effect it
has been disabled since long, so to avoid confusing more people at times
bugs pop up, remove the code.
diffs (184 lines):
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -282,7 +282,6 @@ void mal_exit(void){
* Before continuing we should make sure that all clients
* (except the console) have left the scene.
*/
- MCexitPending();
RECYCLEshutdown(mal_clients); /* remove any left over intermediates */
stopProfiling();
#if 0
diff --git a/monetdb5/mal/mal_client.mx b/monetdb5/mal/mal_client.mx
--- a/monetdb5/mal/mal_client.mx
+++ b/monetdb5/mal/mal_client.mx
@@ -83,7 +83,7 @@ All Rights Reserved.
#define FREECLIENT 0
#define FINISHING 1
#define CLAIMED 2
-#define AWAITING 4
+#define AWAITING 4 /* not used, see bug #1939 */
#define TIMEOUT (5*60) /* seconds */
#define PROCESSTIMEOUT 2 /* seconds */
@@ -412,58 +412,12 @@ Client MCgetClient(int id)
Client
MCfindClient(oid user, str scen, bstream *fin, stream *fout)
{
- Client c = NULL;
- Scenario s = findScenario(scen);
-
- if (!s) {
- showException(MAL, "findClient",
- "findScenario returned NULL for '%s'", scen);
- mnstr_printf(fout, "!could not find scenario '%s'\n", scen);
- mnstr_flush(fout);
- return NULL;
- }
-
- mal_set_lock(mal_contextLock, "newClient");
- if (mal_clients[CONSOLE].user && mal_clients[CONSOLE].mode ==
FINISHING) {
- showException(MAL, "newClient", "system shutdown in progress");
- mal_unset_lock(mal_contextLock, "newClient");
- mnstr_printf(fout, "!system shutdown in progress, please try
again later\n");
- mnstr_flush(fout);
- return NULL;
- }
- for (c = mal_clients; c < mal_clients + MAL_MAXCLIENTS; c++) {
- if (c->mode == AWAITING && c->scenario == s->name) {
- /* remove garbage from previous session */
- if (c->nspace) {
- freeModule(c->nspace);
- c->nspace = 0;
- }
- c->mode = CLAIMED;
- break;
- }
- }
- mal_unset_lock(mal_contextLock, "newClient");
-
- if (c == mal_clients + MAL_MAXCLIENTS)
- return NULL;
-#ifdef MAL_CLIENT_DEBUG
- printf("Client found %d\n", c->idx);
-#endif
- c->user = user;
- c->fdin = fin ? fin : bstream_create(GDKin, 0);
- c->yycur = 0;
- c->bak = NULL;
-
- c->listing = 0;
- c->flags = MCdefault;
- c->fdout = fout ? fout : GDKstdout;
- c->mdb = 0;
- c->login = time(0);
- memset((char *) c->rcc, 0, sizeof(RecStat));
- c->rcc->curQ = -1;
- /* (re)activate thread */
- MT_sema_up(&c->s, "MCfindClient");
- return c;
+ /* can't break ABI in release branch */
+ (void) user;
+ (void) scen;
+ (void) fin;
+ (void) fout;
+ return NULL;
}
static void
@@ -491,24 +445,8 @@ MCexitClient(Client c)
int
MCwait(Client c)
{
- if (c != mal_clients && c->mode == FINISHING) {
- mal_set_lock(mal_contextLock, "wait");
- c->mode = AWAITING;
- /* close streams */
- mal_unset_lock(mal_contextLock, "wait");
- MCexitClient(c);
- /* wait for work */
-#ifdef MAL_DEBUG_CLIENT
- mnstr_printf(c->fdout,"Put client into pool %d\n",c->idx);
-#endif
- MT_sema_down(&c->s, "MSserveClient");
-#ifdef MAL_DEBUG_CLIENT
- mnstr_printf(c->fdout,"Awake client in pool %d\n",c->idx);
-#endif
- c->mythread->data[1] = c->fdin;
- c->mythread->data[0] = c->fdout;
- return (c->mode == CLAIMED);
- }
+ /* can't break ABI in release branch */
+ (void) c;
return 1;
}
@@ -751,17 +689,8 @@ void MCcleanupClients(void){
void
MCexitPending(void)
{
- Client c;
-
- mal_set_lock(mal_contextLock, "MCexitPending");
- for (c = mal_clients+1; c < mal_clients+MAL_MAXCLIENTS; c++) {
- if (c->mode == AWAITING) {
- c->mode = FINISHING;
- /* (re)activate thread */
- MT_sema_up(&c->s, "MCfindClient");
- }
- }
- mal_unset_lock(mal_contextLock, "MCexitPending");
+ /* can't break ABI in release branch */
+ return;
}
str
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -303,16 +303,6 @@ MSscheduleClient(str command, str challe
SABAOTHfreeStatus(&stats);
}
- /* find and reactivate client */
- c = MCfindClient(uid, lang, fin, fout);
- if (c != NULL) {
- mnstr_printf(fout, "!internal server error
(findClient), "
- "please try again later\n");
- mnstr_flush(fout);
- GDKfree(command);
- return;
- }
-
c = MCinitClient(uid, fin, fout);
if (c == NULL) {
mnstr_printf(fout, "!internal server error (out of
client slots), "
@@ -450,7 +440,7 @@ MSserveClient(void *dummy)
c->glb = newGlobalStack(MAXGLOBALS + mb->vsize);
if ( c->glb == NULL){
showException(MAL, "serveClient", MAL_MALLOC_FAIL);
- c->mode = FINISHING + 1;
+ c->mode = FINISHING + 1; /* == CLAIMED */
} else {
c->glb->stktop = mb->vtop;
c->glb->blk = mb;
@@ -460,7 +450,7 @@ MSserveClient(void *dummy)
msg = defaultScenario(c);
if (msg) {
showException(MAL, "serveClient", "could not initialize default
scenario");
- c->mode = FINISHING + 1;
+ c->mode = FINISHING + 1; /* == CLAIMED */
} else {
do {
do {
@@ -469,10 +459,6 @@ MSserveClient(void *dummy)
break;
resetScenario(c);
} while (c->scenario);
-#ifdef BUG_2581675_FIXED /* when client record reinitialized
properly, this code can be reinstated */
- if (!MCwait(c))
- break;
-#endif
} while(c->scenario && c->mode != FINISHING);
}
/*
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list