commit d9e0b58aac518b4ac2d6df57c450b9ccacb40933 from: Vladimir Davydov via: Vladimir Davydov date: Wed Feb 28 09:28:51 2024 UTC alter: move format compatibility check to space_check_format We assume that if the new format can store tuples matching the old format, we can update the space format without calling the engine check_format callback. This is true for both memtx and vinyl but not for memcs (EE), which doesn't support extending field types (e.g. changing int16 to int32). Let's call the engine check_format callback unconditionally and let it decide whether tuple format checking can be skipped. Needed for tarantool/tarantool-ee#694 NO_DOC=refactoring NO_TEST=refactoring NO_CHANGELOG=refactoring commit - 94d2813841a649d5254974dd921aed01af1b24d4 commit + d9e0b58aac518b4ac2d6df57c450b9ccacb40933 blob - 01ae6f506c72cf352322e3f0c9655c5e63ecd05c blob + 1e2cecf49fdeb624efcb8c5b4e818d908e1298a5 --- src/box/alter.cc +++ src/box/alter.cc @@ -1120,9 +1120,7 @@ CheckSpaceFormat::prepare(struct alter_space *alter) key_def)) diag_raise(); } - if (!tuple_format1_can_store_format2_tuples(new_format, - old_format)) - space_check_format_with_yield(old_space, new_format); + space_check_format_with_yield(old_space, new_format); } } blob - b9b7f5e1dffd898e26a4bd7dd30753c914c08ac7 blob + 6cbb56581efe35e59fab356fec97fb85c1c4f649 --- src/box/memtx_space.c +++ src/box/memtx_space.c @@ -1008,6 +1008,8 @@ memtx_space_check_format(struct space *space, struct t { struct txn *txn = in_txn(); + if (tuple_format1_can_store_format2_tuples(format, space->format)) + return 0; if (space->index_count == 0) return 0; struct index *pk = space->index[0]; blob - 2eddaebb954dbf34847e06d17fcd137186c605be blob + fcd3c69fc6e56e079ba87a25208bf14bea8e5cd6 --- src/box/vinyl.c +++ src/box/vinyl.c @@ -1066,6 +1066,8 @@ vinyl_space_check_format(struct space *space, struct t struct vy_env *env = vy_env(space->engine); struct txn *txn = in_txn(); + if (tuple_format1_can_store_format2_tuples(format, space->format)) + return 0; /* * If this is local recovery, the space was checked before * restart so there's nothing we need to do.