From: Yunkai Zhang <[email protected]> This patch will chage gateway_forward_request()'s behaviour: 1) If we have at least one live node, and all live nodes were writen sucessfully, return SUCESS to the caller. 2) If we have at least one live nodes, and one of them failed to be writen, return NETWORK ERROR to the caller. 3) If there is no live node, return NETWORK ERROR to the caller.
By this change, as long as there is at least one live node, write operation will be OK. But if there is no live node, gateway_forward_request() will return NETWORK ERROR, although upper caller will retry write-operation again and again, but guest operation will sense this failure if retry is too long, so cluster administrator should restart sheeps as soon as possible during this time. Signed-off-by: Yunkai Zhang <[email protected]> --- sheep/gateway.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sheep/gateway.c b/sheep/gateway.c index edd8dcb..201ce5f 100644 --- a/sheep/gateway.c +++ b/sheep/gateway.c @@ -263,6 +263,9 @@ static int gateway_forward_request(struct request *req) continue; } + if (sys->disable_recovery && vnode_has_left(req->vinfo, v)) + continue; + sfd = sheep_get_sockfd(&v->nid); if (!sfd) { err_ret = SD_RES_NETWORK_ERROR; @@ -296,7 +299,8 @@ static int gateway_forward_request(struct request *req) ret = wait_forward_request(&wi, rsp); if (ret != SD_RES_SUCCESS) err_ret = ret; - } + } else if (sys->disable_recovery && local == -1) + return SD_RES_NETWORK_ERROR; return err_ret; } -- 1.7.11.2 -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
