From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 5/5] xlog: assure xlog is opened and closed in the same thread Date: Sat, 29 Dec 2018 00:21:51 +0300 Message-Id: <398940b925b4b9c1ae0cc67452a2d0684cbb754f.1546030880.git.vdavydov.dev@gmail.com> In-Reply-To: References: In-Reply-To: References: To: tarantool-patches@freelists.org List-ID: xlog and xlog_cursor must be opened and closed in the same thread, because they use cord's slab allocator. Follow-up #3910 --- src/box/xlog.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/box/xlog.c b/src/box/xlog.c index 71b9b7cd..881dcd3b 100644 --- a/src/box/xlog.c +++ b/src/box/xlog.c @@ -791,6 +791,8 @@ xlog_clear(struct xlog *l) static void xlog_destroy(struct xlog *xlog) { + assert(xlog->obuf.slabc == &cord()->slabc); + assert(xlog->zbuf.slabc == &cord()->slabc); obuf_destroy(&xlog->obuf); obuf_destroy(&xlog->zbuf); ZSTD_freeCCtx(xlog->zctx); @@ -1816,6 +1818,7 @@ xlog_tx_cursor_next_row(struct xlog_tx_cursor *tx_cursor, int xlog_tx_cursor_destroy(struct xlog_tx_cursor *tx_cursor) { + assert(tx_cursor->rows.slabc == &cord()->slabc); ibuf_destroy(&tx_cursor->rows); return 0; } @@ -2049,6 +2052,7 @@ xlog_cursor_close(struct xlog_cursor *i, bool reuse_fd) assert(xlog_cursor_is_open(i)); if (i->fd >= 0 && !reuse_fd) close(i->fd); + assert(i->rbuf.slabc == &cord()->slabc); ibuf_destroy(&i->rbuf); if (i->state == XLOG_CURSOR_TX) xlog_tx_cursor_destroy(&i->tx_cursor); -- 2.11.0