[patches] [PATCH 0/4] On space alter update key definitions in indexes

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon Mar 12 00:53:32 MSK 2018


Branch: http://github.com/tarantool/tarantool/tree/gh-3229-space-format-enables-optional
Issue: https://github.com/tarantool/tarantool/issues/3229

These patchset fixes a bug with changing optionality of indexed
fields by alteration of a space format.

For memtx a fix is trival - just check new min field count on a
space alter. But vinyl stores its own copies of key definitions
in multiple places: in index, mems, cache, ranges. And moreover,
it can not update key definition in place because of multithreaded
access to key_def from workers.

To solve the problem, the patchset allows reference counting of
key definitions, and a vinyl index on alter just takes new key
definitions, while existing tasks continue holding references to
old key definitions until complete, when a last task deletes old
key definition.

Vladislav Shpilevoy (4):
  memtx: check for new optional fields on format update
  Fix a pair of memory leaks
  key_def: add key_def reference counter
  vinyl: on space alter update key definitions in indexes

 src/box/alter.cc         | 24 +++++++++++++--
 src/box/index_def.c      | 14 +++------
 src/box/key_def.cc       | 16 ++++++++--
 src/box/key_def.h        | 11 +++++++
 src/box/schema.cc        |  4 +--
 src/box/vinyl.c          | 75 +++++++++++++++++++++++++++++++++++++++++++--
 src/box/vy_index.c       | 23 +++++---------
 src/box/vy_scheduler.c   | 19 ++++++++++--
 test/engine/ddl.result   | 79 ++++++++++++++++++++++++++++++++++++++++++++++++
 test/engine/ddl.test.lua | 26 ++++++++++++++++
 10 files changed, 255 insertions(+), 36 deletions(-)

-- 
2.14.3 (Apple Git-98)




More information about the Tarantool-patches mailing list