[sheepdog] read/write during recovery

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Jul 24 18:41:31 CEST 2012


At Tue, 24 Jul 2012 12:15:29 +0000,
Dietmar Maurer wrote:
> 
> > On 07/24/2012 03:48 PM, Dietmar Maurer wrote:
> > > Why do you think so? It basically make things easier, and just remove
> > > lines of code.
> > 
> > It is just my estimation, I'd like to see real code.
> 
> I think we can reject requests until we really start recovering an object, because
> the data is stored on the other nodes anyways.
> 
> I have to say that I still not fully understand all code, so please forgive me if I post 
> nonsense ;-)
> 
> My naïve patch looks like this (can be optimized further):

IIUC, your patch does not handle write requests because write
journaling is not implemented yet, yes?  I think it is not easy to
implement journaling across nodes.  Do you have any ideas to implement
it simply?

Thanks,

Kazutaka


> 
> From 0972d52d7a86cd2a265ae2a91592c36e853e7436 Mon Sep 17 00:00:00 2001
> From: Dietmar Maurer <dietmar at proxmox.com>
> Date: Tue, 24 Jul 2012 13:17:47 +0200
> Subject: [PATCH] only queue commands when necessary
> 
> We do not need to queue commands until we start recovering a specific object.
> 
> Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
> ---
>  sheep/recovery.c   |   13 ++++++++++---
>  sheep/request.c    |    2 +-
>  sheep/sheep_priv.h |    2 +-
>  3 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/sheep/recovery.c b/sheep/recovery.c
> index dd17edd..f2e2688 100644
> --- a/sheep/recovery.c
> +++ b/sheep/recovery.c
> @@ -242,11 +242,18 @@ int node_in_recovery(void)
>  	return !!recovering_work;
>  }
>  
> -int is_recovery_init(void)
> +int is_recovery_init(uint64_t oid)
>  {
>  	struct recovery_work *rw = recovering_work;
>  
> -	return rw->state == RW_INIT;
> +	if (rw->state == RW_INIT)
> +		return 1;
> +
> +	/* The oid is currently being recovered */
> +	if (rw->oids[rw->done] == oid)
> +		return 0;
> +
> +	return 1;
>  }
>  
>  static inline void prepare_schedule_oid(uint64_t oid)
> @@ -312,7 +319,7 @@ bool oid_in_recovery(uint64_t oid)
>  		return false;
>  	}
>  
> -	prepare_schedule_oid(oid);
> +	//prepare_schedule_oid(oid);
>  	return true;
>  }
>  
> diff --git a/sheep/request.c b/sheep/request.c
> index 0fa5795..3865d4a 100644
> --- a/sheep/request.c
> +++ b/sheep/request.c
> @@ -150,7 +150,7 @@ static bool request_in_recovery(struct request *req)
>  		/*
>  		 * Put request on wait queues of local node
>  		 */
> -		if (is_recovery_init()) {
> +		if (is_recovery_init(req->local_oid)) {
>  			req->rp.result = SD_RES_OBJ_RECOVERING;
>  			list_add_tail(&req->request_list,
>  				      &sys->wait_rw_queue);
> diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
> index e455d27..abebc69 100644
> --- a/sheep/sheep_priv.h
> +++ b/sheep/sheep_priv.h
> @@ -260,7 +260,7 @@ int start_recovery(struct vnode_info *cur_vnodes,
>  	struct vnode_info *old_vnodes);
>  void resume_recovery_work(void);
>  bool oid_in_recovery(uint64_t oid);
> -int is_recovery_init(void);
> +int is_recovery_init(uint64_t oid);
>  int node_in_recovery(void);
>  
>  int write_object(uint64_t oid, char *data, unsigned int datalen,
> -- 
> 1.7.2.5
> 
> 
> 



More information about the sheepdog mailing list