Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv2321
Modified Files:
ChangeLog merovingian_forkmserver.c monetdb.1 properties.c
Log Message:
The master property of a database now contains an id that is used to identify
the master to the slaves. The id can be given using monetdb set, or one is
generated when no id is supplied (when just setting it to 'yes')
Index: monetdb.1
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/monetdb.1,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- monetdb.1 25 Sep 2009 09:44:05 -0000 1.12
+++ monetdb.1 11 Dec 2009 14:47:56 -0000 1.13
@@ -195,6 +195,20 @@
.BR merovingian (1)
manpage. Note that this property can be set for a running database, and
that a change takes immediate effect in the network.
+.IP " master=<yes|no|id>"
+Defines if the database is to be started as a replication master
+.RI ( yes ", " id "), or not (" no ).
+Replication masters are identified by slaves by their
+.IR id .
+When no
+.I id
+is given (when
+.I yes
+is given as argument), a UUID is generated for the master. Note that
+the
+.I id
+is not required to be in the format of a UUID (see
+.BR uuid_generate (3)).
.IP "inherit property database [database ...]"
Like set, but unsets the database-local value, and reverts to inherit
from the default again.
Index: merovingian_forkmserver.c
===================================================================
RCS file:
/cvsroot/monetdb/sql/src/backends/monet5/merovingian/merovingian_forkmserver.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- merovingian_forkmserver.c 8 Oct 2009 13:35:43 -0000 1.6
+++ merovingian_forkmserver.c 11 Dec 2009 14:47:56 -0000 1.7
@@ -255,9 +255,10 @@
kv = findConfKey(ckv, "master");
/* can't have master configured by default */
- if (kv->val != NULL && strcmp(kv->val, "yes") == 0) {
- master = alloca(sizeof(char) * 24);
- snprintf(master, 24, "replication_master=true");
+ if (kv->val != NULL && strcmp(kv->val, "no") != 0) {
+ size_t len = 24 + strlen(kv->val);
+ master = alloca(sizeof(char) * len);
+ snprintf(master, len, "replication_master=%s", kv->val);
}
kv = findConfKey(ckv, "slave");
Index: properties.c
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/properties.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- properties.c 8 Oct 2009 13:35:52 -0000 1.15
+++ properties.c 11 Dec 2009 14:47:56 -0000 1.16
@@ -39,7 +39,7 @@
{"shared", NULL, STR},
{"nthreads", NULL, INT},
{"optpipe", NULL, STR},
- {"master", NULL, BOOL},
+ {"master", NULL, STR},
{"slave", NULL, MURI},
{ NULL, NULL, INVALID}
};
@@ -205,6 +205,29 @@
}
value++;
}
+ } else if (strcmp(key, "master") == 0) {
+ /* basically this is either a boolean or a UUID (in
practice
+ * it is a freeform string, that sometimes happens to
be a
+ * UUID)
+ * first perform a sneaky hack to do the boolean check
*/
+ kv->type = BOOL;
+ if ((err = setConfVal(kv, val)) != NULL) {
+ GDKfree(err);
+ /* restore */
+ kv->type = STR;
+ } else {
+ /* restore */
+ kv->type = STR;
+ if (strcmp(kv->val, "yes") == 0) {
+ /* generate a unique ID for this
database */
+ val = generateUUID();
+ if ((err = setConfVal(kv, val)) !=
NULL) {
+ /* can't fail */
+ assert(0);
+ }
+ free(val);
+ }
+ }
}
}
Index: ChangeLog
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/merovingian/ChangeLog,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- ChangeLog 4 Nov 2009 11:49:31 -0000 1.30
+++ ChangeLog 11 Dec 2009 14:47:56 -0000 1.31
@@ -1,6 +1,12 @@
# ChangeLog file for sql/src/backends/monet5
# This file is updated with mchangelog (Gentoo echangelog bastard script)
+ 11 Dec 2009; Fabian Groffen <[email protected]> merovingian_forkmserver.c,
+ monetdb.1, properties.c:
+ The master property of a database now contains an id that is used to
+ identify the master to the slaves. The id can be given using monetdb set, or
+ one is generated when no id is supplied (when just setting it to 'yes')
+
30 Sep 2009; Fabian Groffen <[email protected]> merovingian.c,
merovingian_forkmserver.c, monetdb.c, properties.c, utils.c, utils.h:
Add slave property for databases
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins