[Patch 1/2] Tabled: rename cells to groups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The term "cell" in context of tabled and chunkd conflicts with the idea
of a CLD cell. So, rename it to "group".

Notice that we aren't introducing configuring of actual CLD paths yet.
Coding that in the old CLD API is too hard, so it will come after ncld.
Stay tuned.

Signed-off-by: Pete Zaitcev <zaitcev@xxxxxxxxxx>

---
 doc/etc.tabled.conf   |    6 ++--
 doc/setup.txt         |   11 ++++----
 server/cldu.c         |   54 ++++++++++++++++++++--------------------
 server/config.c       |    8 ++---
 server/server.c       |    2 -
 server/tabled.h       |    4 +-
 test/tabled-test.conf |    2 +
 7 files changed, 45 insertions(+), 42 deletions(-)

commit 2bfe3f6005ee9847095b0fc4401de3c0517efc00
Author: Master <zaitcev@xxxxxxxxxxxxxxxxxx>
Date:   Thu Jan 28 12:54:37 2010 -0700

    Rename Cell to Group.

diff --git a/doc/etc.tabled.conf b/doc/etc.tabled.conf
index 6904eae..22d20a7 100644
--- a/doc/etc.tabled.conf
+++ b/doc/etc.tabled.conf
@@ -12,12 +12,12 @@
 </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.
+  One group per DB, don't skimp on groups. Also, make sure the replication
+  ports do not conflict when you make hosts to host several groups.
   Unfortunately, the diagnostics are not very good if they do.
   Most likely you'll see database corruption in such cases.
   -->
-<Cell>ultracart2</Cell>
+<Group>ultracart2</Group>
 <TDB>/path/tabled/tdb</TDB>
 <TDBRepPort>8083</TDBRepPort>
 
diff --git a/doc/setup.txt b/doc/setup.txt
index 0fd32da..ac0dfb0 100644
--- a/doc/setup.txt
+++ b/doc/setup.txt
@@ -41,15 +41,16 @@ emus3           IN      A       192.168.128.9
 *) Create/choose TDB data directory, where Berkeley DB stores
    data and metadata. Change this location with <TDB> tag.
 
-*) Assign the cell name:
+*) Assign the group name:
 
-	<Cell>ultracart3</Cell>
+	<Group>ultracart3</Group>
 
-   Currently, a tabled process scans its cell, finds all other tabled
+   Currently, a tabled process scans its group, finds all other tabled
    instances, and attempts to replicate its database to/from them.
-   In short, use one cell per business application.
+   In short, use one group per business application, and many groups
+   per one CLD cell.
 
-   Cell name defaults to "default", so you can leave this element unset,
+   Group 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>
diff --git a/server/cldu.c b/server/cldu.c
index 9cda87e..6c7d43d 100644
--- a/server/cldu.c
+++ b/server/cldu.c
@@ -68,17 +68,17 @@ struct cld_session {
 	int actx;		/* Active host cldv[actx] */
 	struct cld_host cldv[N_CLD];
 
-	char *thiscell;
+	char *thisgroup;
 	char *thishost;
 	struct event ev;	/* Associated with fd */
-	char *cfname;		/* /tabled-cell directory */
-	struct cldc_fh *cfh;	/* /tabled-cell directory, keep open for scan */
-	char *ffname;		/* /tabled-cell/thishost */
-	struct cldc_fh *ffh;	/* /tabled-cell/thishost, keep open for lock */
-	char *xfname;		/* /chunk-cell directory */
-	struct cldc_fh *xfh;	/* /chunk-cell directory */
-	char *yfname;		/* /chunk-cell/NID file */
-	struct cldc_fh *yfh;	/* /chunk-cell/NID file */
+	char *cfname;		/* /tabled-group directory */
+	struct cldc_fh *cfh;	/* /tabled-group directory, keep open for scan */
+	char *ffname;		/* /tabled-group/thishost */
+	struct cldc_fh *ffh;	/* /tabled-group/thishost, keep open for lock */
+	char *xfname;		/* /chunk-GROUP directory */
+	struct cldc_fh *xfh;	/* /chunk-GROUP directory */
+	char *yfname;		/* /chunk-GROUP/NID file */
+	struct cldc_fh *yfh;	/* /chunk-GROUP/NID file */
 
 	struct list_head chunks;	/* found in xfname, struct chunk_node */
 };
@@ -134,34 +134,34 @@ static int cldu_nextactive(struct cld_session *sp)
 }
 
 /*
- * 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.
+ * Notice that for now we use the same group name for both tabled and the
+ * chunkservers that it uses, so this function only takes one group argument.
  */
-static int cldu_setcell(struct cld_session *sp,
-			const char *thiscell, const char *thishost)
+static int cldu_setgroup(struct cld_session *sp,
+			const char *thisgroup, const char *thishost)
 {
 	char *mem;
 
-	if (thiscell == NULL) {
-		thiscell = "default";
+	if (thisgroup == NULL) {
+		thisgroup = "default";
 	}
 
-	sp->thiscell = strdup(thiscell);
-	if (!sp->thiscell)
+	sp->thisgroup = strdup(thisgroup);
+	if (!sp->thisgroup)
 		goto err_oom;
 	sp->thishost = strdup(thishost);
 	if (!sp->thishost)
 		goto err_oom;
 
-	if (asprintf(&mem, "/tabled-%s", thiscell) == -1)
+	if (asprintf(&mem, "/tabled-%s", thisgroup) == -1)
 		goto err_oom;
 	sp->cfname = mem;
 
-	if (asprintf(&mem, "/tabled-%s/%s", thiscell, thishost) == -1)
+	if (asprintf(&mem, "/tabled-%s/%s", thisgroup, thishost) == -1)
 		goto err_oom;
 	sp->ffname = mem;
 
-	if (asprintf(&mem, "/chunk-%s", thiscell) == -1)
+	if (asprintf(&mem, "/chunk-%s", thisgroup) == -1)
 		goto err_oom;
 	sp->xfname = mem;
 
@@ -790,7 +790,7 @@ static void next_chunk(struct cld_session *sp)
 
 	np = list_entry(sp->chunks.next, struct chunk_node, link);
 
-	if (asprintf(&mem, "/chunk-%s/%s", sp->thiscell, np->name) == -1) {
+	if (asprintf(&mem, "/chunk-%s/%s", sp->thisgroup, np->name) == -1) {
 		applog(LOG_WARNING, "OOM in cldu");
 		return;
 	}
@@ -975,7 +975,7 @@ void cld_init()
 /*
  * This initiates our sole session with a CLD instance.
  */
-int cld_begin(const char *thishost, const char *thiscell)
+int cld_begin(const char *thishost, const char *thisgroup)
 {
 	static struct cld_session *sp = &ses;
 
@@ -984,9 +984,9 @@ int cld_begin(const char *thishost, const char *thiscell)
 	evtimer_set(&ses.tm_rescan, cldu_tm_rescan, &ses);
 	evtimer_set(&ses.tm_reopen, cldu_tm_reopen, &ses);
 
-	if (cldu_setcell(sp, thiscell, thishost)) {
+	if (cldu_setgroup(sp, thisgroup, thishost)) {
 		/* Already logged error */
-		goto err_cell;
+		goto err_group;
 	}
 
 	if (!sp->forced_hosts) {
@@ -1033,7 +1033,7 @@ int cld_begin(const char *thishost, const char *thiscell)
 
 err_net:
 err_addr:
-err_cell:
+err_group:
 	return -1;
 }
 
@@ -1093,8 +1093,8 @@ void cld_end(void)
 	sp->xfname = NULL;
 	free(sp->yfname);
 	sp->yfname = NULL;
-	free(sp->thiscell);
-	sp->thiscell = NULL;
+	free(sp->thisgroup);
+	sp->thisgroup = NULL;
 	free(sp->thishost);
 	sp->thishost = NULL;
 }
diff --git a/server/config.c b/server/config.c
index 301be66..ff4d876 100644
--- a/server/config.c
+++ b/server/config.c
@@ -361,14 +361,14 @@ static void cfg_elm_end (GMarkupParseContext *context,
 	}
 #endif
 
-	else if (!strcmp(element_name, "Cell")) {
+	else if (!strcmp(element_name, "Group")) {
 		if (!cc->text) {
-			applog(LOG_WARNING, "Cell element empty");
+			applog(LOG_WARNING, "Group element empty");
 			return;
 		}
 
-		free(tabled_srv.cell);
-		tabled_srv.cell = cc->text;
+		free(tabled_srv.group);
+		tabled_srv.group = cc->text;
 		cc->text = NULL;
 	}
 
diff --git a/server/server.c b/server/server.c
index 525e397..e5580c5 100644
--- a/server/server.c
+++ b/server/server.c
@@ -1829,7 +1829,7 @@ int main (int argc, char *argv[])
 	if (rc)
 		goto err_out_net;
 
-	if (cld_begin(tabled_srv.ourhost, tabled_srv.cell) != 0) {
+	if (cld_begin(tabled_srv.ourhost, tabled_srv.group) != 0) {
 		rc = 1;
 		goto err_cld_session;
 	}
diff --git a/server/tabled.h b/server/tabled.h
index b81e615..a2ffd8b 100644
--- a/server/tabled.h
+++ b/server/tabled.h
@@ -237,7 +237,7 @@ struct server {
 	char			*chunk_key;	/* key for stc_new */
 	unsigned short		rep_port;	/* db4 replication port */
 	char			*status_port;	/* status webserver */
-	char			*cell;		/* our cell (both T and Ch) */
+	char			*group;		/* our group (both T and Ch) */
 
 	char			*ourhost;	/* use this if DB master */
 	struct database		*db;		/* database handle */
@@ -287,7 +287,7 @@ extern void cli_in_end(struct client *cli);
 
 /* cldu.c */
 extern void cld_init(void);
-extern int cld_begin(const char *fqdn, const char *cell);
+extern int cld_begin(const char *fqdn, const char *group);
 extern void cldu_add_host(const char *host, unsigned int port);
 extern void cld_end(void);
 extern struct hail_log cldu_hail_log;
diff --git a/test/tabled-test.conf b/test/tabled-test.conf
index 068ed00..f06ae2c 100644
--- a/test/tabled-test.conf
+++ b/test/tabled-test.conf
@@ -16,3 +16,5 @@
 <ChunkUser>testuser</ChunkUser>
 <ChunkKey>testuser</ChunkKey>
 
+<!-- Setting "default" just to make sure tabled configures it correctly. -->
+<Group>default</Group>
--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Fedora Clound]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux