diff options
author | Ajeet Jha <ajha@redhat.com> | 2014-06-02 14:49:07 +0530 |
---|---|---|
committer | Venky Shankar <vshankar@redhat.com> | 2014-06-10 06:37:57 -0700 |
commit | 94260c93a144b52964a27ddc9eaef869a3e8f354 (patch) | |
tree | 116590542f6b7bcdf42d04e8df89b68dbf12fc19 /xlators/features/changelog | |
parent | b12b15a186714ec4d5639b778f15e075c833ce55 (diff) |
features/changelog: skipping empty changelogs in history
Empty changelgs are unlinked and htime-update is bypassed
while publishing partially written changelog.
Change-Id: I1533ad431e4fbf592d2f38837fce782932d01e9c
BUG: 1105466
Signed-off-by: Ajeet Jha <ajha@redhat.com>
Reviewed-on: http://review.gluster.org/7949
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/features/changelog')
-rw-r--r-- | xlators/features/changelog/lib/src/gf-changelog-process.c | 22 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog-helpers.c | 4 |
2 files changed, 9 insertions, 17 deletions
diff --git a/xlators/features/changelog/lib/src/gf-changelog-process.c b/xlators/features/changelog/lib/src/gf-changelog-process.c index 3b8d2683672..83f8928de6d 100644 --- a/xlators/features/changelog/lib/src/gf-changelog-process.c +++ b/xlators/features/changelog/lib/src/gf-changelog-process.c @@ -471,16 +471,10 @@ gf_changelog_publish (xlator_t *this, gf_changelog_t *gfc, char *from_path) gfc->gfc_current_dir, basename (from_path)); /* handle zerob file that wont exist in current */ - ret = stat (from_path, &stbuf); - if (ret) - goto out; - - if (stbuf.st_size == 0) { - ret = unlink (from_path); - if (ret) - gf_log (this->name, GF_LOG_ERROR, - "could not unlink %s (reason %s)", - from_path, strerror (errno)); + ret = stat (to_path, &stbuf); + if (ret){ + if (errno == ENOENT) + ret = 0; goto out; } @@ -546,7 +540,7 @@ gf_changelog_consume (xlator_t *this, close (fd2); if (!ret) { - /* move it to processing on a successfull + /* move it to processing on a successful decode */ if (no_publish == _gf_true) goto close_fd; @@ -560,11 +554,7 @@ gf_changelog_consume (xlator_t *this, /* remove it from .current if it's an empty file */ if (zerob) { - if (no_publish == _gf_true) { - ret = 0; - goto close_fd; - } - + /* zerob changelogs must be unlinked */ ret = unlink (to_path); if (ret) gf_log (this->name, GF_LOG_ERROR, diff --git a/xlators/features/changelog/src/changelog-helpers.c b/xlators/features/changelog/src/changelog-helpers.c index 984106b75e6..8efe7dc4695 100644 --- a/xlators/features/changelog/src/changelog-helpers.c +++ b/xlators/features/changelog/src/changelog-helpers.c @@ -166,7 +166,8 @@ htime_update (xlator_t *this, if (sys_fsetxattr (priv->htime_fd, HTIME_KEY, x_value, strlen (x_value), XATTR_REPLACE)) { gf_log (this->name, GF_LOG_ERROR, - "Htime xattr updation failed"); + "Htime xattr updation failed, " + "reason (%s)",strerror (errno)); goto out; } @@ -209,6 +210,7 @@ changelog_rollover_changelog (xlator_t *this, if (ret && (errno == ENOENT)) { ret = 0; + goto out; } if (ret) { |