Changeset: a61352a73d3d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a61352a73d3d
Modified Files:
monetdb5/mal/mal_client.c
monetdb5/mal/mal_client.h
monetdb5/modules/mal/clients.c
sql/ChangeLog
Branch: default
Log Message:
Session timeout feature improve.
diffs (69 lines):
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
@@ -258,6 +258,7 @@ MCinitClientRecord(Client c, oid user, b
c->memorylimit = 0;
c->qryctx.querytimeout = 0;
c->sessiontimeout = 0;
+ c->logical_sessiontimeout = 0;
c->qryctx.starttime = 0;
ATOMIC_SET(&c->qryctx.datasize, 0);
c->qryctx.maxmem = 0;
@@ -399,6 +400,7 @@ MCcloseClient(Client c)
c->memorylimit = 0;
c->qryctx.querytimeout = 0;
c->sessiontimeout = 0;
+ c->logical_sessiontimeout = 0;
c->user = oid_nil;
if (c->username) {
GDKfree(c->username);
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
@@ -72,6 +72,7 @@ typedef struct CLIENT {
int memorylimit; /* maximum memory currently
allowed in MB */
lng maxmem; /* max_memory from
db_user_info table */
lng sessiontimeout; /* session abort after x usec,
0 = no limit */
+ lng logical_sessiontimeout; /* logical session timeout, client
defined */
QryCtx qryctx; /* per query limitations */
time_t login; /* Time when this session started */
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
@@ -595,8 +595,10 @@ CLTsessionTimeout(Client cntxt, MalBlkPt
MT_lock_set(&mal_contextLock);
if (mal_clients[idx].mode == FREECLIENT)
msg = createException(MAL,"clients.setsessiontimeout","Session
not active anymore");
- else
- mal_clients[idx].sessiontimeout = (lng) sto * 1000000;
+ else {
+ mal_clients[idx].sessiontimeout = (lng) (sto * 1000000) +
(GDKusec() - mal_clients[idx].session);
+ mal_clients[idx].logical_sessiontimeout = (lng) sto;
+ }
MT_lock_unset(&mal_contextLock);
return msg;
}
@@ -871,7 +873,7 @@ CLTsessions(Client cntxt, MalBlkPtr mb,
goto bailout;
if (BUNappend(login, &ret, false) != GDK_SUCCEED)
goto bailout;
- timeout = (int)(c->sessiontimeout / 1000000);
+ timeout = (int)(c->logical_sessiontimeout);
if (BUNappend(sessiontimeout, &timeout, false) !=
GDK_SUCCEED)
goto bailout;
timeout = (int)(c->qryctx.querytimeout / 1000000);
diff --git a/sql/ChangeLog b/sql/ChangeLog
--- a/sql/ChangeLog
+++ b/sql/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog file for sql
# This file is updated with Maddlog
+* Fri Apr 7 2023 Lucas Pereira <[email protected]>
+- Session timeout feature improve to start evaluating from the moment
+ the procedure is called, instead of beginning of the session.
+
* Fri Mar 3 2023 Lucas Pereira <[email protected]>
- Queries stopped with the stop procedure are now marked as 'aborted'
'finished'.
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]