From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 08/12] vinyl: remove pointless is_nullable initialization for disk_format Date: Sun, 1 Apr 2018 12:05:35 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: space->format and cmp_def must be compatible, i.e. space->format has is_nullable flag set for a field iff it is set for all key parts indexing this field. Therefore there's no point to set is_nullable for disk_format as it must have been initialized by tuple_format_create(). Remove the pointless loop. Also, while we are at it, fix the minor memory leak - disk_format is referenced twice for the primary key. --- src/box/vy_lsm.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/box/vy_lsm.c b/src/box/vy_lsm.c index 6cb722f4..88de1e61 100644 --- a/src/box/vy_lsm.c +++ b/src/box/vy_lsm.c @@ -147,18 +147,12 @@ vy_lsm_new(struct vy_lsm_env *lsm_env, struct vy_cache_env *cache_env, * definitions as well as space->format tuples. */ lsm->disk_format = format; - tuple_format_ref(format); } else { lsm->disk_format = tuple_format_new(&vy_tuple_format_vtab, &cmp_def, 1, 0, NULL, 0, NULL); if (lsm->disk_format == NULL) goto fail_format; - for (uint32_t i = 0; i < cmp_def->part_count; ++i) { - uint32_t fieldno = cmp_def->parts[i].fieldno; - lsm->disk_format->fields[fieldno].is_nullable = - format->fields[fieldno].is_nullable; - } } tuple_format_ref(lsm->disk_format); @@ -167,11 +161,10 @@ vy_lsm_new(struct vy_lsm_env *lsm_env, struct vy_cache_env *cache_env, vy_tuple_format_new_with_colmask(format); if (lsm->mem_format_with_colmask == NULL) goto fail_mem_format_with_colmask; - tuple_format_ref(lsm->mem_format_with_colmask); } else { lsm->mem_format_with_colmask = pk->mem_format_with_colmask; - tuple_format_ref(lsm->mem_format_with_colmask); } + tuple_format_ref(lsm->mem_format_with_colmask); if (vy_lsm_stat_create(&lsm->stat) != 0) goto fail_stat; -- 2.11.0