[Sheepdog] [PATCH] collie: show better error message while node membership is changing
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Sun Dec 11 18:32:46 CET 2011
While node membership is changing, some collie commands result in the
SD_RES_NEW/OLD_NODE_VER error and we need to retry the commands after
new membership is established. This patch shows a bit more friendly
error message to explain it.
In future, it might be better to retry sending requests automatically
instead of showing errors.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
Hi Chris,
It looks a bit difficult to handle collie commands gracefully during
node membership changes. I think of showing an error message to force
users to retry the commands, and leaving this problem as a future work.
Thanks,
Kazutaka
collie/common.c | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/collie/common.c b/collie/common.c
index 0653b72..14dc915 100644
--- a/collie/common.c
+++ b/collie/common.c
@@ -79,13 +79,22 @@ int sd_read_object(uint64_t oid, void *data, unsigned int datalen,
return SD_RES_EIO;
}
- if (rsp->result != SD_RES_SUCCESS) {
+ switch (rsp->result) {
+ case SD_RES_SUCCESS:
+ /* success */
+ break;
+ case SD_RES_OLD_NODE_VER:
+ case SD_RES_NEW_NODE_VER:
+ fprintf(stderr, "new node membership is not established yet, "
+ "try again later\n");
+ break;
+ default:
fprintf(stderr, "failed to read object, %lx %s\n", oid,
sd_strerror(rsp->result));
- return rsp->result;
+ break;
}
- return SD_RES_SUCCESS;
+ return rsp->result;
}
int sd_write_object(uint64_t oid, uint64_t cow_oid, void *data, unsigned int datalen,
@@ -122,13 +131,23 @@ int sd_write_object(uint64_t oid, uint64_t cow_oid, void *data, unsigned int dat
fprintf(stderr, "failed to write object, %lx\n", oid);
return SD_RES_EIO;
}
- if (rsp->result != SD_RES_SUCCESS) {
+
+ switch (rsp->result) {
+ case SD_RES_SUCCESS:
+ /* success */
+ break;
+ case SD_RES_OLD_NODE_VER:
+ case SD_RES_NEW_NODE_VER:
+ fprintf(stderr, "new node membership is not established yet, "
+ "try again later\n");
+ break;
+ default:
fprintf(stderr, "failed to write object, %lx %s\n", oid,
sd_strerror(rsp->result));
- return rsp->result;
+ break;
}
- return SD_RES_SUCCESS;
+ return rsp->result;
}
int parse_vdi(vdi_parser_func_t func, size_t size, void *data)
--
1.7.2.5
More information about the sheepdog
mailing list