Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH v5 4/4] box: introduce multikey indexes in memtx
Date: Mon, 6 May 2019 18:46:03 +0300	[thread overview]
Message-ID: <20190506154603.txsxk2hsyshdqtdb@esperanza> (raw)
In-Reply-To: <bb1e8c779aae2538c797d45668f190ba46ce438e.1557142159.git.kshcherbatov@tarantool.org>

The patch looks generally okay, but I think there's a problem re
field_map_size we have overlooked. The problem is memtx_tuple_delete
uses field_map_size to find out the allocation size:

 | void
 | memtx_tuple_delete(struct tuple_format *format, struct tuple *tuple)
 | {
 | 	struct memtx_engine *memtx = (struct memtx_engine *)format->engine;
 | 	say_debug("%s(%p)", __func__, tuple);
 | 	assert(tuple->refs == 0);
 | 	size_t total = sizeof(struct memtx_tuple) + format->field_map_size +
 | 		tuple->bsize;
 | 	tuple_format_unref(format);
 | 	struct memtx_tuple *memtx_tuple =
 | 		container_of(tuple, struct memtx_tuple, base);
 | 	if (memtx->alloc.free_mode != SMALL_DELAYED_FREE ||
 | 	    memtx_tuple->version == memtx->snapshot_version ||
 | 	    format->is_temporary)
 | 		smfree(&memtx->alloc, memtx_tuple, total);
 | 	else
 | 		smfree_delayed(&memtx->alloc, memtx_tuple, total);
 | }

How's it going to work in case the field map stored in a tuple is
greater than field_map_size?

I think we should calculate the real size of the field map here
in case the format allows multikey indexes.

  reply	other threads:[~2019-05-06 15:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 11:57 [PATCH v5 0/4] " Kirill Shcherbatov
2019-05-06 11:57 ` [PATCH v5 1/4] box: introduce tuple_format_iterator class Kirill Shcherbatov
2019-05-06 13:55   ` Vladimir Davydov
2019-05-06 14:32     ` [tarantool-patches] " Kirill Shcherbatov
2019-05-06 11:57 ` [PATCH v5 2/4] box: introduce field_map_builder class Kirill Shcherbatov
2019-05-06 14:22   ` Vladimir Davydov
2019-05-06 11:57 ` [PATCH v5 3/4] salad: introduce bps_tree_delete_identical routine Kirill Shcherbatov
2019-05-06 14:34   ` Vladimir Davydov
2019-05-06 14:55     ` [tarantool-patches] " Kirill Shcherbatov
2019-05-06 11:57 ` [PATCH v5 4/4] box: introduce multikey indexes in memtx Kirill Shcherbatov
2019-05-06 15:46   ` Vladimir Davydov [this message]
2019-05-06 16:35     ` [tarantool-patches] " Kirill Shcherbatov
2019-05-07  8:11       ` Vladimir Davydov
2019-05-07  8:28         ` Kirill Shcherbatov
2019-05-07 11:30           ` Vladimir Davydov
2019-05-07 13:13     ` Vladimir Davydov
2019-05-06 15:52 ` [PATCH v5 0/4] " Vladimir Davydov

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=20190506154603.txsxk2hsyshdqtdb@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v5 4/4] box: introduce multikey indexes in memtx' \
    /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