[sheepdog] [PATCH 1/2] sheep:fix automatic stale object purging
wangfan
wangfan1985 at gmail.com
Sat Mar 16 09:43:33 CET 2013
If sheep process have differert disk size,after recovery. ./stale directory
still have objects.because in the cluster_recovery_completion function,
the memcmp function parameter vnode_info->nodes and recovereds will have
different nr_vnodes number after recovery completion.so i just compare
node_id to fix this problem.
Signed-off-by: wangfan <wangfan1985 at gmail.com>
---
sheep/ops.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/sheep/ops.c b/sheep/ops.c
index b9634ae..2bfd6c7 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -626,12 +626,18 @@ static int cluster_recovery_completion(const struct sd_req *req,
vnode_info = get_vnode_info();
- if (vnode_info->nr_nodes == nr_recovereds &&
- memcmp(vnode_info->nodes, recovereds,
- sizeof(*recovereds) * nr_recovereds) == 0) {
- sd_dprintf("all nodes are recovered at epoch %d", epoch);
- if (sd_store->cleanup)
- sd_store->cleanup();
+ if (vnode_info->nr_nodes == nr_recovereds) {
+ for (i = 0; i < nr_recovereds; ++i) {
+ if (node_id_cmp(&vnode_info->nodes[i].nid,
+ &recovereds[i].nid))
+ break;
+ }
+ if (i == nr_recovereds) {
+ sd_dprintf("all nodes are recovered at epoch %d"
+ , epoch);
+ if (sd_store->cleanup)
+ sd_store->cleanup();
+ }
}
put_vnode_info(vnode_info);
--
1.7.1
More information about the sheepdog
mailing list