diff options
-rw-r--r-- | geo-replication/syncdaemon/libgfchangelog.py | 5 | ||||
-rw-r--r-- | geo-replication/syncdaemon/resource.py | 5 | ||||
-rw-r--r-- | geo-replication/syncdaemon/syncdutils.py | 2 | ||||
-rw-r--r-- | xlators/features/changelog/lib/src/changelog-lib-messages.h | 11 | ||||
-rw-r--r-- | xlators/features/changelog/lib/src/gf-history-changelog.c | 17 |
5 files changed, 34 insertions, 6 deletions
diff --git a/geo-replication/syncdaemon/libgfchangelog.py b/geo-replication/syncdaemon/libgfchangelog.py index 1d580caf6e8..d87b56cd941 100644 --- a/geo-replication/syncdaemon/libgfchangelog.py +++ b/geo-replication/syncdaemon/libgfchangelog.py @@ -11,7 +11,7 @@ import os from ctypes import CDLL, RTLD_GLOBAL, create_string_buffer, get_errno, byref, c_ulong from ctypes.util import find_library -from syncdutils import ChangelogException +from syncdutils import ChangelogException, ChangelogHistoryNotAvailable class Changes(object): @@ -99,6 +99,9 @@ class Changes(object): if ret == -1: cls.raise_changelog_err() + if ret == -2: + raise ChangelogHistoryNotAvailable() + return (ret, actual_end.value) @classmethod diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index bc7b13c95bc..ed0e7efe2b2 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -36,7 +36,7 @@ import syncdutils from syncdutils import GsyncdError, select, privileged, boolify, funcode from syncdutils import umask, entry2pb, gauxpfx, errno_wrap, lstat from syncdutils import NoPurgeTimeAvailable, PartialHistoryAvailable -from syncdutils import ChangelogException +from syncdutils import ChangelogException, ChangelogHistoryNotAvailable from syncdutils import CHANGELOG_AGENT_CLIENT_VERSION from gsyncdstatus import GeorepStatus @@ -1503,6 +1503,9 @@ class GLUSTER(AbstractUrl, SlaveLocal, SlaveRemote): logging.info('Partial history available, using xsync crawl' ' after consuming history till %s' % str(e)) g1.crawlwrap(oneshot=True, register_time=register_time) + except ChangelogHistoryNotAvailable: + logging.info('Changelog history not available, using xsync') + g1.crawlwrap(oneshot=True, register_time=register_time) except NoPurgeTimeAvailable: logging.info('No stime available, using xsync crawl') g1.crawlwrap(oneshot=True, register_time=register_time) diff --git a/geo-replication/syncdaemon/syncdutils.py b/geo-replication/syncdaemon/syncdutils.py index 9d89a3cd415..40eff050a9e 100644 --- a/geo-replication/syncdaemon/syncdutils.py +++ b/geo-replication/syncdaemon/syncdutils.py @@ -501,6 +501,8 @@ class NoPurgeTimeAvailable(Exception): class PartialHistoryAvailable(Exception): pass +class ChangelogHistoryNotAvailable(Exception): + pass class ChangelogException(OSError): pass diff --git a/xlators/features/changelog/lib/src/changelog-lib-messages.h b/xlators/features/changelog/lib/src/changelog-lib-messages.h index 976c67f61a9..a6209af71ee 100644 --- a/xlators/features/changelog/lib/src/changelog-lib-messages.h +++ b/xlators/features/changelog/lib/src/changelog-lib-messages.h @@ -45,7 +45,7 @@ */ #define GLFS_COMP_BASE_CHANGELOG_LIB GLFS_MSGID_COMP_CHANGELOG_LIB -#define GLFS_NUM_MESSAGES 28 +#define GLFS_NUM_MESSAGES 32 #define GLFS_MSGID_END (GLFS_COMP_BASE_CHANGELOG_LIB + GLFS_NUM_MESSAGES + 1) #define glfs_msg_start_x GLFS_COMP_BASE_CHANGELOG_LIB,\ @@ -280,8 +280,15 @@ * @recommended action */ #define CHANGELOG_LIB_MSG_PTHREAD_JOIN_FAILED \ - (GLFS_COMP_BASE_CHANGELOG_LIB + 20) + (GLFS_COMP_BASE_CHANGELOG_LIB + 31) +/*! + * @messageid + * @diagnosis + * @recommended action +*/ +#define CHANGELOG_LIB_MSG_HIST_FAILED \ + (GLFS_COMP_BASE_CHANGELOG_LIB + 32) #define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages" #endif /* !_CHANGELOG_MESSAGES_H_ */ diff --git a/xlators/features/changelog/lib/src/gf-history-changelog.c b/xlators/features/changelog/lib/src/gf-history-changelog.c index 5ed50390a7c..45f2d8ba9f3 100644 --- a/xlators/features/changelog/lib/src/gf-history-changelog.c +++ b/xlators/features/changelog/lib/src/gf-history-changelog.c @@ -805,6 +805,9 @@ gf_history_changelog (char* changelog_dir, unsigned long start, ret = pthread_attr_init (&attr); if (ret != 0) { + gf_msg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_LIB_MSG_PTHREAD_ERROR, + "Pthread init failed"); return -1; } @@ -828,6 +831,10 @@ gf_history_changelog (char* changelog_dir, unsigned long start, /* basic sanity check */ if (start > end || n_parallel <= 0) { + gf_msg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_LIB_MSG_HIST_FAILED, "Sanity check failed. " + "START - %lu END - %lu THREAD_COUNT - %d", + start, end, n_parallel); ret = -1; goto out; } @@ -964,8 +971,14 @@ gf_history_changelog (char* changelog_dir, unsigned long start, goto out; - } /* end of range check */ - + } else {/* end of range check */ + gf_msg (this->name, GF_LOG_ERROR, errno, + CHANGELOG_LIB_MSG_HIST_FAILED, "Requested changelog " + "range is not available. START - %lu CHLOG_MIN - %lu " + "CHLOG_MAX - %lu", start, min_ts, max_ts); + ret = -2; + goto out; + } } /* end of readdir() */ if (!from || !to) |