[prev in list] [next in list] [prev in thread] [next in thread] 

List:       monetdb-checkins
Subject:    MonetDB: default - Add an extra parameter to the supervisor_regi...
From:       Panagiotis Koutsourakis <commits+kutsurak=monetdbsolutions.com () monetdb ! org>
Date:       2018-03-30 15:05:25
Message-ID: hg.9a583b9ebabd.1522422325.6315528441665844383 () monetdb-vm0 ! spin-off ! cwi ! nl
[Download RAW message or body]

Changeset: 9a583b9ebabd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9a583b9ebabd
Modified Files:
	monetdb5/modules/mal/remote.c
	monetdb5/modules/mal/remote.h
	monetdb5/modules/mal/remote.mal
	sql/backends/monet5/sql_gencode.c
Branch: default
Log Message:

Add an extra parameter to the supervisor_register

For each plan the supervisor generates a UUID and sends it to the
remote.


diffs (98 lines):

diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -1407,8 +1407,9 @@ RMTisalive(int *ret, str *conn)
 
 // This is basically a no op
 str
-RMTsupervisorRegister(int *ret, str *sup_uuid) {
+RMTsupervisorRegister(int *ret, str *sup_uuid, str *query_uuid) {
 	(void)sup_uuid;
+	(void)query_uuid;
 
 	*ret = 0;
 	return MAL_SUCCEED;
diff --git a/monetdb5/modules/mal/remote.h b/monetdb5/modules/mal/remote.h
--- a/monetdb5/modules/mal/remote.h
+++ b/monetdb5/modules/mal/remote.h
@@ -63,7 +63,7 @@ mal_export str RMTbincopyto(Client cntxt
 mal_export str RMTbincopyfrom(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 mal_export str RMTbintype(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 mal_export str RMTisalive(int *ret, str *conn);
-mal_export str RMTsupervisorRegister(int *ret, str *sup_uuid);
+mal_export str RMTsupervisorRegister(int *ret, str *sup_uuid, str *query_uuid);
 #endif /* HAVE_MAPI */
 #endif /* _REMOTE_DEF */
 
diff --git a/monetdb5/modules/mal/remote.mal b/monetdb5/modules/mal/remote.mal
--- a/monetdb5/modules/mal/remote.mal
+++ b/monetdb5/modules/mal/remote.mal
@@ -72,7 +72,7 @@ pattern bintype():void
 address RMTbintype
 comment "print the binary type of this mserver5";
 
-command supervisor_register(sup_uuid:str):int
+command supervisor_register(sup_uuid:str, query_uuid:str):int
 address RMTsupervisorRegister
 comment "Register the supervisor uuid at a remote site";
 
diff --git a/sql/backends/monet5/sql_gencode.c b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -52,6 +52,8 @@
 #include "rel_dump.h"
 #include "rel_remote.h"
 
+#include "muuid.h"
+
 int
 constantAtom(backend *sql, MalBlkPtr mb, atom *a)
 {
@@ -436,18 +438,19 @@ static int
 	pushInstruction(curBlk, p);
 
 	if (mal_session_uuid) {
-		str session_uuid = GDKstrdup(mal_session_uuid);
-		/*
-		p = newStmt(curBlk, remoteRef, execRef);
-		p = newStmt(curBlk, remoteRef, supervisor_registerRef);
-		p = pushStr(curBlk, p, mal_session_uuid);
-		*/
+		str remote_session_uuid = GDKstrdup(mal_session_uuid);
+		str query_uuid = generateUUID();
+		str local_query_uuid = GDKstrdup(query_uuid);
+		if (remote_session_uuid == NULL) {
+			return -1;
+		}
 
 		p = newInstruction(curBlk, remoteRef, execRef);
 		p = pushArgument(curBlk, p, q);
 		p = pushStr(curBlk, p, remoteRef);
 		p = pushStr(curBlk, p, supervisor_registerRef);
 		getArg(p, 0) = -1;
+
 		o = newFcnCall(curBlk, remoteRef, putRef);
 		o = pushArgument(curBlk, o, q);
 		o = pushInt(curBlk, o, TYPE_int);
@@ -455,11 +458,19 @@ static int
 
 		o = newFcnCall(curBlk, remoteRef, putRef);
 		o = pushArgument(curBlk, o, q);
-		o = pushStr(curBlk, o, session_uuid);
+		o = pushStr(curBlk, o, remote_session_uuid);
+		p = pushArgument(curBlk, p, getArg(o, 0));
+
+		o = newFcnCall(curBlk, remoteRef, putRef);
+		o = pushArgument(curBlk, o, q);
+		o = pushStr(curBlk, o, query_uuid);
 		p = pushArgument(curBlk, p, getArg(o, 0));
 
 		pushInstruction(curBlk, p);
-		GDKfree(session_uuid);
+
+		free(query_uuid);
+		GDKfree(local_query_uuid);
+		GDKfree(remote_session_uuid);
 	}
 
 	/* (x1, x2, ..., xn) := remote.exec(q, "mod", "fcn"); */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic