Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: tarantool-patches@freelists.org
Subject: [PATCH 01/10] box: zap atfork callback
Date: Fri, 17 May 2019 17:52:35 +0300	[thread overview]
Message-ID: <04a7e79410d5590679cacf9f917c3da562d6a51f.1558103547.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1558103547.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1558103547.git.vdavydov.dev@gmail.com>

box_atfork calls wal_atfork which in turn calls xlog_atfork for the wal
and vylog files. A comment to xlog_atfork says that it's necessary to
prevent atexit handlers in a child from closing xlog files again, but we
don't use atexit for that anymore. A comment to box_atfork says that
box.coredump forks to write a core, but there's no box.coredump anymore.
There's also a comment mentioning box.cfg.background, but when we fork
that early there's no xlog file open.

To sum it up, atfork looks like a piece of legacy code. Let's get rid of
it now so as not to bother patching it later.
---
 src/box/box.cc | 10 ----------
 src/box/box.h  |  6 ------
 src/box/wal.c  | 16 ----------------
 src/box/wal.h  |  3 ---
 src/box/xlog.c | 16 ----------------
 src/box/xlog.h |  7 -------
 src/main.cc    |  1 -
 7 files changed, 59 deletions(-)

diff --git a/src/box/box.cc b/src/box/box.cc
index 7828f575..bb8aca36 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -2167,16 +2167,6 @@ box_cfg(void)
 	}
 }
 
-/**
- * box.coredump() forks to save a core. The entire
- * server forks in box.cfg{} if background=true.
- */
-void
-box_atfork()
-{
-	wal_atfork();
-}
-
 int
 box_checkpoint()
 {
diff --git a/src/box/box.h b/src/box/box.h
index 53d88ab7..53b5eb45 100644
--- a/src/box/box.h
+++ b/src/box/box.h
@@ -93,12 +93,6 @@ box_cfg(void);
 bool
 box_is_configured(void);
 
-/**
- * A pthread_atfork() callback for box
- */
-void
-box_atfork(void);
-
 void
 box_set_ro(bool ro);
 
diff --git a/src/box/wal.c b/src/box/wal.c
index 0ea15a43..25bceb68 100644
--- a/src/box/wal.c
+++ b/src/box/wal.c
@@ -1383,19 +1383,3 @@ wal_notify_watchers(struct wal_writer *writer, unsigned events)
 	rlist_foreach_entry(watcher, &writer->watchers, next)
 		wal_watcher_notify(watcher, events);
 }
-
-
-/**
- * After fork, the WAL writer thread disappears.
- * Make sure that atexit() handlers in the child do
- * not try to stop a non-existent thread or write
- * a second EOF marker to an open file.
- */
-void
-wal_atfork()
-{
-	if (xlog_is_open(&wal_writer_singleton.current_wal))
-		xlog_atfork(&wal_writer_singleton.current_wal);
-	if (xlog_is_open(&vy_log_writer.xlog))
-		xlog_atfork(&vy_log_writer.xlog);
-}
diff --git a/src/box/wal.h b/src/box/wal.h
index 4e500d2a..a88a3f23 100644
--- a/src/box/wal.h
+++ b/src/box/wal.h
@@ -164,9 +164,6 @@ void
 wal_clear_watcher(struct wal_watcher *watcher,
 		  void (*process_cb)(struct cbus_endpoint *));
 
-void
-wal_atfork();
-
 enum wal_mode
 wal_mode();
 
diff --git a/src/box/xlog.c b/src/box/xlog.c
index 8254cce2..82588682 100644
--- a/src/box/xlog.c
+++ b/src/box/xlog.c
@@ -1472,22 +1472,6 @@ xlog_close(struct xlog *l, bool reuse_fd)
 	return rc;
 }
 
-/**
- * Free xlog memory and destroy it cleanly, without side
- * effects (for use in the atfork handler).
- */
-void
-xlog_atfork(struct xlog *xlog)
-{
-	/*
-	 * Close the file descriptor STDIO buffer does not
-	 * make its way into the respective file in
-	 * fclose().
-	 */
-	close(xlog->fd);
-	xlog->fd = -1;
-}
-
 /* }}} */
 
 /* {{{ struct xlog_cursor */
diff --git a/src/box/xlog.h b/src/box/xlog.h
index a48b05fc..964d303e 100644
--- a/src/box/xlog.h
+++ b/src/box/xlog.h
@@ -550,13 +550,6 @@ xlog_sync(struct xlog *l);
 int
 xlog_close(struct xlog *l, bool reuse_fd);
 
-/**
- * atfork() handler function to close the log pointed
- * at by xlog in the child.
- */
-void
-xlog_atfork(struct xlog *xlog);
-
 /* {{{ xlog_tx_cursor - iterate over rows in xlog transaction */
 
 /**
diff --git a/src/main.cc b/src/main.cc
index 606c64c1..68c67773 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -341,7 +341,6 @@ static void
 tarantool_atfork()
 {
 	signal_reset();
-	box_atfork();
 }
 
 /**
-- 
2.11.0

  reply	other threads:[~2019-05-17 14:52 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 14:52 [PATCH 00/10] vinyl: don't yield in DDL on_commit triggers Vladimir Davydov
2019-05-17 14:52 ` Vladimir Davydov [this message]
2019-05-18 18:37   ` [tarantool-patches] Re: [PATCH 01/10] box: zap atfork callback Konstantin Osipov
2019-05-20  8:13     ` Vladimir Davydov
2019-06-01  8:16     ` Konstantin Osipov
2019-06-06 10:04       ` Vladimir Davydov
2019-05-17 14:52 ` [PATCH 02/10] vinyl: add a separate thread for vylog Vladimir Davydov
2019-05-18 18:39   ` [tarantool-patches] " Konstantin Osipov
2019-05-20  8:17     ` Vladimir Davydov
2019-06-01  8:26   ` Konstantin Osipov
2019-06-06 10:20     ` Vladimir Davydov
2019-05-17 14:52 ` [PATCH 03/10] vinyl: move vylog recovery to vylog thread Vladimir Davydov
2019-06-01  8:36   ` [tarantool-patches] " Konstantin Osipov
2019-06-06 10:23     ` Vladimir Davydov
2019-06-07 13:39       ` Konstantin Osipov
2019-06-10 15:24         ` Vladimir Davydov
2019-06-07 13:40       ` Konstantin Osipov
2019-05-17 14:52 ` [PATCH 04/10] vinyl: rework vylog transaction backlog implementation Vladimir Davydov
2019-06-01  8:38   ` [tarantool-patches] " Konstantin Osipov
2019-06-06 11:58     ` Vladimir Davydov
2019-05-17 14:52 ` [PATCH 05/10] vinyl: don't purge deleted runs from vylog on compaction Vladimir Davydov
2019-05-18 18:47   ` [tarantool-patches] " Konstantin Osipov
2019-05-20  8:27     ` Vladimir Davydov
2019-06-01  8:39   ` Konstantin Osipov
2019-06-06 12:40     ` Vladimir Davydov
2019-05-17 14:52 ` [PATCH 06/10] vinyl: lock out compaction while checkpointing is in progress Vladimir Davydov
2019-05-17 14:52 ` [PATCH 07/10] vinyl: don't access last vylog signature outside vylog implementation Vladimir Davydov
2019-05-17 14:52 ` [PATCH 08/10] vinyl: zap ERRINJ_VY_LOG_FLUSH_DELAY Vladimir Davydov
2019-05-17 14:52 ` [PATCH 09/10] key_def: pass alloc callback to key_def_dump_parts Vladimir Davydov
2019-05-18 18:52   ` [tarantool-patches] " Konstantin Osipov
2019-05-20  8:34     ` Vladimir Davydov
2019-06-01  8:41     ` Konstantin Osipov
2019-06-10 15:28       ` Vladimir Davydov
2019-06-16 14:57         ` Konstantin Osipov
2019-05-17 14:52 ` [PATCH 10/10] vinyl: get rid of the latch protecting vylog buffer Vladimir Davydov
2019-06-01  8:44   ` [tarantool-patches] " Konstantin Osipov
2019-06-06 13:15     ` Vladimir Davydov
2019-05-18 18:35 ` [tarantool-patches] Re: [PATCH 00/10] vinyl: don't yield in DDL on_commit triggers Konstantin Osipov
2019-05-20  8:09   ` Vladimir Davydov
2019-06-01  8:09 ` 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=04a7e79410d5590679cacf9f917c3da562d6a51f.1558103547.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 01/10] box: zap atfork callback' \
    /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