[PATCH] Allow local fallback when metadata DB unavailable

Jim Meyering jim at meyering.net
Tue Oct 12 12:43:06 UTC 2010


Jeff Darcy wrote:
> A lof of changes here, but most should be fairly non-controversial.
> Pete, I took the liberty of fixing up some things in your init-handshake
> code.  In particular, by using cons_init_done and cons_init_error a
> collision with use of the same fields in the regular data handshake is
> avoided, and the need for a separate in_init field goes away as well.
> The result passes regular tests, and valgrind shows no new leaks in the
> affected object-GET cases (both present and absent), but I still need to
> add a new test.  Having different tests require different server
> configurations is a pain.  Would anybody object if I tweaked "basic" to
> start mongo later or kill it earlier, so I can put the no-mongo test(s)
> in the space between?

That would be fine.  Or just add a new no-mongo test script.
It might be simpler to segregate those.

> [PATCH 1/2] Allow simple GETs without metadata access.
> First stage: meta.cpp functions handle lack of connection better.
>
> [PATCH 2/2] Improve behavior in no-metadata-access cases.
> Stage 2: proxy_get_data actually does "the right thing" and we now have
> a producer/consumer handshake for the GET direction as well as PUT.
>
> Subject: [PATCH 2/2] Improve behavior in no-metadata-access cases.
>
> Stage 2: proxy_get_data actually does "the right thing" and we now have
> a producer/consumer handshake for the GET direction as well as PUT.
> ---
>  backend.c |   13 ++++++++++-
>  mpipe.c   |   66 ++++++++++++++++++++++++++++++++++++++++++------------------
>  mpipe.h   |    6 ++++-
>  rest.c    |    9 ++++++-
>  4 files changed, 69 insertions(+), 25 deletions(-)

Those changes look fine.  I confirmed that
tests still pass with no new leaks, however did note that
there's a small preexisting parser-related leak, noted below.

I see you've already switched to indenting with spaces.  Good! ;-)
Don't sweat the fact that now indentation would be mixed, assuming
I'll be able to do the wholesale reformat soon.

> diff --git a/backend.c b/backend.c
> index e1009db..1ad376a 100644
> --- a/backend.c
> +++ b/backend.c
> @@ -86,9 +86,10 @@ bad_init (void)
>  void *
>  bad_get_child (void * ctx)
>  {
> -	(void)ctx;
> +        my_state        *ms     = (my_state *)ctx;
>
>  	DPRINTF("*** bad call to %s\n",__func__);
> +        pipe_prod_siginit(&ms->pipe,-1);
>  	return NULL;
>  }
>
> @@ -223,6 +224,9 @@ s3_get_child (void * ctx)
>  {
>  	my_state	*ms	= ctx;
>
> +        /* TBD: check existence before calling siginit */
> +        pipe_prod_siginit(&ms->pipe,0);
> +
>  	hstor_get(hstor,ms->bucket,ms->key,http_get_prod,&ms->pipe,0);
>  	/* TBD: check return value */

Hardly a big deal, for now:

==13987== 9 bytes in 2 blocks are definitely lost in loss record 59 of 370
==13987==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
==13987==    by 0x31BA87FD51: strdup (strdup.c:43)
==13987==    by 0x41A48E: RepoMeta::GetValue(char const*, char const*, char const
*, char**) (meta.cpp:377)
==13987==    by 0x41A6D7: meta_get_value (meta.cpp:388)
==13987==    by 0x422DF0: repl_oget (proxy.c:825)
==13987==    by 0x4262CC: compare (query.c:283)
==13987==    by 0x422BB8: replicate (proxy.c:881)
==13987==    by 0x428CEE: recheck_replication.clone.0 (rest.c:410)
==13987==    by 0x4295AD: proxy_put_attr (rest.c:663)
==13987==    by 0x4E3BB38: ??? (in /usr/lib64/libmicrohttpd.so.5.2.1)
==13987==    by 0x4E3CD27: ??? (in /usr/lib64/libmicrohttpd.so.5.2.1)
==13987==    by 0x4E3F9F9: ??? (in /usr/lib64/libmicrohttpd.so.5.2.1)
==13987==    by 0x31BB407760: start_thread (pthread_create.c:301)
==13987==    by 0x31BA8E151C: clone (clone.S:115)
==13987==
==13987== 9 bytes in 2 blocks are definitely lost in loss record 60 of 370
==13987==    at 0x4A0515D: malloc (vg_replace_malloc.c:195)
==13987==    by 0x31BA87FD51: strdup (strdup.c:43)
==13987==    by 0x41A48E: RepoMeta::GetValue(char const*, char const*, char const*, char**) (meta.cpp:377)
==13987==    by 0x41A6D7: meta_get_value (meta.cpp:388)
==13987==    by 0x422DF0: repl_oget (proxy.c:825)
==13987==    by 0x4262CC: compare (query.c:283)
==13987==    by 0x422BB8: replicate (proxy.c:881)
==13987==    by 0x428CEE: recheck_replication.clone.0 (rest.c:410)
==13987==    by 0x429083: proxy_put_data (rest.c:532)
==13987==    by 0x4E3BB38: ??? (in /usr/lib64/libmicrohttpd.so.5.2.1)
==13987==    by 0x4E3CD27: ??? (in /usr/lib64/libmicrohttpd.so.5.2.1)
==13987==    by 0x4E3F9F9: ??? (in /usr/lib64/libmicrohttpd.so.5.2.1)
==13987==    by 0x31BB407760: start_thread (pthread_create.c:301)
==13987==    by 0x31BA8E151C: clone (clone.S:115)


More information about the iwhd-devel mailing list