Changeset: 7fd2f829a1db for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7fd2f829a1db
Modified Files:
clients/mapilib/mapi.c
monetdb5/modules/mal/remote.mx
Branch: default
Log Message:
RMTresolve: locate upstream merovingian via merovingian_uri
This is a fix for bug #2777.
The old approach of looking for mapi_socket in the dbfarm no longer
works, since sockets are stored in /tmp (by default) nowadays to make it
easier for clients to find them. Extract the port from merovingian_uri
and pass that onto mapi_mapi (via mapi_resolve), which will connect to
merovingian using that port either through a UNIX or TCP socket.
diffs (68 lines):
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -2903,7 +2903,7 @@
Mapi mid;
/* if it doesn't make sense, don't try to crash */
- if (host == NULL || (host[0] != '/' && port <= 0) || pattern == NULL)
+ if (pattern == NULL)
return NULL;
mid = mapi_mapi(host, port, "mero", "mero", "resolve", pattern);
diff --git a/monetdb5/modules/mal/remote.mx b/monetdb5/modules/mal/remote.mx
--- a/monetdb5/modules/mal/remote.mx
+++ b/monetdb5/modules/mal/remote.mx
@@ -212,9 +212,9 @@
"your platform, sorry"); /* please upgrade to Linux,
etc. */
#else
BAT *list;
- char mero_running;
- char path[8096];
- int fd;
+ char *mero_uri;
+ char *p;
+ unsigned int port;
char **redirs;
char **or;
@@ -222,27 +222,23 @@
throw(ILLARG, "remote.resolve",
ILLEGAL_ARGUMENT ": pattern is NULL or nil");
- mero_running = 1;
- snprintf(path, 8096, "%s/.merovingian_lock", GDKgetenv("gdk_dbfarm"));
- fd = MT_lockf(path, F_TLOCK, 4, 1);
- if (fd >= 0 || fd <= -2) {
- if (fd >= 0) {
- /* oops, not running */
- close(fd);
- }
- mero_running = 0;
- }
-
- if (mero_running == 0)
- throw(MAL, "remote.resolve", "this function needs merovingian "
- "to be running, please start it first");
+ mero_uri = GDKgetenv("merovingian_uri");
+ if (mero_uri == NULL)
+ throw(MAL, "remote.resolve", "this function needs the mserver "
+ "have been started by merovingian");
list = BATnew(TYPE_oid, TYPE_str, 20);
if (list == NULL)
throw(MAL, "remote.resolve", MAL_MALLOC_FAIL);
- snprintf(path, 8096, "%s/mapi_socket", GDKgetenv("gdk_dbfarm"));
- or = redirs = mapi_resolve(path, 0, *pat);
+ /* extract port from mero_uri, let mapi figure out the rest */
+ mero_uri+=strlen("mapi:monetdb://");
+ if ((p = strchr(mero_uri, ':')) == NULL)
+ throw(MAL, "remote.resolve", "illegal merovingian_uri setting:
%s",
+ GDKgetenv("merovingian_uri"));
+ port = (unsigned int)atoi(p + 1);
+
+ or = redirs = mapi_resolve(NULL, port, *pat);
if (redirs == NULL)
throw(MAL, "remote.resolve", "unknown failure when resolving
pattern");
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list