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