tabled: parse Chunk parameters in CLD v2
PATCH 1/1 tabled: parse Chunk parameters in CLD v2
This patch probably has all that's necessary to flip the configuration to use CLD to configure available Chunk nodes and dispose with <StorageNode> forever. However, it did not complete all tests that's necessary to declare victory. So for now we continue to use <StorageNode>. This should be relaiable in Koji, but we have -D in build scripts for now.
The parsing itself uses the same code that our parser of the static configuration uses, although it appears resistant to refactoring without going full tilt to a table-driven system, and so we copy-pasted a bunch from config.c to storparse.c.
server/Makefile.am +2 -1
@@ -4,7 +4,8 @@ INCLUDES = -I$(top_srcdir)/include @GLIB_CFLAGS@ @CHUNKDC_CFLAGS@ @CLDC_CFLAGS@ sbin_PROGRAMS = tabled tdbadm tabled_SOURCES = tabled.h \ - bucket.c object.c server.c storage.c cldu.c config.c util.c + bucket.c object.c server.c storage.c storparse.c cldu.c \ + config.c util.c tabled_LDADD = ../lib/libhttputil.a ../lib/libtdb.a \ @CHUNKDC_LIBS@ @CLDC_LIBS@ @PCRE_LIBS@ @GLIB_LIBS@ \ @CRYPTO_LIBS@ @DB4_LIBS@ @EVENT_LIBS@ @ARGP_LIBS@ @SSL_LIBS@
server/cldu.c +115 -59
310 lines not on this page · raw message
server/config.c +13 -67
117 lines not on this page · raw message
server/server.c +44 -30
117 lines not on this page · raw message
server/storage.c +67 -6
86 lines not on this page · raw message
server/storparse.c new file +408 -0
408 lines not on this page · raw message
server/tabled.h +18 -8
@@ -80,12 +80,21 @@ struct compiled_pat {pcre *re; }; +struct geo { +char *area; +char *zone;/* Building */ +char *rack; +}; +struct storage_node {struct list_head all_link; +uint32_t id; +unsigned alen;int addr_af;struct sockaddr_in6 addr;char *hostname;/* Only used because stc_new is overly smart. */ +int nchu;/* number of open_chunk */ };
@@ -170,10 +179,6 @@ struct client {char req_buf[CLI_REQ_BUF_SZ ];/* input buffer */ }; -enum st_cld { -ST_CLD_INIT ,ST_CLD_ACTIVE -}; -enum st_tdb {ST_TDB_INIT ,ST_TDB_OPEN ,ST_TDB_ACTIVE ,ST_TDB_MASTER ,ST_TDB_SLAVE ,ST_TDBNUM
@@ -215,9 +220,9 @@ struct server {GList *sockets;struct list_head all_stor;/* struct storage_node */ +int num_stor;/* number of storage_node's */ uint64_t object_count; -enum st_cld state_cld;enum st_tdb state_tdb, state_tdb_new;enum st_net state_net;
@@ -255,9 +260,9 @@ extern void cli_out_end(struct client *cli);extern void cli_in_end (struct client *cli);/* cldc.c */ +extern void cld_init (void ); +extern int cld_begin (const char *fqdn,const char *cell);extern void cldu_add_host (const char *host,unsigned int port); -extern int cld_begin (const char *fqdn,const char *cell, -void (*state_cb)(enum st_cld ));extern void cld_end (void );/* util.c */
@@ -295,6 +300,7 @@ extern bool cli_cb_free(struct client *cli, struct client_write *wr,extern bool cli_write_start (struct client *cli);extern int cli_req_avail (struct client *cli);extern void applog (int prio,const char *fmt, ...); +extern void stor_update_cb (void );/* config.c */ extern void read_config (void );
@@ -312,7 +318,11 @@ extern bool stor_put_end(struct open_chunk *cep);extern ssize_t stor_get_buf (struct open_chunk *cep,void *data,size_t len);extern int stor_obj_del (struct storage_node *stn,uint64_t key);extern bool stor_obj_test (struct open_chunk *cep,uint64_t key); -extern void stor_add_node (const char *data,size_t len); +extern void stor_add_node (uint32_t nid,const char *hostname, +const char *portstr,struct geo *locp);extern void stor_init (void ); +/* storparse.c */ +extern void stor_parse (char *fname,const char *text,size_t len); +#endif /* __TABLED_H__ */
test/chunkd-test.conf +5 -1
@@ -9,7 +9,11 @@ </Listen> <PID>chunkd.pid</PID> <Path>data/chunk</Path> -<NID>1</NID> +<!-- + Excluding NID prevents Chunk from registering with CLD and thus conflicting + with itself as described by <StorageNode> in tabled.conf. + --> +<!-- <NID>1</NID> --> <CLD> <Port>18081</Port> <Host>localhost</Host>
test/start-daemon +2 -2
@@ -20,10 +20,10 @@ fi cld -d data/cld -P cld.pid -p 18081 -E chunkd -C $top_srcdir/test/chunkd-test.conf -E -# 3 is enough, but we like to let chunkd to come up eary and register with CLD +# 3 is enough, but we like to let chunkd to come up early and register with CLD sleep 7 -../server/tabled -C $top_srcdir/test/tabled-test.conf -E +../server/tabled -C $top_srcdir/test/tabled-test.conf -E -D sleep 3
Quoted 7 lines · Pete Zaitcev
test/start-daemon +0
-0@@ -20,10 +20,10 @@ fi cld -d data/cld -P cld.pid -p 18081 -E chunkd -C $top_srcdir/test/chunkd-test.conf -E
test/start-daemon fi · line 29
Quoted 10 lines
test/start-daemon +2
-2-# 3 is enough, but we like to let chunkd to come up eary and register with CLD +# 3 is enough, but we like to let chunkd to come up early and register with CLD sleep 7 -../server/tabled -C $top_srcdir/test/tabled-test.conf -E +../server/tabled -C $top_srcdir/test/tabled-test.conf -E -D sleep 3
Thinking out loud...
I occasionally wonder about a TCP control channel for tabled, to be used for various administration purposes.
tdbadm is not as useful when replication is active, unless tdbadm becomes the db4 master -- undesirable when the cluster is active.
An alternative, already employed by bind utility rndc(8), is to create an authenticated TCP-based control channel, to be used for various administrative purposes.
In tabled's case, we could use such a channel for
* database maintenance activities, while database cluster is active
* querying server startup status, so that you know _precisely_ when tabled is active. That would permit you to eliminate the various "sleep 3" and "sleep 7", I hope?
Regards,
Jeff
Quoted 5 lines · Jeff Garzik
Pete Zaitcev wrote:
* querying server startup status, so that you know _precisely_ when tabled is active. That would permit you to eliminate the various "sleep 3" and "sleep 7", I hope?
A control program is useful for the reasons you outlined and I skipped, but as far as daemon bootstrap is concerned, the daemons have the built-in retrying and waiting mechanisms which allow to eliminate magic sleeps. So such control program is not needed to get daemons up. I already eliminated the sleep betwenn cld and chunkd. We do need something to keep tests from running prematurely, however, since they are not sophisticated clients that can retry. Currently, wait-for-listen performs this function.
-- Pete
Jeff Garzik
AppliedQuoted 6 lines · Pete Zaitcev
This patch probably has all that's necessary to flip the configuration to use CLD to configure available Chunk nodes and dispose with <StorageNode> forever. However, it did not complete all tests that's necessary to declare victory. So for now we continue to use<StorageNode>. This should be relaiable in Koji, but we have -D in build scripts for now.
Quoted 6 lines
The parsing itself uses the same code that our parser of the static configuration uses, although it appears resistant to refactoring without going full tilt to a table-driven system, and so we copy-pasted a bunch from
config.ctostorparse.c.Signed-off-by Pete Zaitcev<[email protected]>
applied