<HTML><BODY>Thanks for the patch!<br><br>LGTM<br>Sergos<br><br><br><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">
Wednesday, November 6, 2019 6:09 PM +03:00 from Vladislav Shpilevoy <v.shpilevoy@tarantool.org>:<br>
<br>
<div id="">
<div class="js-helper js-readmsg-msg">
<style type="text/css"></style>
<div>
<div id="style_15730529431974781170_BODY">That patch finishes transformation of tuple_update public API to<br>
xrow_update.<br>
<br>
Part of #1261<br>
---<br>
src/box/lua/tuple.c | 7 +++----<br>
src/box/memtx_space.c | 24 ++++++++++++------------<br>
src/box/space.c | 28 ++++++++++++++--------------<br>
src/box/tuple.c | 8 ++++----<br>
src/box/vinyl.c | 20 ++++++++++----------<br>
src/box/vy_upsert.c | 12 ++++++------<br>
src/box/xrow_update.c | 28 ++++++++++++++--------------<br>
src/box/xrow_update.h | 30 +++++++++++++++---------------<br>
test/unit/column_mask.c | 6 +++---<br>
9 files changed, 81 insertions(+), 82 deletions(-)<br>
<br>
diff --git a/src/box/lua/tuple.c b/src/box/lua/tuple.c<br>
index f97df4bc0..1f9d6e662 100644<br>
--- a/src/box/lua/tuple.c<br>
+++ b/src/box/lua/tuple.c<br>
@@ -410,7 +410,6 @@ lbox_tuple_transform(struct lua_State *L)<br>
op_cnt += argc - 3;<br>
<br>
if (op_cnt == 0) {<br>
- /* tuple_update() does not accept an empty operation list. */<br>
luaT_pushtuple(L, tuple);<br>
return 1;<br>
}<br>
@@ -454,9 +453,9 @@ lbox_tuple_transform(struct lua_State *L)<br>
* count or types.<br>
*/<br>
const char *new_data =<br>
- tuple_update_execute(buf->buf, buf->buf + ibuf_used(buf),<br>
- old_data, old_data + bsize, format->dict,<br>
- &new_size, 1, NULL);<br>
+ xrow_update_execute(buf->buf, buf->buf + ibuf_used(buf),<br>
+ old_data, old_data + bsize, format->dict,<br>
+ &new_size, 1, NULL);<br>
if (new_data != NULL)<br>
new_tuple = tuple_new(box_tuple_format_default(),<br>
new_data, new_data + new_size);<br>
diff --git a/src/box/memtx_space.c b/src/box/memtx_space.c<br>
index 86de4dada..6ef84e045 100644<br>
--- a/src/box/memtx_space.c<br>
+++ b/src/box/memtx_space.c<br>
@@ -391,9 +391,9 @@ memtx_space_execute_update(struct space *space, struct txn *txn,<br>
struct tuple_format *format = space->format;<br>
const char *old_data = tuple_data_range(old_tuple, &bsize);<br>
const char *new_data =<br>
- tuple_update_execute(request->tuple, request->tuple_end,<br>
- old_data, old_data + bsize, format->dict,<br>
- &new_size, request->index_base, NULL);<br>
+ xrow_update_execute(request->tuple, request->tuple_end,<br>
+ old_data, old_data + bsize, format->dict,<br>
+ &new_size, request->index_base, NULL);<br>
if (new_data == NULL)<br>
return -1;<br>
<br>
@@ -461,9 +461,9 @@ memtx_space_execute_upsert(struct space *space, struct txn *txn,<br>
* we get it here, it's also OK to throw it<br>
* @sa <a href="https://github.com/tarantool/tarantool/issues/1156" target="_blank">https://github.com/tarantool/tarantool/issues/1156</a><br>
*/<br>
- if (tuple_update_check_ops(request->ops, request->ops_end,<br>
- format->dict,<br>
- request->index_base) != 0) {<br>
+ if (xrow_update_check_ops(request->ops, request->ops_end,<br>
+ format->dict,<br>
+ request->index_base) != 0) {<br>
return -1;<br>
}<br>
stmt->new_tuple = memtx_tuple_new(format, request->tuple,<br>
@@ -476,17 +476,17 @@ memtx_space_execute_upsert(struct space *space, struct txn *txn,<br>
const char *old_data = tuple_data_range(old_tuple, &bsize);<br>
/*<br>
* Update the tuple.<br>
- * tuple_upsert_execute() fails on totally wrong<br>
+ * xrow_upsert_execute() fails on totally wrong<br>
* tuple ops, but ignores ops that not suitable<br>
* for the tuple.<br>
*/<br>
uint64_t column_mask = COLUMN_MASK_FULL;<br>
const char *new_data =<br>
- tuple_upsert_execute(request->ops, request->ops_end,<br>
- old_data, old_data + bsize,<br>
- format->dict, &new_size,<br>
- request->index_base, false,<br>
- &column_mask);<br>
+ xrow_upsert_execute(request->ops, request->ops_end,<br>
+ old_data, old_data + bsize,<br>
+ format->dict, &new_size,<br>
+ request->index_base, false,<br>
+ &column_mask);<br>
if (new_data == NULL)<br>
return -1;<br>
<br>
diff --git a/src/box/space.c b/src/box/space.c<br>
index f0c1f2ce8..94716a414 100644<br>
--- a/src/box/space.c<br>
+++ b/src/box/space.c<br>
@@ -395,11 +395,11 @@ space_before_replace(struct space *space, struct txn *txn,<br>
}<br>
old_data = tuple_data_range(old_tuple, &old_size);<br>
old_data_end = old_data + old_size;<br>
- new_data = tuple_update_execute(request->tuple,<br>
- request->tuple_end, old_data,<br>
- old_data_end,<br>
- space->format->dict, &new_size,<br>
- request->index_base, NULL);<br>
+ new_data = xrow_update_execute(request->tuple,<br>
+ request->tuple_end, old_data,<br>
+ old_data_end,<br>
+ space->format->dict, &new_size,<br>
+ request->index_base, NULL);<br>
if (new_data == NULL)<br>
return -1;<br>
new_data_end = new_data + new_size;<br>
@@ -419,20 +419,20 @@ space_before_replace(struct space *space, struct txn *txn,<br>
*/<br>
new_data = request->tuple;<br>
new_data_end = request->tuple_end;<br>
- if (tuple_update_check_ops(request->ops,<br>
- request->ops_end,<br>
- space->format->dict,<br>
- request->index_base) != 0)<br>
+ if (xrow_update_check_ops(request->ops,<br>
+ request->ops_end,<br>
+ space->format->dict,<br>
+ request->index_base) != 0)<br>
return -1;<br>
break;<br>
}<br>
old_data = tuple_data_range(old_tuple, &old_size);<br>
old_data_end = old_data + old_size;<br>
- new_data = tuple_upsert_execute(request->ops, request->ops_end,<br>
- old_data, old_data_end,<br>
- space->format->dict, &new_size,<br>
- request->index_base, false,<br>
- NULL);<br>
+ new_data = xrow_upsert_execute(request->ops, request->ops_end,<br>
+ old_data, old_data_end,<br>
+ space->format->dict, &new_size,<br>
+ request->index_base, false,<br>
+ NULL);<br>
new_data_end = new_data + new_size;<br>
break;<br>
default:<br>
diff --git a/src/box/tuple.c b/src/box/tuple.c<br>
index 04a723892..4d676b090 100644<br>
--- a/src/box/tuple.c<br>
+++ b/src/box/tuple.c<br>
@@ -691,8 +691,8 @@ box_tuple_update(box_tuple_t *tuple, const char *expr, const char *expr_end)<br>
size_t used = region_used(region);<br>
struct tuple_format *format = tuple_format(tuple);<br>
const char *new_data =<br>
- tuple_update_execute(expr, expr_end, old_data, old_data + bsize,<br>
- format->dict, &new_size, 1, NULL);<br>
+ xrow_update_execute(expr, expr_end, old_data, old_data + bsize,<br>
+ format->dict, &new_size, 1, NULL);<br>
if (new_data == NULL) {<br>
region_truncate(region, used);<br>
return NULL;<br>
@@ -713,8 +713,8 @@ box_tuple_upsert(box_tuple_t *tuple, const char *expr, const char *expr_end)<br>
size_t used = region_used(region);<br>
struct tuple_format *format = tuple_format(tuple);<br>
const char *new_data =<br>
- tuple_upsert_execute(expr, expr_end, old_data, old_data + bsize,<br>
- format->dict, &new_size, 1, false, NULL);<br>
+ xrow_upsert_execute(expr, expr_end, old_data, old_data + bsize,<br>
+ format->dict, &new_size, 1, false, NULL);<br>
if (new_data == NULL) {<br>
region_truncate(region, used);<br>
return NULL;<br>
diff --git a/src/box/vinyl.c b/src/box/vinyl.c<br>
index 2f0b548af..767e40006 100644<br>
--- a/src/box/vinyl.c<br>
+++ b/src/box/vinyl.c<br>
@@ -1891,10 +1891,10 @@ vy_update(struct vy_env *env, struct vy_tx *tx, struct txn_stmt *stmt,<br>
uint32_t new_size, old_size;<br>
const char *old_tuple = tuple_data_range(stmt->old_tuple, &old_size);<br>
const char *old_tuple_end = old_tuple + old_size;<br>
- new_tuple = tuple_update_execute(request->tuple, request->tuple_end,<br>
- old_tuple, old_tuple_end,<br>
- pk->mem_format->dict, &new_size,<br>
- request->index_base, &column_mask);<br>
+ new_tuple = xrow_update_execute(request->tuple, request->tuple_end,<br>
+ old_tuple, old_tuple_end,<br>
+ pk->mem_format->dict, &new_size,<br>
+ request->index_base, &column_mask);<br>
if (new_tuple == NULL)<br>
return -1;<br>
new_tuple_end = new_tuple + new_size;<br>
@@ -2071,9 +2071,9 @@ vy_upsert(struct vy_env *env, struct vy_tx *tx, struct txn_stmt *stmt,<br>
if (vy_is_committed(env, pk))<br>
return 0;<br>
/* Check update operations. */<br>
- if (tuple_update_check_ops(request->ops, request->ops_end,<br>
- pk->mem_format->dict,<br>
- request->index_base) != 0) {<br>
+ if (xrow_update_check_ops(request->ops, request->ops_end,<br>
+ pk->mem_format->dict,<br>
+ request->index_base) != 0) {<br>
return -1;<br>
}<br>
if (request->index_base != 0) {<br>
@@ -2130,9 +2130,9 @@ vy_upsert(struct vy_env *env, struct vy_tx *tx, struct txn_stmt *stmt,<br>
old_tuple_end = old_tuple + old_size;<br>
<br>
/* Apply upsert operations to the old tuple. */<br>
- new_tuple = tuple_upsert_execute(ops, ops_end, old_tuple, old_tuple_end,<br>
- pk->mem_format->dict, &new_size, 0,<br>
- false, &column_mask);<br>
+ new_tuple = xrow_upsert_execute(ops, ops_end, old_tuple, old_tuple_end,<br>
+ pk->mem_format->dict, &new_size, 0,<br>
+ false, &column_mask);<br>
if (new_tuple == NULL)<br>
return -1;<br>
/*<br>
diff --git a/src/box/vy_upsert.c b/src/box/vy_upsert.c<br>
index 5b4a75d25..9a47dd91e 100644<br>
--- a/src/box/vy_upsert.c<br>
+++ b/src/box/vy_upsert.c<br>
@@ -57,9 +57,9 @@ vy_upsert_try_to_squash(struct tuple_format *format,<br>
<br>
size_t squashed_size;<br>
const char *squashed =<br>
- tuple_upsert_squash(old_serie, old_serie_end,<br>
- new_serie, new_serie_end, format->dict,<br>
- &squashed_size, 0);<br>
+ xrow_upsert_squash(old_serie, old_serie_end,<br>
+ new_serie, new_serie_end, format->dict,<br>
+ &squashed_size, 0);<br>
if (squashed == NULL)<br>
return 0;<br>
/* Successful squash! */<br>
@@ -118,9 +118,9 @@ vy_apply_upsert(struct tuple *new_stmt, struct tuple *old_stmt,<br>
size_t region_svp = region_used(region);<br>
uint8_t old_type = vy_stmt_type(old_stmt);<br>
uint64_t column_mask = COLUMN_MASK_FULL;<br>
- result_mp = tuple_upsert_execute(new_ops, new_ops_end, result_mp,<br>
- result_mp_end, format->dict, &mp_size,<br>
- 0, suppress_error, &column_mask);<br>
+ result_mp = xrow_upsert_execute(new_ops, new_ops_end, result_mp,<br>
+ result_mp_end, format->dict, &mp_size,<br>
+ 0, suppress_error, &column_mask);<br>
result_mp_end = result_mp + mp_size;<br>
if (old_type != IPROTO_UPSERT) {<br>
assert(old_type == IPROTO_INSERT ||<br>
diff --git a/src/box/xrow_update.c b/src/box/xrow_update.c<br>
index 958ed1c99..6cfdab822 100644<br>
--- a/src/box/xrow_update.c<br>
+++ b/src/box/xrow_update.c<br>
@@ -1354,8 +1354,8 @@ xrow_update_finish(struct xrow_update *update, uint32_t *p_tuple_len)<br>
}<br>
<br>
int<br>
-tuple_update_check_ops(const char *expr, const char *expr_end,<br>
- struct tuple_dictionary *dict, int index_base)<br>
+xrow_update_check_ops(const char *expr, const char *expr_end,<br>
+ struct tuple_dictionary *dict, int index_base)<br>
{<br>
struct xrow_update update;<br>
xrow_update_init(&update, index_base);<br>
@@ -1363,10 +1363,10 @@ tuple_update_check_ops(const char *expr, const char *expr_end,<br>
}<br>
<br>
const char *<br>
-tuple_update_execute(const char *expr,const char *expr_end,<br>
- const char *old_data, const char *old_data_end,<br>
- struct tuple_dictionary *dict, uint32_t *p_tuple_len,<br>
- int index_base, uint64_t *column_mask)<br>
+xrow_update_execute(const char *expr,const char *expr_end,<br>
+ const char *old_data, const char *old_data_end,<br>
+ struct tuple_dictionary *dict, uint32_t *p_tuple_len,<br>
+ int index_base, uint64_t *column_mask)<br>
{<br>
struct xrow_update update;<br>
xrow_update_init(&update, index_base);<br>
@@ -1384,10 +1384,10 @@ tuple_update_execute(const char *expr,const char *expr_end,<br>
}<br>
<br>
const char *<br>
-tuple_upsert_execute(const char *expr,const char *expr_end,<br>
- const char *old_data, const char *old_data_end,<br>
- struct tuple_dictionary *dict, uint32_t *p_tuple_len,<br>
- int index_base, bool suppress_error, uint64_t *column_mask)<br>
+xrow_upsert_execute(const char *expr,const char *expr_end,<br>
+ const char *old_data, const char *old_data_end,<br>
+ struct tuple_dictionary *dict, uint32_t *p_tuple_len,<br>
+ int index_base, bool suppress_error, uint64_t *column_mask)<br>
{<br>
struct xrow_update update;<br>
xrow_update_init(&update, index_base);<br>
@@ -1406,10 +1406,10 @@ tuple_upsert_execute(const char *expr,const char *expr_end,<br>
}<br>
<br>
const char *<br>
-tuple_upsert_squash(const char *expr1, const char *expr1_end,<br>
- const char *expr2, const char *expr2_end,<br>
- struct tuple_dictionary *dict, size_t *result_size,<br>
- int index_base)<br>
+xrow_upsert_squash(const char *expr1, const char *expr1_end,<br>
+ const char *expr2, const char *expr2_end,<br>
+ struct tuple_dictionary *dict, size_t *result_size,<br>
+ int index_base)<br>
{<br>
const char *expr[2] = {expr1, expr2};<br>
const char *expr_end[2] = {expr1_end, expr2_end};<br>
diff --git a/src/box/xrow_update.h b/src/box/xrow_update.h<br>
index 3aac74e60..74e068e8f 100644<br>
--- a/src/box/xrow_update.h<br>
+++ b/src/box/xrow_update.h<br>
@@ -47,21 +47,21 @@ enum {<br>
struct tuple_dictionary;<br>
<br>
int<br>
-tuple_update_check_ops(const char *expr, const char *expr_end,<br>
- struct tuple_dictionary *dict, int index_base);<br>
+xrow_update_check_ops(const char *expr, const char *expr_end,<br>
+ struct tuple_dictionary *dict, int index_base);<br>
<br>
const char *<br>
-tuple_update_execute(const char *expr,const char *expr_end,<br>
- const char *old_data, const char *old_data_end,<br>
- struct tuple_dictionary *dict, uint32_t *p_new_size,<br>
- int index_base, uint64_t *column_mask);<br>
+xrow_update_execute(const char *expr,const char *expr_end,<br>
+ const char *old_data, const char *old_data_end,<br>
+ struct tuple_dictionary *dict, uint32_t *p_new_size,<br>
+ int index_base, uint64_t *column_mask);<br>
<br>
const char *<br>
-tuple_upsert_execute(const char *expr, const char *expr_end,<br>
- const char *old_data, const char *old_data_end,<br>
- struct tuple_dictionary *dict, uint32_t *p_new_size,<br>
- int index_base, bool suppress_error,<br>
- uint64_t *column_mask);<br>
+xrow_upsert_execute(const char *expr, const char *expr_end,<br>
+ const char *old_data, const char *old_data_end,<br>
+ struct tuple_dictionary *dict, uint32_t *p_new_size,<br>
+ int index_base, bool suppress_error,<br>
+ uint64_t *column_mask);<br>
<br>
/**<br>
* Try to merge two update/upsert expressions to an equivalent one.<br>
@@ -74,10 +74,10 @@ tuple_upsert_execute(const char *expr, const char *expr_end,<br>
* If it isn't possible to merge expressions NULL is returned.<br>
*/<br>
const char *<br>
-tuple_upsert_squash(const char *expr1, const char *expr1_end,<br>
- const char *expr2, const char *expr2_end,<br>
- struct tuple_dictionary *dict, size_t *result_size,<br>
- int index_base);<br>
+xrow_upsert_squash(const char *expr1, const char *expr1_end,<br>
+ const char *expr2, const char *expr2_end,<br>
+ struct tuple_dictionary *dict, size_t *result_size,<br>
+ int index_base);<br>
<br>
#if defined(__cplusplus)<br>
} /* extern "C" */<br>
diff --git a/test/unit/column_mask.c b/test/unit/column_mask.c<br>
index b3047860e..3beef5ce0 100644<br>
--- a/test/unit/column_mask.c<br>
+++ b/test/unit/column_mask.c<br>
@@ -129,9 +129,9 @@ check_update_result(const struct tuple_template *original,<br>
uint64_t column_mask;<br>
struct region *region = &fiber()->gc;<br>
const char *actual =<br>
- tuple_update_execute(ops, ops_end, old, old_end,<br>
- box_tuple_format_default()->dict,<br>
- &actual_len, 1, &column_mask);<br>
+ xrow_update_execute(ops, ops_end, old, old_end,<br>
+ box_tuple_format_default()->dict,<br>
+ &actual_len, 1, &column_mask);<br>
fail_if(actual == NULL);<br>
is((int32_t)actual_len, new_end - new, "check result length");<br>
is(memcmp(actual, new, actual_len), 0, "tuple update is correct");<br>
-- <br>
2.21.0 (Apple Git-122.2)<br>
<br>
</div>
</div>
</div>
</div>
</blockquote>
<br></BODY></HTML>