Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Oleg Babin <olegrok@tarantool.org>,
	tarantool-patches@dev.tarantool.org, alyapunov@tarantool.org,
	korablev@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/2] tuple: fix multikey field JSON access crash
Date: Thu, 6 Aug 2020 22:04:10 +0200	[thread overview]
Message-ID: <8892a38d-0608-314f-b32d-531db3bd6de3@tarantool.org> (raw)
In-Reply-To: <6a8870f3-ac79-7021-941d-11b90e687282@tarantool.org>

On 06.08.2020 18:00, Oleg Babin wrote:
> Hi! Thanks for your patch. It's not a review but I have a question.
> 
> On 05/08/2020 02:45, Vladislav Shpilevoy wrote:
>> When a tuple had format with multikey indexes in it, any attempt
>> to get a multikey indexed field by a JSON path from Lua led to a
>> crash.
>>
>> That was because of incorrect interpretation of offset slot value
>> in tuple's field map.
>>
>> Tuple field map is an array stored before the tuple's MessagePack
>> data. Each element is a 4 byte offset to an indexed value to be
>> able to get it for O(1) time without MessagePack decoding of all
>> the previous fields.
>>
>> At least it was so before multikeys. Now tuple field map is not
>> just an array. It is rather a 2-level array, somehow similar to
>> ext4 FS. Some elements of the root array are positive numbers
>> pointing at data. Some elements point at a second 'indirect'
>> array, so called 'extra', size of which is individual for each
>> tuple. These second arrays are used by multikey indexes to store
>> offsets to each multikey indexed value in a tuple.
> 
> 
> Do json path updates use offsets? Is such issue relevant for them?
> 
> I tried to update poisoned tuple but seems it works fine. But maybe I've missed something.

No, JSON updates always decode whole tuple, at least all fields <=
max affected field. So offsets are not used. I was thinking about
adding them, but so far there was no a request for it, nor benches
how would it help exactly.

  reply	other threads:[~2020-08-06 20:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 23:45 [Tarantool-patches] [PATCH 0/2] JSON field multikey crash Vladislav Shpilevoy
2020-08-04 23:45 ` [Tarantool-patches] [PATCH 1/2] tuple: fix multikey field JSON access crash Vladislav Shpilevoy
2020-08-06 16:00   ` Oleg Babin
2020-08-06 20:04     ` Vladislav Shpilevoy [this message]
2020-08-10 16:09   ` Nikita Pettik
2020-08-11  9:44   ` Aleksandr Lyapunov
2020-08-11 21:24     ` Vladislav Shpilevoy
2020-08-12 13:05       ` Aleksandr Lyapunov
2020-08-12 20:34         ` Vladislav Shpilevoy
2020-08-04 23:45 ` [Tarantool-patches] [PATCH 2/2] tuple: fix access by JSON path starting from '[*]' Vladislav Shpilevoy
2020-08-10 17:52   ` Nikita Pettik
2020-08-11 18:50   ` Aleksandr Lyapunov
2020-08-10 10:10 ` [Tarantool-patches] [PATCH 0/2] JSON field multikey crash Aleksandr Lyapunov
2020-08-10 22:22   ` Vladislav Shpilevoy
2020-08-12 20:34 ` Vladislav Shpilevoy

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=8892a38d-0608-314f-b32d-531db3bd6de3@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=alyapunov@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=olegrok@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/2] tuple: fix multikey field JSON access crash' \
    /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