[PATCH 5/5] xlog: assure xlog is opened and closed in the same thread
Vladimir Davydov
vdavydov.dev at gmail.com
Sat Dec 29 00:21:51 MSK 2018
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
More information about the Tarantool-patches
mailing list