Changeset: e798e4947e83 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e798e4947e83 Modified Files: monetdb5/modules/mal/clients.c sql/backends/monet5/sql_scenario.c Branch: Jan2014 Log Message:
Terminate SQL session upon timeout Show the timeouts set in seconds (conform input) Effectuate SQL session termination upon timeout. diffs (126 lines): diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c --- a/monetdb5/modules/mal/clients.c +++ b/monetdb5/modules/mal/clients.c @@ -596,7 +596,7 @@ CLTsessions(Client cntxt, MalBlkPtr mb, Client c; char usrname[256]= {"monetdb"}; timestamp ts, ret; - lng clk; + lng clk,timeout; (void) cntxt; (void) mb; @@ -631,12 +631,14 @@ CLTsessions(Client cntxt, MalBlkPtr mb, clk = c->login * 1000; (void) MTIMEtimestamp_add(&ret,&ts, &clk); BUNappend(login, &ret, FALSE); - BUNappend(stimeout, &c->stimeout, FALSE); + timeout = c->stimeout / 1000000; + BUNappend(stimeout, &timeout, FALSE); (void) MTIMEunix_epoch(&ts); clk = c->lastcmd * 1000; (void) MTIMEtimestamp_add(&ret,&ts, &clk); BUNappend(last, &ret, FALSE); - BUNappend(qtimeout, &c->qtimeout, FALSE); + timeout = c->qtimeout / 1000000; + BUNappend(qtimeout, &timeout, FALSE); BUNappend(active, &c->active, FALSE); } MT_lock_unset(&mal_contextLock, "clients.sessions"); diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -1255,7 +1255,6 @@ SQLexitClient(Client c) } /* - * @- * A statement received internally is simply appended for * execution */ @@ -1274,7 +1273,6 @@ SQLtrans(mvc *m) } /* - * @- * The SQLcompile operation can be used by separate * front-ends to benefit from the SQL functionality. * It expects a string and returns the name of the @@ -1357,7 +1355,6 @@ SQLstatementIntern(Client c, str *expr, if (!m->sa) m->sa = sa_create(); /* - * @- * System has been prepared to parse it and generate code. * Scan the complete string for SQL statements, stop at the first error. */ @@ -1518,7 +1515,6 @@ SQLcompile(Client cntxt, MalBlkPtr mb, M } /* - * @- * Locate a file with SQL commands and execute it. For the time being a 1MB * file limit is implicitly imposed. If the file can not be located in the * script library, we assume it is sufficiently self descriptive. @@ -1558,7 +1554,6 @@ SQLinclude(Client cntxt, MalBlkPtr mb, M } /* - * @- * The SQL reader collects a (sequence) of statements from the input * stream, but only when no unresolved 'nxt' character is visible. * In combination with SQLparser this ensures that all statements @@ -1617,7 +1612,6 @@ SQLreader(Client c) m = be->mvc; m->errstr[0] = 0; /* - * @- * Continue processing any left-over input from the previous round. */ @@ -1625,7 +1619,6 @@ SQLreader(Client c) mnstr_printf(GDKout, "#pos %d len %d eof %d \n", in->pos, in->len, in->eof); #endif /* - * @- * Distinguish between console reading and mclient connections. * The former comes with readline functionality. */ @@ -1710,7 +1703,7 @@ SQLreader(Client c) #endif } } - if (!go || (strncmp(CURRENT(c), "\\q", 2) == 0)) { + if ( (c->stimeout && GDKusec()- c->session > c->stimeout) || !go || (strncmp(CURRENT(c), "\\q", 2) == 0)) { in->pos = in->len; /* skip rest of the input */ c->mode = FINISHCLIENT; return NULL; @@ -1719,12 +1712,10 @@ SQLreader(Client c) } /* - * @- * The SQL block is stored in the client input buffer, from which it * can be parsed by the SQL parser. The client structure contains * a small table of bounded tables. This should be reset before we * parse a new statement sequence. - * @- * Before we parse the sql statement, we look for any variable settings * for specific commands. * The most important one is to prepare code to be handled by the debugger. @@ -1749,7 +1740,6 @@ SQLsetDebugger(Client c, mvc *m, int ono } /* - * @- * The trace operation collects the events in the BATs * and creates a secondary result set upon termination * of the query. This feature is extended with @@ -2388,7 +2378,6 @@ SQLengine(Client c) } /* - * @- * Assertion errors detected during the execution of a code block * raises an exception. An debugger dump is generated upon request * to ease debugging. _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list