Do not update schema_version on space:truncate().
Schema version is used by both clients and internal modules to check whether there vere any updates in spaces and indices. While clients only need to be notified when there is a noticeable change, e.g. space is removed, internal components also need to be notified when something like space:truncate() happens, because even though this operation doesn't change space id or any of its indices, it creates a new space object, so all the pointers to the old object have to be updated. Currently both clients and internals share the same schema version, which leads to unnecessary updates on the client side. Fix this by implementing 2 separate counters for internal and public use: schema_state gets updated on every change, including recreation of the same space object, while schema_version is updated only when there are noticable changes for the clients. Introduce a new AlterOp to alter.cc to update public schema_version. Now all the internals reference schema_state, while all the clients use schema_version. box.iternal.schema_version() returns schema_version (the public one). Closes: #3414
Showing
- src/box/alter.cc 38 additions, 0 deletionssrc/box/alter.cc
- src/box/index.cc 5 additions, 5 deletionssrc/box/index.cc
- src/box/index.h 5 additions, 5 deletionssrc/box/index.h
- src/box/schema.cc 10 additions, 2 deletionssrc/box/schema.cc
- src/box/schema.h 4 additions, 3 deletionssrc/box/schema.h
- src/box/sysview_index.c 1 addition, 1 deletionsrc/box/sysview_index.c
- src/box/vy_index.c 2 additions, 2 deletionssrc/box/vy_index.c
- src/box/vy_mem.c 2 additions, 2 deletionssrc/box/vy_mem.c
- src/box/vy_mem.h 4 additions, 4 deletionssrc/box/vy_mem.h
- src/box/vy_tx.c 3 additions, 3 deletionssrc/box/vy_tx.c
- test/engine/ddl.result 57 additions, 0 deletionstest/engine/ddl.result
- test/engine/ddl.test.lua 24 additions, 0 deletionstest/engine/ddl.test.lua
- test/unit/vy_point_lookup.c 1 addition, 0 deletionstest/unit/vy_point_lookup.c
Loading
Please register or sign in to comment