box: zap field_map_get_size
Turns out we don't really need it as we can use data_offset + bsize (i.e. the value returned by tuple_size() helper function) to get the size of a tuple to free. We only need to take into account the offset of the base tuple struct in the derived struct (memtx_tuple). There's a catch though: - We use sizeof(struct memtx_tuple) + field_map_size + bsize for allocation size. - We set data_offset to sizeof(struct tuple) + field_map_size. - struct tuple is packed, which makes its size 10 bytes. - memtx_tuple embeds struct tuple (base) at 4 byte offset, but since it is not packed, its size is 16 bytes, NOT 4 + 10 = 14 bytes as one might expect! - This means data_offset + bsize + offsetof(struct memtx_tuple, base) doesn't equal allocation size. To fix that, let's mark memtx_tuple packed. The only side effect it has is that we save 2 bytes per each memtx tuple. It won't affect tuple data layout at all, because struct memtx_tuple already has a packed layout and so 'packed' will only affect its size, which is only used for computing allocation size. My bad I overlooked it during review. Follow-up f1d9f257 ("box: introduce multikey indexes in memtx").
Showing
- src/box/field_map.c 0 additions, 18 deletionssrc/box/field_map.c
- src/box/field_map.h 0 additions, 13 deletionssrc/box/field_map.h
- src/box/memtx_engine.c 2 additions, 4 deletionssrc/box/memtx_engine.c
- src/box/tuple.c 1 addition, 2 deletionssrc/box/tuple.c
- test/box/errinj.result 9 additions, 9 deletionstest/box/errinj.result
- test/box/reconfigure.result 1 addition, 1 deletiontest/box/reconfigure.result
- test/box/upsert_errinj.result 1 addition, 1 deletiontest/box/upsert_errinj.result
- test/wal_off/tuple.result 1 addition, 1 deletiontest/wal_off/tuple.result
Loading
Please register or sign in to comment