Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9894
Modified Files:
merovingian_discoveryrunner.c
Log Message:
Introduce new AVAI message that is used to find merovingians that do not have
any databases yet. Code not yet finished, but I need to have the primary base
distributed in order to test if it works as expected so far
U merovingian_discoveryrunner.c
Index: merovingian_discoveryrunner.c
===================================================================
RCS file:
/cvsroot/monetdb/sql/src/backends/monet5/merovingian/merovingian_discoveryrunner.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- merovingian_discoveryrunner.c 9 Sep 2009 11:55:13 -0000 1.2
+++ merovingian_discoveryrunner.c 24 Sep 2009 09:57:58 -0000 1.3
@@ -51,7 +51,7 @@
/* start shouting around that we're here ;) request others to tell
* what databases they have */
- snprintf(buf, 512, "HELO %s", _mero_hostname);
+ snprintf(buf, 512, "HELO %s:%hu", _mero_hostname, _mero_port);
broadcast(buf);
ckv = getDefaultProps();
@@ -64,7 +64,6 @@
if (forceannc == 1 || deadline <= now) {
/* set new deadline */
deadline = now + _mero_discoveryttl;
- forceannc = 0;
/* list all known databases */
if ((e = SABAOTHgetStatus(&stats, NULL)) !=
MAL_SUCCEED) {
@@ -92,8 +91,14 @@
freeConfFile(ckv);
}
- if (orig != NULL)
+ if (orig != NULL) {
SABAOTHfreeStatus(&orig);
+ } else if (forceannc == 1) {
+ /* no databases, yet still announce we're here
*/
+ snprintf(buf, 512, "AVAI %s:%hu",
_mero_hostname, _mero_port);
+ broadcast(buf);
+ }
+ forceannc = 0;
}
/* do a round to see if we have to cleanup anything (expired
@@ -159,7 +164,7 @@
if (strncmp(buf, "HELO ", 5) == 0) {
/* HELLO message, respond with current databases */
- Mfprintf(_mero_discout, "new neighbour %s\n", host);
+ Mfprintf(_mero_discout, "new neighbour %s (%s)\n", buf
+ 5, host);
/* sleep a random amount of time to avoid an avalanche
of
* ANNC messages flooding the network */
c = 1 + (int)(2500.0 * (rand() / (RAND_MAX + 1.0)));
@@ -167,6 +172,9 @@
/* force an announcement round by dropping the deadline
*/
forceannc = 1;
continue;
+ } else if (strncmp(buf, "AVAI ", 5) == 0) {
+ /* AVAILABLE message, register merovingian */
+ Mfprintf(_mero_discout, "new neighbour %s (%s)\n", buf
+ 5, host);
} else if (strncmp(buf, "LEAV ", 5) == 0) {
/* LEAVE message, unregister database */
char *sp = NULL;
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins