Tarantool development patches archive
 help / color / mirror / Atom feed
From: Ilya Markov <imarkov@tarantool.org>
To: vdavydov.dev@gmail.com
Cc: georgy@tarantool.org, tarantool-patches@freelists.org
Subject: [PATCH v5 1/2] xdir: Change log messages in gc functions
Date: Wed, 20 Jun 2018 19:25:55 +0300	[thread overview]
Message-ID: <a5b8d7b01d0b768e9f4e44b4bb920434588039ed.1529511845.git.imarkov@tarantool.org> (raw)
In-Reply-To: <cover.1529511845.git.imarkov@tarantool.org>
In-Reply-To: <cover.1529511845.git.imarkov@tarantool.org>

In order to log only about files that are actually removed
change log messages from "removing <name of file>" to "removed <name of
file>" 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

  reply	other threads:[~2018-06-20 16:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-09 14:46 [tarantool-patches] [xlog 1/1] xlog: Remove inprogress files on start Ilya Markov
2018-06-18  9:44 ` Vladimir Davydov
2018-06-18 16:23   ` [PATCH v2] " Ilya Markov
2018-06-19 11:50     ` Vladimir Davydov
2018-06-19 13:14   ` [PATCH v3] " Ilya Markov
2018-06-20 12:08     ` Vladimir Davydov
2018-06-20 13:48       ` [PATCH 0/2 v4] xdir: " Ilya Markov
2018-06-20 13:48         ` [PATCH 1/2 v4] xdir: Change log messages in gc functions Ilya Markov
2018-06-20 13:48         ` [PATCH 2/2 v4] xlog: Remove inprogress files on start Ilya Markov
2018-06-20 16:25       ` [PATCH v5 0/2] " Ilya Markov
2018-06-20 16:25         ` Ilya Markov [this message]
2018-06-28 12:26           ` [PATCH v5 1/2] xdir: Change log messages in gc functions Vladimir Davydov
2018-06-20 16:25         ` [PATCH v5 2/2] xlog: Remove inprogress files on start Ilya Markov
2018-06-28 12:27           ` Vladimir Davydov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5b8d7b01d0b768e9f4e44b4bb920434588039ed.1529511845.git.imarkov@tarantool.org \
    --to=imarkov@tarantool.org \
    --cc=georgy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH v5 1/2] xdir: Change log messages in gc functions' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox