summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2016-08-01 16:59:33 +0530
committerAravinda VK <avishwan@redhat.com>2016-08-18 23:05:04 -0700
commit69ad1ff391a28a9ad5ff40b9eed11ece33c40111 (patch)
tree64504a55a00c121d941d5e556b6383aa43235465
parent68b68ce5d4bd0df63e1b7a0a0e6365b5020a3db7 (diff)
features/libgfchangelog: Log failure in gf_histroy_changelog
Add error logs if gf_history_changelog fails. If requested changelog range is not available, log the error and exit instead of continuing the loop and exiting in readdir without logging. Also fixed the duplicate MSGID number in 'changelog-lib-messages.h' > Change-Id: Icd71b89ae23b48a71380657ba5649029c32fabfd > BUG: 1362151 > Signed-off-by: Kotresh HR <khiremat@redhat.com> > Reviewed-on: http://review.gluster.org/15064 > Smoke: Gluster Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Aravinda VK <avishwan@redhat.com> Change-Id: Icd71b89ae23b48a71380657ba5649029c32fabfd BUG: 1365877 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/15139 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Aravinda VK <avishwan@redhat.com>
-rw-r--r--geo-replication/syncdaemon/libgfchangelog.py5
-rw-r--r--geo-replication/syncdaemon/resource.py5
-rw-r--r--geo-replication/syncdaemon/syncdutils.py2
-rw-r--r--xlators/features/changelog/lib/src/gf-history-changelog.c15
4 files changed, 23 insertions, 4 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/gf-history-changelog.c b/xlators/features/changelog/lib/src/gf-history-changelog.c
index ba312e3b10f..5d3def12117 100644
--- a/xlators/features/changelog/lib/src/gf-history-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-history-changelog.c
@@ -796,6 +796,8 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
ret = pthread_attr_init (&attr);
if (ret != 0) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Pthread init failed: %s", strerror (errno));
return -1;
}
@@ -819,6 +821,9 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
/* basic sanity check */
if (start > end || n_parallel <= 0) {
+ gf_log (this->name, GF_LOG_ERROR, "Sanity check failed. "
+ "START - %lu END - %lu THREAD_COUNT - %d",
+ start, end, n_parallel);
ret = -1;
goto out;
}
@@ -941,8 +946,14 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
goto out;
- } /* end of range check */
-
+ } else {/* end of range check */
+ gf_log (this->name, GF_LOG_ERROR, "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)