From 69ad1ff391a28a9ad5ff40b9eed11ece33c40111 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Mon, 1 Aug 2016 16:59:33 +0530 Subject: 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 > Reviewed-on: http://review.gluster.org/15064 > Smoke: Gluster Build System > CentOS-regression: Gluster Build System > NetBSD-regression: NetBSD Build System > Reviewed-by: Aravinda VK Change-Id: Icd71b89ae23b48a71380657ba5649029c32fabfd BUG: 1365877 Signed-off-by: Kotresh HR Reviewed-on: http://review.gluster.org/15139 NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Smoke: Gluster Build System Reviewed-by: Aravinda VK --- xlators/features/changelog/lib/src/gf-history-changelog.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'xlators/features/changelog') 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) -- cgit