Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH 1/5] xlog: fix filename in error messages
Date: Sun,  7 Oct 2018 23:27:14 +0300	[thread overview]
Message-ID: <3273817f5cb79af421a33b08a1539eb27a8ab9d2.1538942600.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1538942600.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1538942600.git.vdavydov.dev@gmail.com>

 - xlog_rename() doesn't strip xlog->filename of inprogress suffix so
   write errors will mistakenly report the filename as inprogress.
 - xlog_create() uses a name without inprogress suffix for error
   reporting while it actually creates an inprogress file.
---
 src/box/xlog.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/box/xlog.c b/src/box/xlog.c
index d399a726..de5e52f7 100644
--- a/src/box/xlog.c
+++ b/src/box/xlog.c
@@ -744,6 +744,7 @@ xlog_rename(struct xlog *l)
 		return -1;
 	}
 	l->is_inprogress = false;
+	filename[suffix - filename] = '\0';
 	return 0;
 }
 
@@ -820,8 +821,9 @@ xlog_create(struct xlog *xlog, const char *name, int flags,
 	 */
 	xlog->fd = open(xlog->filename, flags, 0644);
 	if (xlog->fd < 0) {
-		say_syserror("open, [%s]", name);
-		diag_set(SystemError, "failed to create file '%s'", name);
+		say_syserror("open, [%s]", xlog->filename);
+		diag_set(SystemError, "failed to create file '%s'",
+			 xlog->filename);
 		goto err_open;
 	}
 
@@ -834,7 +836,8 @@ xlog_create(struct xlog *xlog, const char *name, int flags,
 
 	/* Write metadata */
 	if (fio_writen(xlog->fd, meta_buf, meta_len) < 0) {
-		diag_set(SystemError, "%s: failed to write xlog meta", name);
+		diag_set(SystemError, "%s: failed to write xlog meta",
+			 xlog->filename);
 		goto err_write;
 	}
 
-- 
2.11.0

  reply	other threads:[~2018-10-07 20:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-07 20:27 [PATCH 0/5] Delete old WAL files if running out of disk space Vladimir Davydov
2018-10-07 20:27 ` Vladimir Davydov [this message]
2018-10-12  8:19   ` [PATCH 1/5] xlog: fix filename in error messages Vladimir Davydov
2018-10-16 19:07   ` [tarantool-patches] " Konstantin Osipov
2018-10-07 20:27 ` [PATCH 2/5] wal: preallocate disk space before writing rows Vladimir Davydov
2018-10-16 19:09   ` [tarantool-patches] " Konstantin Osipov
2018-10-07 20:27 ` [PATCH 3/5] xlog: allow to limit number of files deleted by xdir_collect_garbage Vladimir Davydov
2018-10-07 20:27 ` [PATCH 4/5] wal: notify watchers about wal file removal Vladimir Davydov
2018-10-07 20:27 ` [PATCH 5/5] wal: delete old wal files when running out of disk space Vladimir Davydov
2018-10-16 19:05 ` [tarantool-patches] Re: [PATCH 0/5] Delete old WAL files if " Konstantin Osipov
2018-10-17  8:20   ` Vladimir Davydov
2018-10-23  8:37     ` Vladimir Davydov
2018-10-23  8:46       ` Konstantin Osipov

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=3273817f5cb79af421a33b08a1539eb27a8ab9d2.1538942600.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 1/5] xlog: fix filename in error messages' \
    /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