[sheepdog] [PATCH v3 0/6] create onode before uploading object completed

Liu Yuan namei.unix at gmail.com
Tue Feb 25 10:52:14 CET 2014


On Tue, Feb 25, 2014 at 03:59:25PM +0800, Robin Dong wrote:
> From: Robin Dong <sanbai at taobao.com>
> 
> At present, the implemention of swift interface for creating object in sheepdog
> is:
> 
> 1. lock container
> 2. check whether the onode with same object name is exists.
> 3. unlock container
> 4. upload object
> 5. create onode
> 
> this sequence have a problem: if two clients uploading same objects
> concurrently, it will create two objects with same names in container.
> To avoid duplicated names, we must put "create onode" operation in container
> lock regions.
> 
> Therefore we need to change the processes of creating object to:
> 
> 1. lock container
> 2. check whether the onode is exists.
> 3. allocate data space for object, and create onode, then write it done
> 4. unlock container
> 5. upload object
> 
> this routine will avoid uploading duplicated objects.
> 
> There is an exception on the new routine: if the client halt the uploading
> progress, we will have a "uploading incompleted" onode.
> 
> The solution is: we can add code for onode to identify its status.
> A new onode will be set to "INIT", and after uploading completed, the onode will
> be set to  "COMPLETED". So, when users try to use swift interface to GET a
> "incompleted" object, sheep will find out the onode is "INIT" which means
> "not completed", so sheep will return "partial content"for http request, and
> user could DELETE the object and upload it again.
> 

...
Built sheep
http/kv.c: In function ‘onode_populate_extents’:
http/kv.c:702:11: warning: variable ‘count’ set but not used [-Wunused-but-set-variable]
  uint64_t count = onode->o_extent[0].count;
           ^
http/kv.c: In function ‘kv_create_object’:
http/kv.c:782:6: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (ret != SD_RES_SUCCESS)
      ^
http/kv.c:705:6: note: ‘ret’ was declared here
  int ret;
      ^
...

Got this compile warning.

Thanks
Yuan



More information about the sheepdog mailing list