Skip to contentSkip to conversation

tabled: add <Cell> element

PATCH Applied Pete Zaitcev 2 participants 3 messages Jan 15, 2010 – Jan 20, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 2/7 tabled: add <Cell> element

Make the cell configurable. Among other things we need this for is that you cannot migrate a tabled over when DB format changes, short of running 2 CLDs.

We also add a few thoughts to the documentation, prompted by re-reading of the document while adding the clause for <Cell>.

---
 doc/etc.tabled.conf |    7 +++++++
 doc/setup.txt       |   40 +++++++++++++++++++++++++++++++++++++---
 server/cldu.c       |    4 ++++
 server/config.c     |   11 +++++++++++
 server/server.c     |    2 +-
 server/tabled.h     |    1 +
 6 files changed, 61 insertions(+), 4 deletions(-)

commit 8c883a9b453b85d1da026f3638f074fe6d46df3f

Author: Master <[email protected]>
Date:   Thu Jan 14 19:37:59 2010 -0700

Add Cell configuration.

doc/etc.tabled.conf +7 -0
index b3e6d68..f6c0bee 100644
@@ -11,6 +11,13 @@
   <Port>80</Port>
 </Listen>
 
+<!--
+  One cell per DB, don't skimp on cells. Also, make sure the replication
+  ports do not conflict when you make hosts to host several cells.
+  Unfortunately, the diagnostics are not very good if they do.
+  Most likely you'll see database corruption in such cases.
+  -->
+<Cell>ultracart2</Cell>
 <TDB>/path/tabled/tdb</TDB>
 <TDBRepPort>8083</TDBRepPort>
 
doc/setup.txt +37 -3
index 4338db4..0fd32da 100644
@@ -10,13 +10,30 @@ _cld._udp.phx2.ex.com has SRV record 10 50 8081 pacman.phx2.ex.com.
 _cld._udp.phx2.ex.com has SRV record 10 50 8081 maika.phx2.ex.com.
 [root@table1 ~]# 
 
-   If this does not work, set up CLD before proceeding.
+   If this does not work, STOP NOW. Then, talk to your DNS administrator.
 
    Also, make sure that your hostname has a domain. We don't want to search
-   for CLD in the DNS root, do we?
+   for CLD in the world-wide DNS root, do we?
+
+   Make sure CLD is up (run "cldcli" to verify).
+
+*) Another thing to set up in DNS is a wildcard host for the system where
+   tabled will run. Unlike the SRV records of CLD, this is optional, but
+   these days applications may presume that it exists. Here's the way it's
+   done in ISC BIND:
+
+emus3           IN      A       192.168.128.9
+                IN      TXT     "Dell C8WQMC1"
+                IN      AAAA    fec0::1:219:b9ff:fe58:7ad6
+*.emus3         IN      CNAME   emus3
+
+   All examples on Google say FQDN is required, and most presume aliasing
+   of A and AAAA records, but BIND 9 eats the above fine.
 
 *) Copy configuration file from doc/etc.tabled.conf to /etc/tabled.conf
-   and edit to suit (see configurable items below).
+   and edit to suit (see configurable items below). Notice that the file
+   looks like XML, but is not really. In particular, names of elements are
+   case-sensitive.
 
 *) The tabled writes its pid to /var/run/tabled.pid by default.
    If you don't like the location, change it with <PID> tag.
@@ -24,6 +41,17 @@ _cld._udp.phx2.ex.com has SRV record 10 50 8081 maika.phx2.ex.com.
 *) Create/choose TDB data directory, where Berkeley DB stores
    data and metadata. Change this location with <TDB> tag.
 
+*) Assign the cell name:
+
+	<Cell>ultracart3</Cell>
+
+   Currently, a tabled process scans its cell, finds all other tabled
+   instances, and attempts to replicate its database to/from them.
+   In short, use one cell per business application.
+
+   Cell name defaults to "default", so you can leave this element unset,
+   but don't do it. Any name, even "qwerty", is better than the default.
+
 *) Select the port to listen, if desired. This is done using the <Listen>
    element:
 
@@ -31,6 +59,12 @@ _cld._udp.phx2.ex.com has SRV record 10 50 8081 maika.phx2.ex.com.
 		<Port>80</Port>
 	</Listen>
 
+   Default is port 80, which you should use unless the system in question
+   hosts an unrelated webserver too. This is because some libraries, such
+   as ancient Google Boto, may have bugs that prevent them from talking to
+   ports other than 80 (for unencrypted HTTP). If your target clients are
+   bug-free, use anything you like. The 8080 is a popular choice.
+
 *) Initialize TDB, the metadata database.  Load user/password pairs
    into TDB, using tdbadm utility.  The user/password pairs are
    presented to tdbadm stdin in the following text format:
server/cldu.c +4 -0
index d02eafd..273f149 100644
@@ -129,6 +129,10 @@ static int cldu_nextactive(struct cld_session *sp)
 	return sp->actx;
 }
 
+/*
+ * Notice that for now we use the same cell name for both tabled and the
+ * chunkservers that it uses, so this function only takes one cell argument.
+ */
 static int cldu_setcell(struct cld_session *sp,
 			const char *thiscell, const char *thishost)
 {
server/config.c +11 -0
index 037176d..9d8ca87 100644
@@ -317,6 +317,17 @@ static void cfg_elm_end (GMarkupParseContext *context,
 	}
 #endif
 
+	else if (!strcmp(element_name, "Cell")) {
+		if (!cc->text) {
+			applog(LOG_WARNING, "Cell element empty");
+			return;
+		}
+
+		free(tabled_srv.cell);
+		tabled_srv.cell = cc->text;
+		cc->text = NULL;
+	}
+
 	else {
 		applog(LOG_WARNING, "Unknown element \"%s\"", element_name);
 	}
server/server.c +1 -1
index f16d2ab..6069534 100644
@@ -1795,7 +1795,7 @@ int main (int argc, char *argv[])
 	if (rc)
 		goto err_out_net;
 
-	if (cld_begin(tabled_srv.ourhost, NULL) != 0) {
+	if (cld_begin(tabled_srv.ourhost, tabled_srv.cell) != 0) {
 		rc = 1;
 		goto err_cld_session;
 	}
server/tabled.h +1 -0
index a0d3400..60b6c05 100644
@@ -236,6 +236,7 @@ struct server {
 	char			*chunk_user;	/* username for stc_new */
 	char			*chunk_key;	/* key for stc_new */
 	unsigned short		rep_port;	/* db4 replication port */
+	char			*cell;		/* our cell (both T and Ch) */
 
 	char			*ourhost;	/* use this if DB master */
 	struct database		*db;		/* database handle */
#1 lore raw
Quoted 9 lines · Pete Zaitcev

Make the cell configurable. Among other things we need this for is that you cannot migrate a tabled over when DB format changes, short of running 2 CLDs.

We also add a few thoughts to the documentation, prompted by re-reading of the document while adding the clause for<Cell>.

Quoted 8 lines
---
  doc/etc.tabled.conf |    7 +++++++
  doc/setup.txt       |   40 +++++++++++++++++++++++++++++++++++++---
  server/cldu.c       |    4 ++++
  server/config.c     |   11 +++++++++++
  server/server.c     |    2 +-
  server/tabled.h     |    1 +
  6 files changed, 61 insertions(+), 4 deletions(-)

Strictly speaking, this is wrong, but I applied so that we may make forward progress.

The definition of a "cell" (or "cel") is everything within a single CLD namespace.

It is a design requirement that any number of separate tabled instances may be run within a single cell. The differentiating factor is pathname. Thus, one tabled instance may store files in

	cld://cld.mysite.com/table1/
and a totally separate, parallel instance of table may store its files in
	cld://cld.mysite.com/table2/

Provisioning another tabled instance should be as simple as creating a new directory in CLD, and running the tabled/chunkd nodes.

Thus, the user interface should be CLD hostname + pathname, not "cell name."

Jeff

#2 lore raw
Quoted 2 lines · On Wed, 20 Jan 2010 14:51:08 -0500 Jeff Garzik <[email protected]> wrote:

Strictly speaking, this is wrong, but I applied so that we may make forward progress.

Well, good.

Quoted 2 lines

The definition of a "cell" (or "cel") is everything within a single CLD namespace.

Bah, I can call it t-cell or "tabled instance" if that removes the confusion with CLD "cell". After you called a Chunk partition a "table", I thought you didn't care about reusing a word.

Quoted 2 lines

Provisioning another tabled instance should be as simple as creating a new directory in CLD, and running the tabled/chunkd nodes.

It is true with the patch. There is no problem except terminology.

Quoted 1 line

Thus, the user interface should be CLD hostname + pathname, not "cell name."

Sure, I can fix it up. It was in todo for a while.

-- Pete