Changeset: daaa959d5a89 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=daaa959d5a89 Modified Files: tools/merovingian/daemon/Makefile.ag tools/merovingian/daemon/client.c tools/merovingian/daemon/discoveryrunner.c tools/merovingian/daemon/multiplex-funnel.c tools/merovingian/daemon/multiplex-funnel.h Branch: Mar2011 Log Message:
merovingian: remove multplex-funnel diffs (truncated from 814 to 300 lines): diff --git a/tools/merovingian/daemon/Makefile.ag b/tools/merovingian/daemon/Makefile.ag --- a/tools/merovingian/daemon/Makefile.ag +++ b/tools/merovingian/daemon/Makefile.ag @@ -32,7 +32,6 @@ discoveryrunner.h \ forkmserver.h \ handlers.h \ - multiplex-funnel.h \ peering.h \ proxy.h @@ -46,7 +45,6 @@ discoveryrunner.c \ forkmserver.c \ handlers.c \ - multiplex-funnel.c \ peering.c \ proxy.c LIBS = ../utils/libmeroutil \ diff --git a/tools/merovingian/daemon/client.c b/tools/merovingian/daemon/client.c --- a/tools/merovingian/daemon/client.c +++ b/tools/merovingian/daemon/client.c @@ -37,14 +37,6 @@ #include "merovingian.h" #include "forkmserver.h" #include "proxy.h" -#include "multiplex-funnel.h" - -typedef struct _mplist { - multiplex *mpf; - struct _mplist *next; -} mplist; - -static mplist *mero_multiplex_funnel = NULL; static err handleClient(int sock, char isusock) @@ -228,48 +220,6 @@ return(newErr("client %s specified no database", host)); } - if (strcmp(lang, "sql+mf") == 0) { - /* SQL multiplexer with funnelling capabilities */ - /* find/start/attach funnel */ - mplist *w; - for (w = mero_multiplex_funnel; w != NULL; w = w->next) { - if (strcmp(w->mpf->pool, database) == 0) - break; - } - if (w == NULL) { - char *merr; - int ret; - w = malloc(sizeof(mplist)); - w->next = mero_multiplex_funnel; - if ((merr = multiplexInit(&w->mpf, database)) != NO_ERR) { - free(w); - mnstr_printf(fout, "!merovingian: failed to create " - "multiplex-funnel: %s\n", merr); - mnstr_flush(fout); - close_stream(fout); - close_stream(fdin); - return(merr); - } - mero_multiplex_funnel = w; - if ((ret = pthread_create(&w->mpf->tid, - NULL, (void *(*)(void *))multiplexThread, - (void *)w->mpf)) != 0) - { - mnstr_printf(fout, "!merovingian: internal failure while " - "creating multiplex-funnel: unable to start thread: %s\n", - strerror(ret)); - mnstr_flush(fout); - close_stream(fout); - close_stream(fdin); - return(newErr("starting thread for multiplex-funnel %s failed: %s", - database, strerror(ret))); - } - } - multiplexAddClient(w->mpf, sock, fout, fdin, host); - - return(NO_ERR); - } - if (strcmp(lang, "resolve") == 0) { /* ensure the pattern ends with '/\*' such that we force a * remote entry, including those for local databases, this diff --git a/tools/merovingian/daemon/discoveryrunner.c b/tools/merovingian/daemon/discoveryrunner.c --- a/tools/merovingian/daemon/discoveryrunner.c +++ b/tools/merovingian/daemon/discoveryrunner.c @@ -20,6 +20,7 @@ #include "monetdb_config.h" #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include <string.h> /* str* */ #include <sys/types.h> #include <sys/socket.h> @@ -33,7 +34,6 @@ #include <utils/properties.h> #include "merovingian.h" -#include "multiplex-funnel.h" #include "discoveryrunner.h" @@ -77,9 +77,6 @@ prv->next = rdb->next; } - /* inform multiplex-funnels about this removal */ - multiplexNotifyRemovedDB(rdb->fullname); - Mfprintf(_mero_discout, "removed neighbour database %s%s\n", conn, rdb->fullname); @@ -141,9 +138,6 @@ pthread_mutex_unlock(&_mero_remotedb_lock); - /* inform multiplex-funnels about this addition */ - multiplexNotifyAddedDB(rdb->fullname); - return(1); } diff --git a/tools/merovingian/daemon/multiplex-funnel.c b/tools/merovingian/daemon/multiplex-funnel.c deleted file mode 100644 --- a/tools/merovingian/daemon/multiplex-funnel.c +++ /dev/null @@ -1,618 +0,0 @@ -/* - * The contents of this file are subject to the MonetDB Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. - * - * The Original Code is the MonetDB Database System. - * - * The Initial Developer of the Original Code is CWI. - * Portions created by CWI are Copyright (C) 1997-July 2008 CWI. - * Copyright August 2008-2011 MonetDB B.V. - * All Rights Reserved. - */ - -#include "monetdb_config.h" -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <pthread.h> -#include <sys/types.h> - -#include <mapi.h> - -#include "utils/glob.h" - -#include "merovingian.h" -#include "discoveryrunner.h" -#include "multiplex-funnel.h" - -typedef struct _multiplexlist { - multiplex *m; - struct _multiplexlist *next; -} multiplexlist; - -static multiplexlist *multiplexes = NULL; -static pthread_t mfmanager = 0; -static int mfpipe[2]; -/** - * Connections from all multiplex funnels are maintained by a single - * thread that resolves and creates connections upon updates on the - * discovery space. Connections aren't made/checked/updated upon their - * usage, because this introduces delays for the clients. This is in - * particular an issue when a target is updated to point to another - * database. To maintain a stable query performance, the connection - * creation must happen in the background and set life once established. - */ -void -MFconnectionManager(void *d) -{ - int i; - multiplex *m; - multiplexlist *w; - char buf[1024]; - size_t len; - void *p; - char *msg; - - (void)d; - - while (_mero_keep_listening) { - /* FIXME: use select for timeout */ - if (read(mfpipe[0], &p, sizeof(void *)) < 0) { - Mfprintf(stderr, "failed reading from notification pipe: %s\n", - strerror(errno)); - break; - } - msg = (char *)p; - - /* intended behaviour: - * - additions don't change any connection targets, they only - * fill in gaps (conn == NULL) - * - removals of targets in use, cause a re-lookup of the - * original pattern, on failure, conn is left NULL - */ - if (msg[0] == '+') { /* addition */ - for (w = multiplexes; w != NULL; w = w->next) { - m = w->m; - for (i = 0; i < m->dbcc; i++) { - if (m->dbcv[i]->conn == NULL) { - len = snprintf(buf, sizeof(buf), "%s/*", - m->dbcv[i]->database); - if (len >= sizeof(buf)) { - Mfprintf(stderr, "buffer buf too small, " - "increase size in %s:%d\n", - __FILE__, __LINE__); - continue; - } - /* avoid double /'*'/'* (no ') */ - if (len >= 4 && - buf[len - 3] == '*' && buf[len - 4] == '/') - buf[len - 2] = '\0'; - if (glob(buf, msg + 1) == 1) { - sabdb *stats; - Mapi tm = NULL; - /* match! eat away trailing / (for matching) */ - msg[strlen(msg) - 1] = '\0'; - stats = getRemoteDB(msg + 1); - if (stats == NULL) { - Mfprintf(stderr, "target %s cannot be resolved " - "despite being just discovered as %s\n", - m->dbcv[i]->database, msg + 1); - continue; - } - snprintf(buf, sizeof(buf), "%s%s", - stats->conns->val, stats->dbname); - msab_freeStatus(&stats); - Mfprintf(stdout, "setting up multiplexer " - "target %s->%s\n", - m->dbcv[i]->database, buf); - tm = mapi_mapiuri(buf, - m->dbcv[i]->user, m->dbcv[i]->pass, "sql"); - if (mapi_reconnect(tm) == MOK) { - m->dbcv[i]->conn = tm; - mapi_cache_limit(tm, -1); /* don't page */ - } else { - Mfprintf(stdout, "failed to connect to %s: %s\n", - buf, mapi_error_str(tm)); - mapi_destroy(tm); - } - } - } - } - } - } else { /* removal */ - for (w = multiplexes; w != NULL; w = w->next) { - m = w->m; - for (i = 0; i < m->dbcc; i++) { - if (m->dbcv[i]->conn != NULL) { - len = snprintf(buf, sizeof(buf), "%s/*", - m->dbcv[i]->database); - if (len >= sizeof(buf)) { - Mfprintf(stderr, "buffer buf too small, " - "increase size in %s:%d\n", - __FILE__, __LINE__); - continue; - } - /* avoid double /'*'/'* (no ') */ - if (len >= 4 && - buf[len - 3] == '*' && buf[len - 4] == '/') - buf[len - 2] = '\0'; - if (glob(buf, msg + 1) == 1) { - /* reevaluate, to see if connection is still - * available */ - sabdb *walk; - sabdb *stats = getRemoteDB(m->dbcv[i]->database); - Mapi tm = m->dbcv[i]->conn; - char *uri = mapi_get_uri(tm); - if (stats == NULL) { - Mfprintf(stderr, "target %s can no longer " - "be resolved\n", - m->dbcv[i]->database); - m->dbcv[i]->conn = NULL; - mapi_disconnect(tm); - mapi_destroy(tm); - continue; - } - /* walk all connections, in an attempt to - * see if the original connection is still - * available, despite the removal of the - * server we got a message for */ - for (walk = stats; walk != NULL; walk = walk->next) { - snprintf(buf, sizeof(buf), "%s%s", - walk->conns->val, walk->dbname); - if (strcmp(uri, buf) == 0) _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list