Fix metadata replication
PATCH 3/3 Fix metadata replication
The metadata replication in tabled nominally existed, but did not worked. There were a couple of small bugs (such as an attempt to boot directly into Slave state would lead to a hang). However, the biggest problem was how the identity of nodes in Replication Manager API had to be the same as hostname. When doing so, repmgr code used the hostname to bind instead of a wildcard socket. But when doing so, on any stock Fedora or RHEL system it would end listening on loopback only, because the /etc/hosts aliased the hostname to loopback address. Thus running any replication required addition host configuration that can cause any kind of unexpected consequences. In addition it's impossible to run two nodes on one host for testing.
This patch does away with the Replication Manager and uses Base API instead. This way, issues with host aliasing are addressed, and the state transitions occur much faster because there is no voting.
Note that the provision is added to run peers on the same host, using a configuration clause TDBRepName. I was unable to come up with a reliable way to make persistent, nonconflicting identifiers that would replace hostnames. Fortunately, this should only be used for build tests, where we probably can live with it.
The resulting replication feature was tested to work. Not sure if it is enough to trust it with one's data, but it's better than before.
--- doc/etc.tabled.conf | 8 doc/setup.txt | 13 + include/tdb.h | 15 - lib/tdb.c | 130 ++++++------- server/Makefile.am | 2 server/bucket.c | 34 +-- server/cldu.c | 416 ++++++++++++++++++++++++++++++++++++------ server/config.c | 10 + server/object.c | 22 +- server/replica.c | 8 server/server.c | 404 ++++++++++++++++++++++++++++++++++++---- server/tabled.h | 97 +++++++++ server/tdbadm.c | 51 +---- 13 files changed, 963 insertions(+), 247 deletions(-)
commit 27a50dfeb3dec834b8f07dd95d0ec3d9c3963de3
Author: Pete Zaitcev <[email protected]> Date: Thu Aug 5 21:17:17 2010 -0600
Metadata replication.
doc/etc.tabled.conf +4 -4
@@ -13,12 +13,12 @@ <!-- 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. + ports do not conflict when you make boxes to host several groups or use + replication instances iwth TDBRepName. --> <Group>ultracart2</Group> -<TDB>/path/tabled/tdb</TDB> +<TDB>/path/tabled-uc2/</TDB> <!-- mkdir -p /path/tabled-uc2 --> +<!-- <TDBRepName>12345.my_local_node_name.example.com</TDBRepName> --> <TDBRepPort>8083</TDBRepPort> <!--
doc/setup.txt +12 -1
@@ -15,7 +15,9 @@ _cld._udp.phx2.ex.com has SRV record 10 50 8081 maika.phx2.ex.com. Also, make sure that your hostname has a domain. We don't want to search for CLD in the world-wide DNS root, do we? - Make sure CLD is up (run "cldcli" to verify). + Once you know that CLD is running, verify that tabled can talk to + it by running "cldcli". UDP traffic to be allowed for port 8081 or + other port as specified in the SRV record. *) 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
@@ -30,6 +32,10 @@ emus3 IN A 192.168.128.9 All examples on Google say FQDN is required, and most presume aliasing of A and AAAA records, but BIND 9 eats the above fine. +*) Speaking of FQDN, it is possible to force tabled to use a non-default + hostname with ForceHost tag. In practice this is only useful when + the DNS is broken. + *) Copy configuration file from doc/etc.tabled.conf to /etc/tabled.conf 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
@@ -53,6 +59,11 @@ emus3 IN A 192.168.128.9 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. +*) In each group, tabled uses its hostname to identify itself. However, + if you ever wish to run two tabled processes that serve the same group, + it can be accomplished by setting TDBRepName. N.B.: A loss of power for + the host will knock out all of them, so never use this in production. + *) Select the port to listen, if desired. This is done using the <Listen> element:
include/tdb.h +6 -9
@@ -109,15 +109,12 @@ struct tabledb {DB *oids;/* object ID db */ }; -struct db_remote {/* remotes for tdb_init */ -char *host; -unsigned short port; -}; - -extern int tdb_init (struct tabledb *tdb,const char *home,const char *pass, -unsigned int env_flags,const char *errpfx,bool do_syslog, -GList *remotes,char *rep_host,unsigned short rep_port, -void (*cb)(enum db_event )); +extern int tdb_init (struct tabledb *tdb,const char *db_home, +const char *db_password,const char *errpfx,bool do_syslog, +int rep_our_id, +int (*rep_send)(DB_ENV *dbenv,const DBT *ctl,const DBT *rec, +const DB_LSN *lsnp,int envid,uint32_t flags), +bool we_are_master,void (*cb)(enum db_event ));extern int tdb_up (struct tabledb *tdb,unsigned int open_flags);extern void tdb_down (struct tabledb *tdb);extern void tdb_fini (struct tabledb *tdb);
lib/tdb.c +69 -61
185 lines not on this page · raw message
server/Makefile.am +1 -1
@@ -4,7 +4,7 @@ INCLUDES = -I$(top_srcdir)/include @GLIB_CFLAGS@ @HAIL_CFLAGS@ sbin_PROGRAMS = tabled tdbadm tabled_SOURCES = tabled.h \ - bucket.c cldu.c config.c object.c replica.c \ + bucket.c cldu.c config.c metarep.c object.c replica.c \ server.c status.c storage.c storparse.c util.c tabled_LDADD = ../lib/libtdb.a \ @HAIL_LIBS@ @PCRE_LIBS@ @GLIB_LIBS@ \
server/bucket.c +17 -17
@@ -43,11 +43,11 @@ bool has_access(const char *user, const char *bucket, const char *key,size_t alloc_len, key_len =0 ;struct db_acl_key *acl_key;struct db_acl_ent *acl; -DB_ENV *dbenv = tdb.env; +DB_ENV *dbenv = tdbrep.tdb.env;DB_TXN *txn =NULL ;DBT pkey, pval;DBC *cur =NULL ; -DB *acls = tdb.acls; +DB *acls = tdbrep.tdb.acls;if (user ==NULL ) user =DB_ACL_ANON ;
@@ -132,7 +132,7 @@ err_out:static int add_access_user (DB_TXN *txn,const char *bucket,const char *key,const char *user,const char *perms) { -DB *acls = tdb.acls; +DB *acls = tdbrep.tdb.acls;int key_len;int acl_len;struct db_acl_ent *acl;
@@ -203,8 +203,8 @@ bool service_list(struct client *cli, const char *user)bool rcb;DB_TXN *txn =NULL ;DBC *cur =NULL ; -DB_ENV *dbenv = tdb.env; -DB *bidx = tdb.buckets_idx; +DB_ENV *dbenv = tdbrep.tdb.env; +DB *bidx = tdbrep.tdb.buckets_idx;DBT skey, pkey, pval; if (asprintf(&s,
@@ -348,7 +348,7 @@ bool bucket_valid(const char *bucket)static int bucket_find (DB_TXN *txn,const char *bucket,char *owner,int owner_len) { -DB *buckets = tdb.buckets; +DB *buckets = tdbrep.tdb.buckets;DBT key, val;struct db_bucket_ent ent;int rc;
@@ -455,9 +455,9 @@ bool bucket_add(struct client *cli, const char *user, const char *bucket)struct db_bucket_ent ent;bool setacl;/* is ok to put pre-existing bucket */ enum ReqACLC canacl; -DB *buckets = tdb.buckets; -DB *acls = tdb.acls; -DB_ENV *dbenv = tdb.env; +DB *buckets = tdbrep.tdb.buckets; +DB *acls = tdbrep.tdb.acls; +DB_ENV *dbenv = tdbrep.tdb.env;DB_TXN *txn =NULL ;DBT key, val;
@@ -589,11 +589,11 @@ bool bucket_del(struct client *cli, const char *user, const char *bucket)enum errcode err = InternalError;int rc;struct db_bucket_ent ent; -DB_ENV *dbenv = tdb.env; +DB_ENV *dbenv = tdbrep.tdb.env;DB_TXN *txn =NULL ; -DB *buckets = tdb.buckets; -DB *acls = tdb.acls; -DB *objs = tdb.objs; +DB *buckets = tdbrep.tdb.buckets; +DB *acls = tdbrep.tdb.acls; +DB *objs = tdbrep.tdb.objs;DBC *cur =NULL ;DBT key, val;char structbuf[sizeof (struct db_acl_key ) +32 ];
@@ -922,9 +922,9 @@ static bool bucket_list_keys(struct client *cli, const char *user,size_t pfx_len;struct bucket_list_info bli;bool rcb; -DB_ENV *dbenv = tdb.env; +DB_ENV *dbenv = tdbrep.tdb.env;DB_TXN *txn =NULL ; -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;DBC *cur =NULL ;DBT pkey, pval;struct db_obj_key *obj_key;
@@ -1159,8 +1159,8 @@ bool access_list(struct client *cli, const char *bucket, const char *key,GHashTable *param;enum errcode err = InternalError; -DB_ENV *dbenv = tdb.env; -DB *acls = tdb.acls; +DB_ENV *dbenv = tdbrep.tdb.env; +DB *acls = tdbrep.tdb.acls;int alloc_len;char owner[64 ];GList *res;
server/cldu.c +366 -50
569 lines not on this page · raw message
server/config.c +10 -0
@@ -224,6 +224,16 @@ static void cfg_elm_end (GMarkupParseContext *context, cc->text =NULL ; } +else if (!strcmp (element_name,"TDBRepName" )) { +if (!cc->text) { +applog (LOG_WARNING ,"TDBRepName element empty" ); +return ; + } +free (tabled_srv.rep_name); + tabled_srv.rep_name = cc->text; + cc->text =NULL ; + } +else if (!strcmp (element_name,"StatusPort" )) {if (!cc->text) {applog (LOG_WARNING ,"StatusPort element empty" );
server/object.c +11 -11
@@ -39,7 +39,7 @@static int object_find (DB_TXN *txn,const char *bucket,const char *key,struct db_obj_ent *pobj) { -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;struct db_obj_key *okey;size_t alloc_len;DBT pkey, pval;
@@ -72,7 +72,7 @@ static int object_find(DB_TXN *txn, const char *bucket, const char *key,static bool __object_del (DB_TXN *txn,const char *bucket,const char *key) { -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;struct db_obj_key *okey;size_t okey_len;DBT pkey;
@@ -100,7 +100,7 @@ static bool __object_del(DB_TXN *txn, const char *bucket, const char *key)bool object_del_acls (DB_TXN *txn,const char *bucket,const char *key) { -DB *acls = tdb.acls; +DB *acls = tdbrep.tdb.acls;struct db_acl_key *akey;size_t alloc_len;DBT pkey;
@@ -163,8 +163,8 @@ bool object_del(struct client *cli, const char *user,int rc;enum errcode err = InternalError;size_t alloc_len; -DB_ENV *dbenv = tdb.env; -DB *objs = tdb.objs; +DB_ENV *dbenv = tdbrep.tdb.env; +DB *objs = tdbrep.tdb.objs;struct db_obj_key *okey;struct db_obj_ent obje;DBT pkey, pval;
@@ -326,9 +326,9 @@ static bool object_put_end(struct client *cli)struct db_obj_ent oldobj;bool delobj;size_t alloc_len; -DB_ENV *dbenv = tdb.env; +DB_ENV *dbenv = tdbrep.tdb.env;DBT pkey, pval; -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;DB_TXN *txn =NULL ;GByteArray *string_data;GArray *string_lens;
@@ -786,7 +786,7 @@ static bool object_put_body(struct client *cli, const char *user,return cli_err (cli, InternalError); } - objid =objid_next (&tabled_srv.object_count, &tdb); + objid =objid_next (&tabled_srv.object_count, &tdbrep.tdb); rc =open_chunks (&cli->out_ch, &tabled_srv.all_stor, cli, objid, content_len);
@@ -865,9 +865,9 @@ static bool object_put_acls(struct client *cli, const char *user, {enum errcode err = InternalError;enum ReqACLC canacl; -DB_ENV *dbenv = tdb.env; +DB_ENV *dbenv = tdbrep.tdb.env;DB_TXN *txn =NULL ; -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;char *hdr;char timestr[64 ];int rc;
@@ -1130,7 +1130,7 @@ static bool object_get_body(struct client *cli, const char *user,bool access_ok, modified = true;GString *extra_hdr;size_t alloc_len; -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;struct db_obj_key *okey;struct db_obj_ent *obj =NULL ;DBT pkey, pval;
server/replica.c +4 -4
@@ -612,8 +612,8 @@ static void rep_scan_verify(struct rep_arg *arg,static void rep_add_nid (unsigned int klen,struct db_obj_key *key,uint32_t nid) { -DB_ENV *db_env = tdb.env; -DB *db_objs = tdb.objs; +DB_ENV *db_env = tdbrep.tdb.env; +DB *db_objs = tdbrep.tdb.objs;DB_TXN *db_txn;DBT pkey, pval;struct db_obj_ent *obj;
@@ -749,8 +749,8 @@ static void rep_scan(struct rep_arg *arg)g_mutex_unlock (kscan_mutex);memset (&cur,0 ,sizeof (struct cursor ));/* enough to construct */ - cur.db_env = tdb.env; - cur.db_objs = tdb.objs; + cur.db_env = tdbrep.tdb.env; + cur.db_objs = tdbrep.tdb.objs; kcnt =0 ;for (;;) {
server/server.c +357 -47
570 lines not on this page · raw message
server/tabled.h +94 -3
163 lines not on this page · raw message
server/tdbadm.c +12 -39
94 lines not on this page · raw message
Quoted 27 lines · Pete Zaitcev
The metadata replication in tabled nominally existed, but did not worked. There were a couple of small bugs (such as an attempt to boot directly into Slave state would lead to a hang). However, the biggest problem was how the identity of nodes in Replication Manager API had to be the same as hostname. When doing so, repmgr code used the hostname to bind instead of a wildcard socket. But when doing so, on any stock Fedora or RHEL system it would end listening on loopback only, because the
/etc/hostsaliased the hostname to loopback address. Thus running any replication required addition host configuration that can cause any kind of unexpected consequences. In addition it's impossible to run two nodes on one host for testing.This patch does away with the Replication Manager and uses Base API instead. This way, issues with host aliasing are addressed, and the state transitions occur much faster because there is no voting.
Note that the provision is added to run peers on the same host, using a configuration clause TDBRepName. I was unable to come up with a reliable way to make persistent, nonconflicting identifiers that would replace hostnames. Fortunately, this should only be used for build tests, where we probably can live with it.
The resulting replication feature was tested to work. Not sure if it is enough to trust it with one's data, but it's better than before.
Signed-off-by Pete Zaitcev<[email protected]>
Quoted 15 lines
--- doc/etc.tabled.conf | 8 doc/setup.txt | 13 + include/tdb.h | 15 - lib/tdb.c | 130 ++++++------- server/Makefile.am | 2 server/bucket.c | 34 +-- server/cldu.c | 416 ++++++++++++++++++++++++++++++++++++------ server/config.c | 10 + server/object.c | 22 +- server/replica.c | 8 server/server.c | 404 ++++++++++++++++++++++++++++++++++++---- server/tabled.h | 97 +++++++++ server/tdbadm.c | 51 +---- 13 files changed, 963 insertions(+), 247 deletions(-)
Including metarep.c would be helpful ;-)
Will wait on release for this...
Quoted 45 lines · On Tue, 10 Aug 2010 15:14:19 -0400 Jeff Garzik <[email protected]> wrote:
Quoted 27 lines · Pete Zaitcev
The metadata replication in tabled nominally existed, but did not worked. There were a couple of small bugs (such as an attempt to boot directly into Slave state would lead to a hang). However, the biggest problem was how the identity of nodes in Replication Manager API had to be the same as hostname. When doing so, repmgr code used the hostname to bind instead of a wildcard socket. But when doing so, on any stock Fedora or RHEL system it would end listening on loopback only, because the
/etc/hostsaliased the hostname to loopback address. Thus running any replication required addition host configuration that can cause any kind of unexpected consequences. In addition it's impossible to run two nodes on one host for testing.This patch does away with the Replication Manager and uses Base API instead. This way, issues with host aliasing are addressed, and the state transitions occur much faster because there is no voting.
Note that the provision is added to run peers on the same host, using a configuration clause TDBRepName. I was unable to come up with a reliable way to make persistent, nonconflicting identifiers that would replace hostnames. Fortunately, this should only be used for build tests, where we probably can live with it.
The resulting replication feature was tested to work. Not sure if it is enough to trust it with one's data, but it's better than before.
Signed-off-by Pete Zaitcev <[email protected]>Quoted 15 lines
--- doc/etc.tabled.conf | 8 doc/setup.txt | 13 + include/tdb.h | 15 - lib/tdb.c | 130 ++++++------- server/Makefile.am | 2 server/bucket.c | 34 +-- server/cldu.c | 416 ++++++++++++++++++++++++++++++++++++------ server/config.c | 10 + server/object.c | 22 +- server/replica.c | 8 server/server.c | 404 ++++++++++++++++++++++++++++++++++++---- server/tabled.h | 97 +++++++++ server/tdbadm.c | 51 +---- 13 files changed, 963 insertions(+), 247 deletions(-)
Quoted 3 lines
Including
metarep.cwould be helpful ;-)Will wait on release for this...
Sorry!
Unfortunately this is getting a little behind, because I started working on the tests and they require some changes (e.g. the listening host and port may be unknown at the time MASTER file is locked).
--- doc/etc.tabled.conf | 8 doc/setup.txt | 13 include/tdb.h | 15 lib/tdb.c | 130 ++-- server/Makefile.am | 2 server/bucket.c | 34 - server/cldu.c | 416 ++++++++++++-- server/config.c | 10 server/metarep.c | 1245 ++++++++++++++++++++++++++++++++++++++++++ server/object.c | 22 server/replica.c | 8 server/server.c | 404 ++++++++++++- server/tabled.h | 97 +++ server/tdbadm.c | 51 - 14 files changed, 2208 insertions(+), 247 deletions(-)
doc/etc.tabled.conf +4 -4
@@ -13,12 +13,12 @@ <!-- 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. + ports do not conflict when you make boxes to host several groups or use + replication instances iwth TDBRepName. --> <Group>ultracart2</Group> -<TDB>/path/tabled/tdb</TDB> +<TDB>/path/tabled-uc2/</TDB> <!-- mkdir -p /path/tabled-uc2 --> +<!-- <TDBRepName>12345.my_local_node_name.example.com</TDBRepName> --> <TDBRepPort>8083</TDBRepPort> <!--
doc/setup.txt +12 -1
@@ -15,7 +15,9 @@ _cld._udp.phx2.ex.com has SRV record 10 50 8081 maika.phx2.ex.com. Also, make sure that your hostname has a domain. We don't want to search for CLD in the world-wide DNS root, do we? - Make sure CLD is up (run "cldcli" to verify). + Once you know that CLD is running, verify that tabled can talk to + it by running "cldcli". UDP traffic to be allowed for port 8081 or + other port as specified in the SRV record. *) 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
@@ -30,6 +32,10 @@ emus3 IN A 192.168.128.9 All examples on Google say FQDN is required, and most presume aliasing of A and AAAA records, but BIND 9 eats the above fine. +*) Speaking of FQDN, it is possible to force tabled to use a non-default + hostname with ForceHost tag. In practice this is only useful when + the DNS is broken. + *) Copy configuration file from doc/etc.tabled.conf to /etc/tabled.conf 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
@@ -53,6 +59,11 @@ emus3 IN A 192.168.128.9 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. +*) In each group, tabled uses its hostname to identify itself. However, + if you ever wish to run two tabled processes that serve the same group, + it can be accomplished by setting TDBRepName. N.B.: A loss of power for + the host will knock out all of them, so never use this in production. + *) Select the port to listen, if desired. This is done using the <Listen> element:
include/tdb.h +6 -9
@@ -109,15 +109,12 @@ struct tabledb {DB *oids;/* object ID db */ }; -struct db_remote {/* remotes for tdb_init */ -char *host; -unsigned short port; -}; - -extern int tdb_init (struct tabledb *tdb,const char *home,const char *pass, -unsigned int env_flags,const char *errpfx,bool do_syslog, -GList *remotes,char *rep_host,unsigned short rep_port, -void (*cb)(enum db_event )); +extern int tdb_init (struct tabledb *tdb,const char *db_home, +const char *db_password,const char *errpfx,bool do_syslog, +int rep_our_id, +int (*rep_send)(DB_ENV *dbenv,const DBT *ctl,const DBT *rec, +const DB_LSN *lsnp,int envid,uint32_t flags), +bool we_are_master,void (*cb)(enum db_event ));extern int tdb_up (struct tabledb *tdb,unsigned int open_flags);extern void tdb_down (struct tabledb *tdb);extern void tdb_fini (struct tabledb *tdb);
lib/tdb.c +69 -61
185 lines not on this page · raw message
server/Makefile.am +1 -1
@@ -4,7 +4,7 @@ INCLUDES = -I$(top_srcdir)/include @GLIB_CFLAGS@ @HAIL_CFLAGS@ sbin_PROGRAMS = tabled tdbadm tabled_SOURCES = tabled.h \ - bucket.c cldu.c config.c object.c replica.c \ + bucket.c cldu.c config.c metarep.c object.c replica.c \ server.c status.c storage.c storparse.c util.c tabled_LDADD = ../lib/libtdb.a \ @HAIL_LIBS@ @PCRE_LIBS@ @GLIB_LIBS@ \
server/bucket.c +17 -17
@@ -43,11 +43,11 @@ bool has_access(const char *user, const char *bucket, const char *key,size_t alloc_len, key_len =0 ;struct db_acl_key *acl_key;struct db_acl_ent *acl; -DB_ENV *dbenv = tdb.env; +DB_ENV *dbenv = tdbrep.tdb.env;DB_TXN *txn =NULL ;DBT pkey, pval;DBC *cur =NULL ; -DB *acls = tdb.acls; +DB *acls = tdbrep.tdb.acls;if (user ==NULL ) user =DB_ACL_ANON ;
@@ -132,7 +132,7 @@ err_out:static int add_access_user (DB_TXN *txn,const char *bucket,const char *key,const char *user,const char *perms) { -DB *acls = tdb.acls; +DB *acls = tdbrep.tdb.acls;int key_len;int acl_len;struct db_acl_ent *acl;
@@ -203,8 +203,8 @@ bool service_list(struct client *cli, const char *user)bool rcb;DB_TXN *txn =NULL ;DBC *cur =NULL ; -DB_ENV *dbenv = tdb.env; -DB *bidx = tdb.buckets_idx; +DB_ENV *dbenv = tdbrep.tdb.env; +DB *bidx = tdbrep.tdb.buckets_idx;DBT skey, pkey, pval; if (asprintf(&s,
@@ -348,7 +348,7 @@ bool bucket_valid(const char *bucket)static int bucket_find (DB_TXN *txn,const char *bucket,char *owner,int owner_len) { -DB *buckets = tdb.buckets; +DB *buckets = tdbrep.tdb.buckets;DBT key, val;struct db_bucket_ent ent;int rc;
@@ -455,9 +455,9 @@ bool bucket_add(struct client *cli, const char *user, const char *bucket)struct db_bucket_ent ent;bool setacl;/* is ok to put pre-existing bucket */ enum ReqACLC canacl; -DB *buckets = tdb.buckets; -DB *acls = tdb.acls; -DB_ENV *dbenv = tdb.env; +DB *buckets = tdbrep.tdb.buckets; +DB *acls = tdbrep.tdb.acls; +DB_ENV *dbenv = tdbrep.tdb.env;DB_TXN *txn =NULL ;DBT key, val;
@@ -589,11 +589,11 @@ bool bucket_del(struct client *cli, const char *user, const char *bucket)enum errcode err = InternalError;int rc;struct db_bucket_ent ent; -DB_ENV *dbenv = tdb.env; +DB_ENV *dbenv = tdbrep.tdb.env;DB_TXN *txn =NULL ; -DB *buckets = tdb.buckets; -DB *acls = tdb.acls; -DB *objs = tdb.objs; +DB *buckets = tdbrep.tdb.buckets; +DB *acls = tdbrep.tdb.acls; +DB *objs = tdbrep.tdb.objs;DBC *cur =NULL ;DBT key, val;char structbuf[sizeof (struct db_acl_key ) +32 ];
@@ -922,9 +922,9 @@ static bool bucket_list_keys(struct client *cli, const char *user,size_t pfx_len;struct bucket_list_info bli;bool rcb; -DB_ENV *dbenv = tdb.env; +DB_ENV *dbenv = tdbrep.tdb.env;DB_TXN *txn =NULL ; -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;DBC *cur =NULL ;DBT pkey, pval;struct db_obj_key *obj_key;
@@ -1159,8 +1159,8 @@ bool access_list(struct client *cli, const char *bucket, const char *key,GHashTable *param;enum errcode err = InternalError; -DB_ENV *dbenv = tdb.env; -DB *acls = tdb.acls; +DB_ENV *dbenv = tdbrep.tdb.env; +DB *acls = tdbrep.tdb.acls;int alloc_len;char owner[64 ];GList *res;
server/cldu.c +366 -50
569 lines not on this page · raw message
server/config.c +10 -0
@@ -224,6 +224,16 @@ static void cfg_elm_end (GMarkupParseContext *context, cc->text =NULL ; } +else if (!strcmp (element_name,"TDBRepName" )) { +if (!cc->text) { +applog (LOG_WARNING ,"TDBRepName element empty" ); +return ; + } +free (tabled_srv.rep_name); + tabled_srv.rep_name = cc->text; + cc->text =NULL ; + } +else if (!strcmp (element_name,"StatusPort" )) {if (!cc->text) {applog (LOG_WARNING ,"StatusPort element empty" );
server/metarep.c new file +1245 -0
1,245 lines not on this page · raw message
server/object.c +11 -11
@@ -39,7 +39,7 @@static int object_find (DB_TXN *txn,const char *bucket,const char *key,struct db_obj_ent *pobj) { -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;struct db_obj_key *okey;size_t alloc_len;DBT pkey, pval;
@@ -72,7 +72,7 @@ static int object_find(DB_TXN *txn, const char *bucket, const char *key,static bool __object_del (DB_TXN *txn,const char *bucket,const char *key) { -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;struct db_obj_key *okey;size_t okey_len;DBT pkey;
@@ -100,7 +100,7 @@ static bool __object_del(DB_TXN *txn, const char *bucket, const char *key)bool object_del_acls (DB_TXN *txn,const char *bucket,const char *key) { -DB *acls = tdb.acls; +DB *acls = tdbrep.tdb.acls;struct db_acl_key *akey;size_t alloc_len;DBT pkey;
@@ -163,8 +163,8 @@ bool object_del(struct client *cli, const char *user,int rc;enum errcode err = InternalError;size_t alloc_len; -DB_ENV *dbenv = tdb.env; -DB *objs = tdb.objs; +DB_ENV *dbenv = tdbrep.tdb.env; +DB *objs = tdbrep.tdb.objs;struct db_obj_key *okey;struct db_obj_ent obje;DBT pkey, pval;
@@ -326,9 +326,9 @@ static bool object_put_end(struct client *cli)struct db_obj_ent oldobj;bool delobj;size_t alloc_len; -DB_ENV *dbenv = tdb.env; +DB_ENV *dbenv = tdbrep.tdb.env;DBT pkey, pval; -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;DB_TXN *txn =NULL ;GByteArray *string_data;GArray *string_lens;
@@ -786,7 +786,7 @@ static bool object_put_body(struct client *cli, const char *user,return cli_err (cli, InternalError); } - objid =objid_next (&tabled_srv.object_count, &tdb); + objid =objid_next (&tabled_srv.object_count, &tdbrep.tdb); rc =open_chunks (&cli->out_ch, &tabled_srv.all_stor, cli, objid, content_len);
@@ -865,9 +865,9 @@ static bool object_put_acls(struct client *cli, const char *user, {enum errcode err = InternalError;enum ReqACLC canacl; -DB_ENV *dbenv = tdb.env; +DB_ENV *dbenv = tdbrep.tdb.env;DB_TXN *txn =NULL ; -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;char *hdr;char timestr[64 ];int rc;
@@ -1130,7 +1130,7 @@ static bool object_get_body(struct client *cli, const char *user,bool access_ok, modified = true;GString *extra_hdr;size_t alloc_len; -DB *objs = tdb.objs; +DB *objs = tdbrep.tdb.objs;struct db_obj_key *okey;struct db_obj_ent *obj =NULL ;DBT pkey, pval;
server/replica.c +4 -4
@@ -612,8 +612,8 @@ static void rep_scan_verify(struct rep_arg *arg,static void rep_add_nid (unsigned int klen,struct db_obj_key *key,uint32_t nid) { -DB_ENV *db_env = tdb.env; -DB *db_objs = tdb.objs; +DB_ENV *db_env = tdbrep.tdb.env; +DB *db_objs = tdbrep.tdb.objs;DB_TXN *db_txn;DBT pkey, pval;struct db_obj_ent *obj;
@@ -749,8 +749,8 @@ static void rep_scan(struct rep_arg *arg)g_mutex_unlock (kscan_mutex);memset (&cur,0 ,sizeof (struct cursor ));/* enough to construct */ - cur.db_env = tdb.env; - cur.db_objs = tdb.objs; + cur.db_env = tdbrep.tdb.env; + cur.db_objs = tdbrep.tdb.objs; kcnt =0 ;for (;;) {
server/server.c +357 -47
570 lines not on this page · raw message
server/tabled.h +94 -3
160 lines not on this page · raw message
server/tdbadm.c +12 -39
51 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 3 lines · Pete Zaitcev
Unfortunately this is getting a little behind, because I started working on the tests and they require some changes (e.g. the listening host and port may be unknown at the time MASTER file is locked).
What does that mean -- I just applied the patch, should I wait for further updates before rolling a tarball?
Jeff
Quoted 8 lines · On Tue, 10 Aug 2010 18:43:37 -0400 Jeff Garzik <[email protected]> wrote:
Quoted 3 lines · Pete Zaitcev
Unfortunately this is getting a little behind, because I started working on the tests and they require some changes (e.g. the listening host and port may be unknown at the time MASTER file is locked).
What does that mean -- I just applied the patch, should I wait for further updates before rolling a tarball?
No, please don't. It's going to take all of today and probably tomorrow too... Perhaps even more.
I meant to say, if you would not take this, I'll have updates soon. But with "git pull" it really does not matter to me, I can easily base any new patches on the current origin HEAD.
-- Pete