diff options
author | Kotresh HR <khiremat@redhat.com> | 2015-05-27 16:27:25 +0530 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2015-05-31 07:48:19 -0700 |
commit | d76e9b83454786e6845d0cad3c2c0695815fae1b (patch) | |
tree | 49a6b154215fb8e23567363b1db05d3495915b98 /xlators/features/changelog/src/changelog-helpers.c | |
parent | ad7bd0865db4653e609bfc08cfc50225c87f3748 (diff) |
featuress/changelog: On snapshot, notify irrespective of failures
During snapshot, changelog barrier is enabled and a
explicit rollover of changelog is initiated. During
rollover of changelog, if any error or changelog is
empty, the notification was not sent to reconfigure
and hence snapshot was failing because of timeout.
This patch addresses it by sending notification
irrespective of failures and sends error if any
back to barrier.
Change-Id: I898af624b44555281a9e43c69066077e0e121c17
BUG: 1225542
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/10951
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/features/changelog/src/changelog-helpers.c')
-rw-r--r-- | xlators/features/changelog/src/changelog-helpers.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/xlators/features/changelog/src/changelog-helpers.c b/xlators/features/changelog/src/changelog-helpers.c index 11e60dcbf4a..a604891f0b3 100644 --- a/xlators/features/changelog/src/changelog-helpers.c +++ b/xlators/features/changelog/src/changelog-helpers.c @@ -493,30 +493,33 @@ changelog_rollover_changelog (xlator_t *this, ev.ev_type = CHANGELOG_OP_TYPE_JOURNAL; memcpy (ev.u.journal.path, nfile, strlen (nfile) + 1); changelog_dispatch_event (this, priv, &ev); + } + out: + /* If this is explicit rollover initiated by snapshot, + * wakeup reconfigure thread waiting for changelog to + * rollover. This should happen even in failure cases as + * well otherwise snapshot will timeout and fail. Hence + * moved under out. + */ + if (priv->explicit_rollover) { + priv->explicit_rollover = _gf_false; - /* If this is explicit rollover initiated by snapshot, - * wakeup reconfigure thread waiting for changelog to - * rollover - */ - if (priv->explicit_rollover) { - priv->explicit_rollover = _gf_false; - - ret = pthread_mutex_lock (&priv->bn.bnotify_mutex); - CHANGELOG_PTHREAD_ERROR_HANDLE_0 (ret, out); - { - priv->bn.bnotify = _gf_false; - ret = pthread_cond_signal - (&priv->bn.bnotify_cond); - CHANGELOG_PTHREAD_ERROR_HANDLE_0 (ret, out); - gf_log (this->name, GF_LOG_INFO, - "Changelog published: %s signalled" - " bnotify", nfile); + pthread_mutex_lock (&priv->bn.bnotify_mutex); + { + if (ret) { + priv->bn.bnotify_error = _gf_true; + gf_log (this->name, GF_LOG_ERROR, "Fail " + "snapshot because of previous errors"); + } else { + gf_log (this->name, GF_LOG_INFO, "Explicit " + "rollover changelog: %s signaling " + "bnotify", nfile); } - ret = pthread_mutex_unlock (&priv->bn.bnotify_mutex); - CHANGELOG_PTHREAD_ERROR_HANDLE_0 (ret, out); + priv->bn.bnotify = _gf_false; + pthread_cond_signal (&priv->bn.bnotify_cond); } + pthread_mutex_unlock (&priv->bn.bnotify_mutex); } - out: return ret; } |