[Sheepdog] [PATCH] sheep: modify cached_epoch
yaohaiting.wujue at gmail.com
yaohaiting.wujue at gmail.com
Fri Mar 16 09:43:18 CET 2012
From: HaiTing Yao <wujue.yht at taobao.com>
cached_epoch is a __thread variable. If it greater than 1, format the
cluster again will lead to permanent I/O error.
Signed-off-by: HaiTing Yao <wujue.yht at taobao.com>
---
sheep/sdnet.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 5db9f29..d693858 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -832,7 +832,11 @@ int get_sheep_fd(uint8_t *addr, uint16_t port, int node_idx, uint32_t epoch)
if (before(epoch, cached_epoch)) {
eprintf("requested epoch is smaller than the previous one: %d < %d\n",
epoch, cached_epoch);
- return -1;
+ /* cluster format again */
+ if (sys->epoch == 1)
+ cached_epoch = 0;
+ else
+ return -1;
}
if (after(epoch, cached_epoch)) {
for (i = 0; i < SD_MAX_NODES; i++) {
--
1.7.1
More information about the sheepdog
mailing list