From 847aab99666f7311f5cae527f5213fea62eeca6c Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov.dev@gmail.com> Date: Fri, 28 Dec 2018 23:37:24 +0300 Subject: [PATCH] xlog: assure xlog is opened and closed in the same thread 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 71b9b7cda1..881dcd3b0e 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); -- GitLab