At Thu, 12 Jul 2012 09:55:27 +0800, levin li wrote: > > On 2012年07月12日 06:01, MORITA Kazutaka wrote: > > At Wed, 11 Jul 2012 14:42:47 +0800, > > levin li wrote: > >> > >> From: levin li <xingke.lwp at taobao.com> > >> > >> Before reclaiming the cache belonging to the VDI just deleted, we should test > >> whether the VDI is exist, because after some node delete it and before the > >> notification is sent to all the node, another node may issus a VDI creation > >> event and reused the VDI id again, in which case we should reclaim the cached > >> entry. > > > > Should this be explained in the source code where vdi_exist() is > > called? How do you think about this? > > I'm still a bit confused why we need both objlist_cache_delete and > > objlist_cache_remove. If no recovery happens during object deletion, > > we don't need objlist_cache_delete because objlist_cache_remove > > removes the entry. objlist_cache_delete is necessary for the case > > object deletion and recovery happen at the same time to clean up > > unhandled entries by objlist_cache_remove. Is it correct? > > > > > Well, if no recovery happens before, objlist_cache_remove() can always > delete the entry in object list cache while VDI deletion, but once recovery > happens, it's something different. > > For example, obj A and B stay in node n1 at first, but after a recovery, > A may be migrated from n1 to n2, and B stays in n1, but the objlist entry Is there any reason we don't remove the objlist entry when we unlink the object from the farm working directory? diff --git a/sheep/farm/trunk.c b/sheep/farm/trunk.c index b45427d..e390a63 100644 --- a/sheep/farm/trunk.c +++ b/sheep/farm/trunk.c @@ -297,6 +297,7 @@ int trunk_file_write_recovery(unsigned char *outsha1) goto out; } dprintf("remove file %"PRIx64"\n", entry->raw.oid); + objlist_cache_remove(oid); put_entry(entry); } } Recovery algorithm has been changed from before, so probably I'm missing something. Correct me if I'm wrong. Anyway, the function names (objlist_cache_remove/delete) looks too confusing. IIUC, objlist_cache_remove() is used when removing caches after processing SD_OP_READ_PEER requests, and objlist_cache_delete() is used to cleanup caches associated with removed objects after vdi deletion is finished. Can we use more descriptive names? Thanks, Kazutaka |