Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: kostja@tarantool.org
Cc: tarantool-patches@freelists.org
Subject: [PATCH v2 14/14] tuple_format: zap min_tuple_size
Date: Wed, 13 Mar 2019 11:53:00 +0300	[thread overview]
Message-ID: <ec9c6c0b40536e080eb0466a2d2c3e73bebb451d.1552464666.git.vdavydov.dev@gmail.com> (raw)
In-Reply-To: <cover.1552464666.git.vdavydov.dev@gmail.com>
In-Reply-To: <cover.1552464666.git.vdavydov.dev@gmail.com>

It had been used only in Vinyl's vy_stmt_new_surrogate_from_key, which
was deleted by the previous patches, so we can drop it as well.
---
 src/box/tuple_format.c | 40 ----------------------------------------
 src/box/tuple_format.h |  5 -----
 2 files changed, 45 deletions(-)

diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c
index 4439ce3e..22a84af8 100644
--- a/src/box/tuple_format.c
+++ b/src/box/tuple_format.c
@@ -441,7 +441,6 @@ tuple_format_create(struct tuple_format *format, struct key_def * const *keys,
 			 "malloc", "required field bitmap");
 		return -1;
 	}
-	format->min_tuple_size = mp_sizeof_array(format->index_field_count);
 	struct tuple_field *field;
 	json_tree_foreach_entry_preorder(field, &format->fields.root,
 					 struct tuple_field, token) {
@@ -453,44 +452,6 @@ tuple_format_create(struct tuple_format *format, struct key_def * const *keys,
 		if (json_token_is_leaf(&field->token) &&
 		    !tuple_field_is_nullable(field))
 			bit_set(format->required_fields, field->id);
-
-		/*
-		 * Update format::min_tuple_size by field.
-		 * Skip fields not involved in index.
-		 */
-		if (!field->is_key_part)
-			continue;
-		if (field->token.type == JSON_TOKEN_NUM) {
-			/*
-			 * Account a gap between omitted array
-			 * items.
-			 */
-			struct json_token **neighbors =
-				field->token.parent->children;
-			for (int i = field->token.sibling_idx - 1; i >= 0; i--) {
-				if (neighbors[i] != NULL &&
-				    json_tree_entry(neighbors[i],
-						    struct tuple_field,
-						    token)->is_key_part)
-					break;
-				format->min_tuple_size += mp_sizeof_nil();
-			}
-		} else {
-			/* Account a key string for map member. */
-			assert(field->token.type == JSON_TOKEN_STR);
-			format->min_tuple_size +=
-				mp_sizeof_str(field->token.len);
-		}
-		int max_child_idx = field->token.max_child_idx;
-		if (json_token_is_leaf(&field->token)) {
-			format->min_tuple_size += mp_sizeof_nil();
-		} else if (field->type == FIELD_TYPE_ARRAY) {
-			format->min_tuple_size +=
-				mp_sizeof_array(max_child_idx + 1);
-		} else if (field->type == FIELD_TYPE_MAP) {
-			format->min_tuple_size +=
-				mp_sizeof_map(max_child_idx + 1);
-		}
 	}
 	format->hash = tuple_format_hash(format);
 	return 0;
@@ -623,7 +584,6 @@ tuple_format_alloc(struct key_def * const *keys, uint16_t key_count,
 	format->total_field_count = field_count;
 	format->required_fields = NULL;
 	format->fields_depth = 1;
-	format->min_tuple_size = 0;
 	format->refs = 0;
 	format->id = FORMAT_ID_NIL;
 	format->index_field_count = index_field_count;
diff --git a/src/box/tuple_format.h b/src/box/tuple_format.h
index 5c5fdbd3..22a0fb23 100644
--- a/src/box/tuple_format.h
+++ b/src/box/tuple_format.h
@@ -203,11 +203,6 @@ struct tuple_format {
 	 */
 	struct tuple_dictionary *dict;
 	/**
-	 * The size of a minimal tuple conforming to the format
-	 * and filled with nils.
-	 */
-	uint32_t min_tuple_size;
-	/**
 	 * A maximum depth of format::fields subtree.
 	 */
 	uint32_t fields_depth;
-- 
2.11.0

  parent reply	other threads:[~2019-03-13  8:53 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13  8:52 [PATCH v2 00/14] vinyl: do not fill secondary tuples with nulls Vladimir Davydov
2019-03-13  8:52 ` [PATCH v2 01/14] vinyl: remove optimized comparators Vladimir Davydov
2019-03-13  8:55   ` Konstantin Osipov
2019-03-13  8:52 ` [PATCH v2 02/14] vinyl: introduce statement environment Vladimir Davydov
2019-03-13  8:58   ` Konstantin Osipov
2019-03-13  9:19     ` Vladimir Davydov
2019-03-13  8:52 ` [PATCH v2 03/14] vinyl: rename key stmt construction routine Vladimir Davydov
2019-03-13  8:59   ` Konstantin Osipov
2019-03-13  8:52 ` [PATCH v2 04/14] vinyl: don't use IPROTO_SELECT type for key statements Vladimir Davydov
2019-03-13  9:00   ` Konstantin Osipov
2019-03-13  8:52 ` [PATCH v2 05/14] bloom: do not use tuple_common_key_parts when constructing tuple bloom Vladimir Davydov
2019-03-13 11:52   ` Konstantin Osipov
2019-03-13  8:52 ` [PATCH v2 06/14] bloom: factor out helper to add tuple hash to bloom builder Vladimir Davydov
2019-03-13 11:52   ` Konstantin Osipov
2019-03-13  8:52 ` [PATCH v2 07/14] vinyl: add helpers to add/check statement with bloom Vladimir Davydov
2019-03-13 11:59   ` Konstantin Osipov
2019-03-13 12:25     ` Vladimir Davydov
2019-03-13  8:52 ` [PATCH v2 08/14] vinyl: do not pass format to vy_apply_upsert Vladimir Davydov
2019-03-13 12:00   ` Konstantin Osipov
2019-03-13  8:52 ` [PATCH v2 09/14] vinyl: clean up write iterator source destruction Vladimir Davydov
2019-03-13 12:05   ` Konstantin Osipov
2019-03-13  8:52 ` [PATCH v2 10/14] vinyl: zap vy_write_iterator->format Vladimir Davydov
2019-03-13 12:06   ` Konstantin Osipov
2019-03-13  8:52 ` [PATCH v2 11/14] vinyl: do not fill secondary tuples with nulls when decoded Vladimir Davydov
2019-03-13 12:25   ` Konstantin Osipov
2019-03-13 12:45     ` Vladimir Davydov
2019-03-13 12:56       ` Konstantin Osipov
2019-03-13  8:52 ` [PATCH v2 12/14] vinyl: zap vy_stmt_new_surrogate_from_key Vladimir Davydov
2019-03-13 12:27   ` Konstantin Osipov
2019-03-13  8:52 ` [PATCH v2 13/14] vinyl: don't use vy_stmt_new_surrogate_delete if not necessary Vladimir Davydov
2019-03-13 12:28   ` Konstantin Osipov
2019-03-13  8:53 ` Vladimir Davydov [this message]
2019-03-13 12:28   ` [PATCH v2 14/14] tuple_format: zap min_tuple_size Konstantin Osipov
2019-03-13 15:54 ` [PATCH v2 00/14] vinyl: do not fill secondary tuples with nulls Vladimir Davydov

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=ec9c6c0b40536e080eb0466a2d2c3e73bebb451d.1552464666.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH v2 14/14] tuple_format: zap min_tuple_size' \
    /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