Re: [PATCH] chunkd: add cp command, for local intra-table copies
On Tue, 6 Jul 2010 03:24:29 -0400 Jeff Garzik j...@garzik.org wrote: The following patch, against current hail.git, adds the CP command to chunkd, permitting copying from object-object inside a single table. What is it for? -- Pete -- To unsubscribe from this list: send the line unsubscribe hail-devel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] chunkd: add cp command, for local intra-table copies
On 07/06/2010 11:17 AM, Pete Zaitcev wrote: On Tue, 6 Jul 2010 03:24:29 -0400 Jeff Garzikj...@garzik.org wrote: The following patch, against current hail.git, adds the CP command to chunkd, permitting copying from object-object inside a single table. What is it for? Fun! :) More seriously, it is mainly an infrastructure patch, adding things that the upcoming RCP command will use. As CP is far less complex, this allows me to verify several bits of machinery before moving forward. I imagine CP will be tangentially helpful, but not a crucial feature in and of itself. Jeff -- To unsubscribe from this list: send the line unsubscribe hail-devel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] chunkd: add cp command, for local intra-table copies
On 07/06/2010 11:17 AM, Pete Zaitcev wrote: On Tue, 6 Jul 2010 03:24:29 -0400 Jeff Garzikj...@garzik.org wrote: The following patch, against current hail.git, adds the CP command to chunkd, permitting copying from object-object inside a single table. What is it for? Here's a real-world example. Quoting from the S3 documentation, this describes the PUT (copy) operation, something that tabled does not yet support, but should: This implementation of the PUT operation creates a copy of an object that is already stored in Amazon S3. A PUT copy operation is the same as performing a GET and then a PUT. Adding the request header, x-amz-copy-source, makes the PUT operation copy the source object into the destination bucket. Assuming that a given tabled object is already fully replicated -- HOPEFULLY the common case for us -- the least expensive way to implement this is for each chunkd containing object OLD_KEY CHO_CP(object OLD_KEY - object NEW_KEY) Assuming each chunkd node has the necessary free space, this method totally avoids using network bandwidth, when creating a copy of an object Jeff -- To unsubscribe from this list: send the line unsubscribe hail-devel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
tabled: Some Amazon S3 features to consider
Here are a few interesting things that have appeared in the S3 API since its initial release: 1) Object versioning. All objects now uniquely identified by (key, version) pair. API compatibility is maintained by supporting the notion of current version. 2) Object copying. Rather than an expensive S3-client-S3 round-trip, you may supply the x-amz-copy-source header to the PUT operation, causing S3 to use an existing object's data as the source for the PUT. 3) Reduced redundancy. x-amz-storage-class header may used to specify normal durability (STANDARD) or reduced durability (REDUCED_REDUNDANCY). 4) Regions (localization). Bucket locations may be set. Project Hail services have some notion of location as well. See if we can match up the two... 5) POST HTTP method. POST is like PUT, but can be used directly from a browser. -- To unsubscribe from this list: send the line unsubscribe hail-devel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] chunk: add CP operation
This patch * adds local, intra-table copy operation to chunkd/libhail * illustrates what files need updating, when adding a new op to chunk * adds some 'worker' infrastructure which should help with future ops, notably remote copy (RCP) * should assist tabled's implementation of S3 copy (x-amz-copy-source) chunkd/chunkd.h | 19 +++ chunkd/object.c | 117 ++ chunkd/server.c | 122 doc/chcli.8 | 13 - include/chunk_msg.h |2 include/chunkc.h| 10 +++ lib/chunkdc.c | 56 ++ test/chunkd/Makefile.am |5 + tools/chcli.c | 77 ++ 9 files changed, 409 insertions(+), 12 deletions(-) diff --git a/chunkd/chunkd.h b/chunkd/chunkd.h index e019f0d..5d39353 100644 --- a/chunkd/chunkd.h +++ b/chunkd/chunkd.h @@ -104,6 +104,8 @@ struct client { unsigned intreq_used; /* amount of req_buf in use */ void*req_ptr; /* start of unexamined data */ uint16_tkey_len; + unsigned intvar_len;/* len of vari len record */ + boolsecond_var; /* inside 2nd vari len rec? */ char*hdr_start; /* current hdr start */ char*hdr_end; /* current hdr end (so far) */ @@ -124,6 +126,7 @@ struct client { charnetbuf_out[CLI_DATA_BUF_SZ]; charkey[CHD_KEY_SZ]; chartable[CHD_KEY_SZ]; + charkey2[CHD_KEY_SZ]; }; struct backend_obj { @@ -162,6 +165,14 @@ struct volume_entry { char*owner; /* obj owner username */ }; +struct worker_info { + enum chunk_errcode err;/* error returned to pipe */ + struct client *cli; /* associated client conn */ + + void(*thr_ev)(struct worker_info *); + void(*pipe_ev)(struct worker_info *); +}; + struct server_stats { unsigned long poll; /* number polls */ unsigned long event; /* events dispatched */ @@ -209,6 +220,10 @@ struct server { GHashTable *fd_info; + GThreadPool *workers; /* global thread worker pool */ + int max_workers; + int worker_pipe[2]; + struct list_headwr_trash; unsigned inttrash_sz; @@ -278,6 +293,7 @@ extern int fs_obj_do_sum(const char *fn, unsigned int klen, char **csump); extern bool object_del(struct client *cli); extern bool object_put(struct client *cli); extern bool object_get(struct client *cli, bool want_body); +extern bool object_cp(struct client *cli); extern bool cli_evt_data_in(struct client *cli, unsigned int events); extern void cli_out_end(struct client *cli); extern void cli_in_end(struct client *cli); @@ -314,12 +330,15 @@ extern bool cli_err(struct client *cli, enum chunk_errcode code, bool recycle_ok extern int cli_writeq(struct client *cli, const void *buf, unsigned int buflen, cli_write_func cb, void *cb_data); extern bool cli_wr_sendfile(struct client *, cli_write_func); +extern bool cli_rd_set_poll(struct client *cli, bool readable); extern void cli_wr_set_poll(struct client *cli, bool writable); extern bool cli_cb_free(struct client *cli, struct client_write *wr, bool done); extern bool cli_write_start(struct client *cli); extern int cli_req_avail(struct client *cli); extern int cli_poll_mod(struct client *cli); +extern bool worker_pipe_signal(struct worker_info *wi); +extern bool tcp_cli_event(int fd, short events, void *userdata); extern void resp_init_req(struct chunksrv_resp *resp, const struct chunksrv_req *req); diff --git a/chunkd/object.c b/chunkd/object.c index 116792f..af187b6 100644 --- a/chunkd/object.c +++ b/chunkd/object.c @@ -25,6 +25,7 @@ #include unistd.h #include string.h #include errno.h +#include poll.h #include stdio.h #include syslog.h #include glib.h @@ -356,3 +357,119 @@ start_write: return cli_write_start(cli); } +static void worker_cp_thr(struct worker_info *wi) +{ + static const unsigned bufsz = (1 * 1024 * 1024); + void *buf = NULL; + struct client *cli = wi-cli; + struct backend_obj *obj = NULL, *out_obj = NULL; + enum chunk_errcode err = che_InternalError; + unsigned char md[SHA_DIGEST_LENGTH]; + char hashstr[50]; + + buf = malloc(bufsz); + if (!buf) + goto out; + + cli-in_obj = obj = fs_obj_open(cli-table_id, cli-user, cli-key2, + cli-var_len, err); + if
stor_obj_test
This function seems to be missing the meat. It retrieves then disposes of a keylist. bool stor_obj_test(struct open_chunk *cep, uint64_t key) { struct st_keylist *klist; if (!cep-stc) return false; klist = stc_keys(cep-stc); if (!klist) return false; stc_free_keylist(klist); return true; } -- To unsubscribe from this list: send the line unsubscribe hail-devel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
chunkd on-disk and network protocol format change
The following commit introduces an incompatible chunkd change, which breaks compatibility with (a) existing on-disk chunkd databases, and (b) existing chunkd network protocol entities. Prior to commit ea5d20bc22aeed077312c9c1824e84651af17a16, chunkd stored SHA1 checksums as ASCII, and sent them across the wire in each message in ASCII. Converting these to directly store and use SHA1 binary checksums on-disk saves several memory allocations, and more importantly, shaves 44 bytes off each chunkd message. ASCII is only needed in the XML-based list-objects output, so we only perform the conversion at list-objects time. Jeff commit ea5d20bc22aeed077312c9c1824e84651af17a16 Author: Jeff Garzik j...@garzik.org Date: Wed Jul 7 00:51:48 2010 -0400 [chunk] protocol, disk fmt: Replace ASCII checksum representation with binary Rather than converting SHA1 checksums back and forth between ASCII and binary, always store and compare binary checksums. Only convert to ASCII when performing a list-objects request, which requires XML output. Among other savings, this decreases the size of the per-message fixed-length header by 44 bytes. Signed-off-by: Jeff Garzik jgar...@redhat.com chunkd/be-fs.c | 47 +++ chunkd/chunkd.h| 9 + chunkd/object.c| 14 -- chunkd/selfcheck.c | 19 +++ include/chunk_msg.h| 4 ++-- 5 files changed, 37 insertions(+), 56 deletions(-) -- To unsubscribe from this list: send the line unsubscribe hail-devel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html