[PATCH 06/12] vinyl: zap vy_lsm_validate_formats

Vladimir Davydov vdavydov.dev at gmail.com
Sun Apr 1 12:05:33 MSK 2018


We allocate index formats in the only place, vy_lsm_new, so there's no
point in this debug-only check anymore.
---
 src/box/vinyl.c  |  2 --
 src/box/vy_lsm.c | 25 -------------------------
 src/box/vy_lsm.h |  7 -------
 3 files changed, 34 deletions(-)

diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index f3cef52f..145fde70 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -1027,7 +1027,6 @@ vinyl_space_commit_alter(struct space *old_space, struct space *new_space)
 	assert(pk->pk == NULL);
 
 	pk->check_is_unique = true;
-	vy_lsm_validate_formats(pk);
 	key_def_update_optionality(pk->key_def, new_format->min_field_count);
 	key_def_update_optionality(pk->cmp_def, new_format->min_field_count);
 
@@ -1041,7 +1040,6 @@ vinyl_space_commit_alter(struct space *old_space, struct space *new_space)
 					   new_format->min_field_count);
 		key_def_update_optionality(lsm->cmp_def,
 					   new_format->min_field_count);
-		vy_lsm_validate_formats(lsm);
 	}
 
 	/*
diff --git a/src/box/vy_lsm.c b/src/box/vy_lsm.c
index 4b2c3ef3..6cb722f4 100644
--- a/src/box/vy_lsm.c
+++ b/src/box/vy_lsm.c
@@ -52,30 +52,6 @@
 #include "vy_upsert.h"
 #include "vy_read_set.h"
 
-void
-vy_lsm_validate_formats(const struct vy_lsm *lsm)
-{
-	(void) lsm;
-	assert(lsm->disk_format != NULL);
-	assert(lsm->mem_format != NULL);
-	assert(lsm->mem_format_with_colmask != NULL);
-	uint32_t index_field_count = lsm->mem_format->index_field_count;
-	(void) index_field_count;
-	if (lsm->index_id == 0) {
-		assert(lsm->disk_format == lsm->mem_format);
-		assert(lsm->disk_format->index_field_count ==
-		       index_field_count);
-		assert(lsm->mem_format_with_colmask->index_field_count ==
-		       index_field_count);
-	} else {
-		assert(lsm->disk_format != lsm->mem_format);
-		assert(lsm->disk_format->index_field_count <=
-		       index_field_count);
-	}
-	assert(lsm->mem_format_with_colmask->index_field_count ==
-	       index_field_count);
-}
-
 int
 vy_lsm_env_create(struct vy_lsm_env *env, const char *path,
 		  int64_t *p_generation,
@@ -232,7 +208,6 @@ vy_lsm_new(struct vy_lsm_env *lsm_env, struct vy_cache_env *cache_env,
 	vy_lsm_read_set_new(&lsm->read_set);
 
 	lsm_env->lsm_count++;
-	vy_lsm_validate_formats(lsm);
 	return lsm;
 
 fail_mem:
diff --git a/src/box/vy_lsm.h b/src/box/vy_lsm.h
index ab54da75..f5862a52 100644
--- a/src/box/vy_lsm.h
+++ b/src/box/vy_lsm.h
@@ -286,13 +286,6 @@ struct vy_lsm {
 	vy_lsm_read_set_t read_set;
 };
 
-/**
- * Assert if an LSM tree formats are inconsistent.
- * @param lsm LSM tree to validate.
- */
-void
-vy_lsm_validate_formats(const struct vy_lsm *lsm);
-
 /** Return LSM tree name. Used for logging. */
 const char *
 vy_lsm_name(struct vy_lsm *lsm);
-- 
2.11.0




More information about the Tarantool-patches mailing list