Re: [patch tabled 6/8] Add filesystem back-end

2010-12-13 Thread Jeff Garzik

On 11/28/2010 08:41 PM, Pete Zaitcev wrote:

This patch adds the first new back-end and makes some changes to the way
nodes are added, to make the invariants of storage_node more sensible.

The filesystem back-end itself is not intended for production use,
so it makes no attempt to run any asynchronous transfers.

We also add a test. Note that this differs from the preliminary versions
of this patch. We used to add both chunk and fs back-ends, so that tabled
replicates to both. This makes sense as a test of store path, but on
retrieval tabled selects any one of available storage nodes with the
object, randomly. It creates gaps in test coverage in any given run.
Therefore, we test two back-end types sequentially now.

Signed-off-by: Pete Zaitcevzait...@redhat.com

---
  server/Makefile.am   |2
  server/stor_chunk.c  |   21 -
  server/stor_fs.c |  498 +
  server/storage.c |  157 ++--
  server/storparse.c   |   97 +++
  server/tabled.h  |   31 ++
  test/Makefile.am |3
  test/be_fs-test.conf |5
  test/combo-redux |   74 ++
  test/prep-db |4
  test/start-daemon|1
  test/stop-daemon |9
  12 files changed, 835 insertions(+), 67 deletions(-)

commit bccedeedabbe713e4053afa185314b3f57f3d204
Author: Pete Zaitcevzait...@yahoo.com
Date:   Sun Nov 28 17:58:05 2010 -0700

 Add fs back-end, with a test.

diff --git a/server/Makefile.am b/server/Makefile.am
index 52beec4..71bcb35 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -6,7 +6,7 @@ sbin_PROGRAMS   = tabled tdbadm
  tabled_SOURCES= tabled.h  \
  bucket.c cldu.c config.c metarep.c object.c replica.c \
  server.c status.c storage.c storparse.c \
- stor_chunk.c util.c
+ stor_chunk.c stor_fs.c util.c
  tabled_LDADD  = ../lib/libtdb.a   \
  @HAIL_LIBS@ @PCRE_LIBS@ @GLIB_LIBS@ \
  @CRYPTO_LIBS@ @DB4_LIBS@ @EVENT_LIBS@ @SSL_LIBS@
diff --git a/server/stor_chunk.c b/server/stor_chunk.c
index 815adcf..7462a9c 100644
--- a/server/stor_chunk.c
+++ b/server/stor_chunk.c
@@ -31,8 +31,7 @@
  #includenetdb.h
  #include tabled.h

-static const char stor_key_fmt[] = %016llx;
-#define STOR_KEY_SLEN  16
+static const char stor_key_fmt[] = STOR_KEY_FMT;

  static int stor_new_stc(struct storage_node *stn, struct st_client **stcp)
  {
@@ -66,24 +65,6 @@ static int stor_new_stc(struct storage_node *stn, struct 
st_client **stcp)
return 0;
  }

-static void stor_read_event(int fd, short events, void *userdata)
-{
-   struct open_chunk *cep = userdata;
-
-   cep-r_armed = false;/* no EV_PERSIST */
-   if (cep-ocb)
-   (*cep-ocb)(cep);
-}
-
-static void stor_write_event(int fd, short events, void *userdata)
-{
-   struct open_chunk *cep = userdata;
-
-   cep-w_armed = false;/* no EV_PERSIST */
-   if (cep-ocb)
-   (*cep-ocb)(cep);
-}
-
  /*
   * Open *cep using stn, set up chunk session if needed.
   */
diff --git a/server/stor_fs.c b/server/stor_fs.c
new file mode 100644
index 000..b433a67
--- /dev/null
+++ b/server/stor_fs.c
@@ -0,0 +1,498 @@
+
+/*
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#define _GNU_SOURCE
+#include tabled-config.h
+
+#includesys/types.h
+#includesys/stat.h
+#includeerrno.h
+#includefcntl.h
+#includesyslog.h
+#includestring.h
+#includeglib.h
+#includeevent.h
+#include tabled.h
+
+static const char stor_key_fmt[] = STOR_KEY_FMT;
+
+static char *fs_obj_pathname(const char *base, uint64_t key)
+{
+   enum { PREFIX_LEN = 3 };
+   char prefix[PREFIX_LEN + 1];
+   char stckey[STOR_KEY_SLEN+1];
+   char *s;
+   int rc;
+
+   /* we know that stckey is going to be longer than PREFIX_LEN */
+   sprintf(stckey, stor_key_fmt, (unsigned long long) key);
+   memcpy(prefix, stckey, PREFIX_LEN);
+   prefix[PREFIX_LEN] = 0;
+
+   rc = asprintf(s, %s/%s/%s, base, prefix, stckey + PREFIX_LEN);
+   if (rc  0)
+   goto err_out;
+
+   return s;
+
+err_out:
+   return NULL;
+}
+
+static char *fs_ctl_pathname(const char *base, const char *file)
+{
+   char *s;
+   int rc;
+
+   rc = asprintf(s, %s/%s, base, file);
+   if 

Re: [patch tabled 8/8] Add Swift back-end

2010-12-13 Thread Jeff Garzik

On 11/28/2010 08:41 PM, Pete Zaitcev wrote:

This patch allows to use tabled with OpenStack Swift object store as if it
were our chunkserver, with some extra tricks. The configuration has to be
entred manually into CLD, just like in case of filesystem back-end.

The code is fairly experimental, so it retains extra messages.

Also, since Swift authorizes by plaintext passwords, support for SSL is
essential, but is currently missing.

There is no build-time test for this, because it would require us to
depend on OpenStack, which is untenable.

Signed-off-by: Pete Zaitcevzait...@redhat.com


applied patches 6-8.  well done, this is a milestone for tabled!


--
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 tabled 6/8] Add filesystem back-end

2010-12-13 Thread Pete Zaitcev
On Mon, 13 Dec 2010 16:30:59 -0500
Jeff Garzik j...@garzik.org wrote:

 Current chunkd intentionally prevents two random users from put'ing the 
 same object.  The FS backend should do the same.

Ouch, I completely forgot about it. Back then I hoped the DB4
transaction would do the job, but perhaps not.

-- 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