[Sheepdog] [PATCH v6 7/8] collie: read the cached objects if any for collie operation
morita.kazutaka at gmail.com
Fri Mar 30 18:25:18 CEST 2012
At Mon, 26 Mar 2012 21:48:29 +0800,
Liu Yuan wrote:
> From: Liu Yuan <tailai.ly at taobao.com>
> Collie operation such 'vdi list' or 'vdi object' need to read the lateset
> VDI object, it might be cached in the object cache. We can't pass
> SD_FLAG_CMD_CACHE to sheep because collie doesn't know if the cache mode is
> So we rely on the assumption that the cached object is freshest.
> Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
> sheep/store.c | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
> diff --git a/sheep/store.c b/sheep/store.c
> index c192aeb..4d84350 100644
> --- a/sheep/store.c
> +++ b/sheep/store.c
> @@ -784,6 +784,14 @@ static int bypass_object_cache(struct sd_obj_req *hdr)
> uint64_t oid = hdr->oid;
> + /*
> + * We assume the cached object is freshest, donot break it ever.
> + * This assumption is useful for non-cache requests from collie,
> + * which tries hard to get the newest data.
> + */
> + if (object_is_cached(oid))
> + return 0;
This fix is still wrong because writethrough requests aren't flushed
before sending response if we return 0 here.
I think we need to flush and remove a cache here when
SD_FLAG_CMD_CACHE is not set.
> if (!(hdr->flags & SD_FLAG_CMD_CACHE))
> return 1;
> sheepdog mailing list
> sheepdog at lists.wpkg.org
More information about the sheepdog