[sheepdog] [PATCH] sheep: correct read_epoch()
Liu Yuan
namei.unix at gmail.com
Wed Jun 6 11:48:04 CEST 2012
From: Liu Yuan <tailai.ly at taobao.com>
When startup the cluster for the first time, we would get the following message:
Jun 06 17:29:32 read_epoch(525) failed to read epoch 0
This should be printed because cluster doesn't go error.
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/store.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sheep/store.c b/sheep/store.c
index ad9883e..a9ae398 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -519,6 +519,9 @@ int read_epoch(uint32_t *epoch, uint64_t *ct,
int ret;
*epoch = get_latest_epoch();
+ if (*epoch == 0)
+ return SD_RES_EIO;
+
ret = epoch_log_read(*epoch, (char *)entries,
*nr_entries * sizeof(*entries));
if (ret == -1) {
--
1.7.10.2
More information about the sheepdog
mailing list