Changeset: 83dba6c65e41 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/83dba6c65e41
Modified Files:
        monetdb5/modules/mal/clients.c
        sql/backends/monet5/sql.c
        sql/scripts/22_clients.sql
Branch: clientinfo
Log Message:

Extend the sessions table with new columns

Seven new columns: language, peer, hostname, application, client, clientpid and 
remark


diffs (176 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
@@ -779,6 +779,7 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
        BAT *id = NULL, *user = NULL, *login = NULL, *sessiontimeout = NULL,
                *querytimeout = NULL, *idle = NULL;
        BAT *opt = NULL, *wlimit = NULL, *mlimit = NULL;
+       BAT *language = NULL, *peer = NULL, *hostname = NULL, *application = 
NULL, *client = NULL, *clientpid = NULL, *remark = NULL;
        bat *idId = getArgReference_bat(stk, pci, 0);
        bat *userId = getArgReference_bat(stk, pci, 1);
        bat *loginId = getArgReference_bat(stk, pci, 2);
@@ -788,6 +789,13 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
        bat *querytimeoutId = getArgReference_bat(stk, pci, 6);
        bat *wlimitId = getArgReference_bat(stk, pci, 7);
        bat *mlimitId = getArgReference_bat(stk, pci, 8);
+       bat *languageId = getArgReference_bat(stk, pci, 9);
+       bat *peerId = getArgReference_bat(stk, pci, 10);
+       bat *hostnameId = getArgReference_bat(stk, pci, 11);
+       bat *applicationId = getArgReference_bat(stk, pci, 12);
+       bat *clientId = getArgReference_bat(stk, pci, 13);
+       bat *clientpidId = getArgReference_bat(stk, pci, 14);
+       bat *remarkId = getArgReference_bat(stk, pci, 15);
        Client c;
        timestamp ret;
        int timeout;
@@ -805,20 +813,36 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
        wlimit = COLnew(0, TYPE_int, 0, TRANSIENT);
        mlimit = COLnew(0, TYPE_int, 0, TRANSIENT);
        idle = COLnew(0, TYPE_timestamp, 0, TRANSIENT);
+       language = COLnew(0, TYPE_str, 0, TRANSIENT);
+       peer = COLnew(0, TYPE_str, 0, TRANSIENT);
+       hostname = COLnew(0, TYPE_str, 0, TRANSIENT);
+       application = COLnew(0, TYPE_str, 0, TRANSIENT);
+       client = COLnew(0, TYPE_str, 0, TRANSIENT);
+       clientpid = COLnew(0, TYPE_lng, 0, TRANSIENT);
+       remark = COLnew(0, TYPE_str, 0, TRANSIENT);
 
        if (id == NULL || user == NULL || login == NULL || sessiontimeout == 
NULL
                || idle == NULL || querytimeout == NULL || opt == NULL || 
wlimit == NULL
-               || mlimit == NULL) {
+               || mlimit == NULL || language == NULL || peer == NULL || 
hostname == NULL
+               || application == NULL || client == NULL || clientpid == NULL
+               || remark == NULL) {
                BBPreclaim(id);
                BBPreclaim(user);
                BBPreclaim(login);
                BBPreclaim(sessiontimeout);
                BBPreclaim(querytimeout);
                BBPreclaim(idle);
-
                BBPreclaim(opt);
                BBPreclaim(wlimit);
                BBPreclaim(mlimit);
+               BBPreclaim(language);
+               BBPreclaim(peer);
+               BBPreclaim(hostname);
+               BBPreclaim(application);
+               BBPreclaim(client);
+               BBPreclaim(clientpid);
+               BBPreclaim(remark);
+
                throw(SQL, "sql.sessions", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        }
 
@@ -866,6 +890,20 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
                                goto bailout;
                        if (BUNappend(mlimit, &c->memorylimit, false) != 
GDK_SUCCEED)
                                goto bailout;
+                       if (BUNappend(language, &str_nil, false) != GDK_SUCCEED)
+                               goto bailout;
+                       if (BUNappend(peer, &str_nil, false) != GDK_SUCCEED)
+                               goto bailout;
+                       if (BUNappend(hostname, &str_nil, false) != GDK_SUCCEED)
+                               goto bailout;
+                       if (BUNappend(application, &str_nil, false) != 
GDK_SUCCEED)
+                               goto bailout;
+                       if (BUNappend(client, &str_nil, false) != GDK_SUCCEED)
+                               goto bailout;
+                       if (BUNappend(clientpid, &lng_nil, false) != 
GDK_SUCCEED)
+                               goto bailout;
+                       if (BUNappend(remark, &str_nil, false) != GDK_SUCCEED)
+                               goto bailout;
                }
        }
        MT_lock_unset(&mal_contextLock);
@@ -888,6 +926,21 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
        BBPkeepref(wlimit);
        *mlimitId = mlimit->batCacheid;
        BBPkeepref(mlimit);
+       *languageId = language->batCacheid;
+       BBPkeepref(language);
+       *peerId = peer->batCacheid;
+       BBPkeepref(peer);
+       *hostnameId = hostname->batCacheid;
+       BBPkeepref(hostname);
+       *applicationId = application->batCacheid;
+       BBPkeepref(application);
+       *clientId = client->batCacheid;
+       BBPkeepref(client);
+       *clientpidId = clientpid->batCacheid;
+       BBPkeepref(clientpid);
+       *remarkId = remark->batCacheid;
+       BBPkeepref(remark);
+
        return MAL_SUCCEED;
 
   bailout:
@@ -902,6 +955,13 @@ CLTsessions(Client cntxt, MalBlkPtr mb, 
        BBPunfix(opt->batCacheid);
        BBPunfix(wlimit->batCacheid);
        BBPunfix(mlimit->batCacheid);
+       BBPunfix(language->batCacheid);
+       BBPunfix(peer->batCacheid);
+       BBPunfix(hostname->batCacheid);
+       BBPunfix(application->batCacheid);
+       BBPunfix(client->batCacheid);
+       BBPunfix(clientpid->batCacheid);
+       BBPunfix(remark->batCacheid);
        return msg;
 }
 
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -5330,7 +5330,31 @@ static mel_func sql_init_funcs[] = {
  pattern("sql", "argRecord", SQLargRecord, false, "Glue together the calling 
sequence", args(1,1, arg("",str))),
  pattern("sql", "argRecord", SQLargRecord, false, "Glue together the calling 
sequence", args(1,2, arg("",str),varargany("a",0))),
  pattern("sql", "sql_variables", sql_variables, false, "return the table with 
session variables", args(4,4, 
batarg("sname",str),batarg("name",str),batarg("type",str),batarg("value",str))),
- pattern("sql", "sessions", sql_sessions_wrap, false, "SQL export table of 
active sessions, their timeouts and idle status", args(9,9, 
batarg("id",int),batarg("user",str),batarg("start",timestamp),batarg("idle",timestamp),batarg("optmizer",str),batarg("stimeout",int),batarg("qtimeout",int),batarg("wlimit",int),batarg("mlimit",int))),
+
+
+
+
+ pattern("sql", "sessions", sql_sessions_wrap, false, "SQL export table of 
active sessions, their timeouts and idle status",
+   args(16,16,
+     batarg("id",int),batarg("user",str),batarg("start",timestamp),
+        batarg("idle",timestamp),batarg("optmizer",str),batarg("stimeout",int),
+        batarg("qtimeout",int),batarg("wlimit",int),batarg("mlimit",int),
+               batarg("language", str),
+               batarg("peer", str),
+               batarg("hostname", str),
+               batarg("application", str),
+               batarg("client", str),
+               batarg("clientpid", lng),
+               batarg("remark", str),
+  )
+ ),
+
+
+
+
+
+
+
 pattern("sql", "password", SQLuser_password, false, "Return password hash of 
user", args(1,2, arg("",str),arg("user",str))),
 pattern("sql", "decypher", SQLdecypher, false, "Return decyphered password", 
args(1,2, arg("",str),arg("hash",str))),
  pattern("sql", "dump_cache", dump_cache, false, "dump the content of the 
query cache", args(2,2, batarg("query",str),batarg("count",int))),
diff --git a/sql/scripts/22_clients.sql b/sql/scripts/22_clients.sql
--- a/sql/scripts/22_clients.sql
+++ b/sql/scripts/22_clients.sql
@@ -28,7 +28,14 @@ returns table(
        "sessiontimeout" int,
        "querytimeout" int,
        "workerlimit" int,
-       "memorylimit" int
+       "memorylimit" int,
+       "language" string,
+       "peer" string,
+       "hostname" string,
+       "application" string,
+       "client" string,
+       "clientpid" bigint,
+       "remark" string
 )
 external name sql.sessions;
 create view sys.sessions as select * from sys.sessions();
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to