Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH 0/6] Get rid of the schema lock
@ 2019-06-30 19:40 Vladimir Davydov
  2019-06-30 19:40 ` [PATCH 1/6] Add ERROR_INJECT_YIELD and ERROR_INJECT_SLEEP helpers Vladimir Davydov
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Vladimir Davydov @ 2019-06-30 19:40 UTC (permalink / raw)
  To: kostja; +Cc: tarantool-patches

The schema lock was initially introduced to prevent a space from being
dropped while the memtx checkpoint thread dumps its content to a snap
file. Later on it was reused for syncing DDL-vs-DDL. Now we take it
before any statement involving _space, _index, and _truncate spaces.

This prevents us from batching several non-yielding DDL statements in
the same transaction (see #4083). For instance, suppose we want to
create a space and then an index for the space in the same transaction.
Then we would deadlock while trying to take the schema lock before
executing the second statement. We could, of course, make the lock
reentrant, but that would rather look like a hack.

Actually, we don't really need this lock for syncing checkpointing vs
DDL - we can simply postpone index destruction until after checkpointing
is complete. Moreover, all the necessary infrastructure has already been
implemented in the scope of #3408 ("Free tuples on space drop/truncate
in background fiber"). It also seems that we don't need this lock for
syncing DDL vs DDL, either, since instead we can lock individual spaces.

So this patch removes the schema lock altogether. This is a preparation
for transaction DDL (see #4083).

https://github.com/tarantool/tarantool/issues/4083
https://github.com/tarantool/tarantool/commits/dv/zap-schema-lock

Vladimir Davydov (6):
  Add ERROR_INJECT_YIELD and ERROR_INJECT_SLEEP helpers
  Replace ERRINJ_SNAP_WRITE_ROW_TIMEOUT with ERRINJ_SNAP_WRITE_DELAY
  Don't take schema lock for checkpointing
  test: make vinyl/replica_rejoin more stable
  vinyl: don't yield while logging index creation
  Replace schema lock with fine-grained locking

 src/box/alter.cc                   |  68 +++--------------
 src/box/alter.h                    |   3 -
 src/box/gc.c                       |   8 --
 src/box/memtx_engine.c             |  64 +++++++++-------
 src/box/memtx_engine.h             |   5 ++
 src/box/memtx_space.c              |  79 +++++++------------
 src/box/relay.cc                   |   6 +-
 src/box/schema.cc                  |  41 +++++-----
 src/box/schema.h                   |   6 --
 src/box/space.c                    |   2 -
 src/box/space.h                    |   7 +-
 src/box/txn.c                      |   3 -
 src/box/vinyl.c                    |  23 +-----
 src/box/vy_log.c                   |   6 +-
 src/box/vy_lsm.c                   |   4 +-
 src/box/vy_run.c                   |   6 +-
 src/box/vy_scheduler.c             |  22 ++----
 src/box/wal.c                      |   4 +-
 src/curl.c                         |   7 +-
 src/lib/core/errinj.h              |  12 ++-
 src/lib/core/latch.h               |  10 ---
 test/app-tap/snapshot.test.lua     |   5 +-
 test/box/errinj.result             |  38 +++++-----
 test/box/errinj.test.lua           |   6 +-
 test/box/on_replace.result         |   8 +-
 test/box/transaction.result        |   2 +-
 test/engine/errinj_ddl.result      | 152 +++++++++++++++++++++++++++++++++++++
 test/engine/errinj_ddl.test.lua    |  62 +++++++++++++++
 test/unit/vy_log_stub.c            |   3 +
 test/vinyl/errinj_vylog.result     |  23 +++++-
 test/vinyl/errinj_vylog.test.lua   |  10 ++-
 test/vinyl/replica_rejoin.result   | 119 ++++++++++++++---------------
 test/vinyl/replica_rejoin.test.lua |  34 +++++----
 test/xlog/errinj.result            |   4 +-
 test/xlog/errinj.test.lua          |   4 +-
 35 files changed, 489 insertions(+), 367 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2019-07-08  8:41 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-30 19:40 [PATCH 0/6] Get rid of the schema lock Vladimir Davydov
2019-06-30 19:40 ` [PATCH 1/6] Add ERROR_INJECT_YIELD and ERROR_INJECT_SLEEP helpers Vladimir Davydov
2019-07-03 19:12   ` Konstantin Osipov
2019-07-04 15:50     ` Vladimir Davydov
2019-06-30 19:40 ` [PATCH 2/6] Replace ERRINJ_SNAP_WRITE_ROW_TIMEOUT with ERRINJ_SNAP_WRITE_DELAY Vladimir Davydov
2019-07-03 19:13   ` Konstantin Osipov
2019-07-04 15:51     ` Vladimir Davydov
2019-06-30 19:40 ` [PATCH 3/6] Don't take schema lock for checkpointing Vladimir Davydov
2019-07-03 19:21   ` Konstantin Osipov
2019-07-03 20:05     ` Vladimir Davydov
2019-06-30 19:40 ` [PATCH 4/6] test: make vinyl/replica_rejoin more stable Vladimir Davydov
2019-07-03 19:23   ` Konstantin Osipov
2019-07-04 15:51     ` Vladimir Davydov
2019-06-30 19:40 ` [PATCH 5/6] vinyl: don't yield while logging index creation Vladimir Davydov
2019-06-30 19:40 ` [PATCH 6/6] Replace schema lock with fine-grained locking Vladimir Davydov
2019-07-03 19:35   ` Konstantin Osipov
2019-07-03 19:56     ` Vladimir Davydov
2019-07-04  8:09       ` Konstantin Osipov
2019-07-04 17:06         ` Vladimir Davydov
2019-07-08  7:40           ` Konstantin Osipov
2019-07-08  8:41             ` Vladimir Davydov
2019-07-05  8:53 ` [PATCH 0/6] Get rid of the schema lock Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox