Skip to content
Snippets Groups Projects
Commit 561b5559 authored by Georgiy Lebedev's avatar Georgiy Lebedev Committed by Aleksandr Lyapunov
Browse files

merger: handle `MP_TUPLE` extension in merge buffer source `next` method

In scope of tarantool/tarantool#8147, a new context-dependent extension for
box tuples, `MP_TUPLE`, is introduced. The buffer source uses a buffer with
raw MsgPack, which does not allow for passing the context required for
decoding `MP_TUPLE`, so, in order to decode it, we need to manually skip
the extension header and the tuple format identifier to get to the tuple
data and create a tuple. We can ignore the tuple format identifier (and the
tuple format that was originally sent for this tuple), since the format is
provided by the merger itself.

Needed for #8147

NO_CHANGELOG=<internal change>
NO_TEST=<tested by integration tests>
NO_DOC=<internal change>
parent 9f023095
No related branches found
No related tags found
No related merge requests found
......@@ -598,6 +598,22 @@ luaL_merge_source_buffer_next(struct merge_source *base,
--source->remaining_tuple_count;
if (format == NULL)
format = tuple_format_runtime;
/*
* If we encounter an MP_TUPLE, skip the extension header and the tuple
* format identifier.
*/
if (mp_typeof(*tuple_beg) == MP_EXT) {
int8_t type;
mp_decode_extl(&tuple_beg, &type);
if (type != MP_TUPLE) {
diag_set(IllegalParams,
"Unexpected MsgPack extension type "
"(should be MP_TUPLE)");
return -1;
}
/* Skip the tuple format identifier. */
mp_decode_uint(&tuple_beg);
}
struct tuple *tuple = tuple_new(format, tuple_beg, tuple_end);
ibuf_consume_before(source->buf, tuple_end);
if (tuple == NULL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment