Hi Yuan, Rebased on master as requested.
It can be cases that, in some epoch, sheepdog cannot maintain the required copies of replications. When recovering from such epoch, we'd better be conservative and double check. Signed-off-by: Xinwei Hu <[email protected]> --- sheep/store.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/sheep/store.c b/sheep/store.c index b679001..dfec235 100644 --- a/sheep/store.c +++ b/sheep/store.c @@ -1328,6 +1328,13 @@ again: dprintf("try recover object %"PRIx64" from epoch %"PRIu32"\n", oid, tgt_epoch); + if (cur_copies <= copy_idx) { + eprintf("epoch (%"PRIu32") has less copies (%d) than requested copy_idx: %d\n", + tgt_epoch, cur_copies, copy_idx); + ret = -1; + goto err; + } + tgt_idx = find_tgt_node(old, old_nr, old_idx, old_copies, cur, cur_nr, cur_idx, cur_copies, copy_idx); if (tgt_idx < 0) { -- 1.7.8 -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
