From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Ilya Markov Subject: [PATCH 1/2 v4] xdir: Change log messages in gc functions Date: Wed, 20 Jun 2018 16:48:02 +0300 Message-Id: In-Reply-To: References: <20180620120853.4nell7bxgbmjjffy@esperanza> In-Reply-To: References: To: vdavydov.dev@gmail.com Cc: georgy@tarantool.org, tarantool-patches@freelists.org List-ID: In order to log only about files that are actually removed change log messages from "removing " to "removed " in vy_run_remove_files and xdir_collect_garbage functions. Prerequisite #3406 --- src/box/vy_run.c | 12 +++++++----- src/box/xlog.c | 18 +++++++++++------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/box/vy_run.c b/src/box/vy_run.c index 980bc4d..2c5c0c9 100644 --- a/src/box/vy_run.c +++ b/src/box/vy_run.c @@ -2442,11 +2442,13 @@ vy_run_remove_files(const char *dir, uint32_t space_id, for (int type = 0; type < vy_file_MAX; type++) { vy_run_snprint_path(path, sizeof(path), dir, space_id, iid, run_id, type); - say_info("removing %s", path); - if (coio_unlink(path) < 0 && errno != ENOENT) { - say_syserror("error while removing %s", path); - ret = -1; - } + if (coio_unlink(path) < 0) { + if (errno != ENOENT) { + say_syserror("error while removing %s", path); + ret = -1; + } + } else + say_info("removed %s", path); } return ret; } diff --git a/src/box/xlog.c b/src/box/xlog.c index 824ad11..04f8587 100644 --- a/src/box/xlog.c +++ b/src/box/xlog.c @@ -603,18 +603,22 @@ xdir_collect_garbage(struct xdir *dir, int64_t signature, bool use_coio) vclock_sum(vclock) < signature) { char *filename = xdir_format_filename(dir, vclock_sum(vclock), NONE); - say_info("removing %s", filename); int rc; if (use_coio) rc = coio_unlink(filename); else rc = unlink(filename); - if (rc < 0 && errno != ENOENT) { - say_syserror("error while removing %s", filename); - diag_set(SystemError, "failed to unlink file '%s'", - filename); - return -1; - } + if (rc < 0) { + if (errno != ENOENT) { + say_syserror("error while removing %s", + filename); + diag_set(SystemError, + "failed to unlink file '%s'", + filename); + return -1; + } + } else + say_info("removed %s", filename); vclockset_remove(&dir->index, vclock); free(vclock); } -- 2.7.4