Skip to content

Commit 88c9567

Browse files
committed
box: apply space upgrade function before updating tuple
If the space is being upgraded, UPDATE/UPSERT requests matching the new space format should work. However, currently they wouldn't work unless the target tuple has already been upgraded, because we don't apply the upgrade function to a tuple fetched from the space before applying UPDATE operations. Fix this. Follow-up commit 21e2def ("box: introduce result processor"). Needed for tarantool/tarantool-ee#111 NO_DOC=ee NO_TEST=ee NO_CHANGELOG=ee
1 parent f7a520e commit 88c9567

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/box/memtx_space.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,10 @@ memtx_space_execute_update(struct space *space, struct txn *txn,
467467
struct tuple *decompressed = memtx_tuple_maybe_decompress(old_tuple);
468468
if (decompressed == NULL)
469469
return -1;
470-
tuple_ref(decompressed);
470+
tuple_bless(decompressed);
471+
decompressed = result_process(space, decompressed);
472+
if (decompressed == NULL)
473+
return -1;
471474

472475
/* Update the tuple; legacy, request ops are in request->tuple */
473476
uint32_t new_size = 0, bsize;
@@ -477,7 +480,6 @@ memtx_space_execute_update(struct space *space, struct txn *txn,
477480
xrow_update_execute(request->tuple, request->tuple_end,
478481
old_data, old_data + bsize, format,
479482
&new_size, request->index_base, NULL);
480-
tuple_unref(decompressed);
481483
if (new_data == NULL)
482484
return -1;
483485

@@ -565,7 +567,10 @@ memtx_space_execute_upsert(struct space *space, struct txn *txn,
565567
memtx_tuple_maybe_decompress(old_tuple);
566568
if (decompressed == NULL)
567569
return -1;
568-
tuple_ref(decompressed);
570+
tuple_bless(decompressed);
571+
decompressed = result_process(space, decompressed);
572+
if (decompressed == NULL)
573+
return -1;
569574

570575
uint32_t new_size = 0, bsize;
571576
const char *old_data = tuple_data_range(decompressed, &bsize);
@@ -582,7 +587,6 @@ memtx_space_execute_upsert(struct space *space, struct txn *txn,
582587
format, &new_size,
583588
request->index_base, false,
584589
&column_mask);
585-
tuple_unref(decompressed);
586590
if (new_data == NULL)
587591
return -1;
588592

0 commit comments

Comments
 (0)