From: Vladimir Davydov <vdavydov.dev@gmail.com> To: kostja@tarantool.org Cc: tarantool-patches@freelists.org Subject: [PATCH 2/6] Replace ERRINJ_SNAP_WRITE_ROW_TIMEOUT with ERRINJ_SNAP_WRITE_DELAY Date: Sun, 30 Jun 2019 22:40:15 +0300 [thread overview] Message-ID: <261dbd467f492c233f2339f401e25fc148a2abe3.1561922496.git.vdavydov.dev@gmail.com> (raw) In-Reply-To: <cover.1561922496.git.vdavydov.dev@gmail.com> In-Reply-To: <cover.1561922496.git.vdavydov.dev@gmail.com> Timeout injections are unstable and difficult to use. Injecting a delay is much more convenient. --- src/box/memtx_engine.c | 6 +----- src/lib/core/errinj.h | 4 ++-- test/box/errinj.result | 38 +++++++++++++++++++------------------- test/box/errinj.test.lua | 6 +++--- test/xlog/errinj.result | 4 ++-- test/xlog/errinj.test.lua | 4 ++-- 6 files changed, 29 insertions(+), 33 deletions(-) diff --git a/src/box/memtx_engine.c b/src/box/memtx_engine.c index c60f831c..e259bf62 100644 --- a/src/box/memtx_engine.c +++ b/src/box/memtx_engine.c @@ -497,11 +497,6 @@ memtx_engine_bootstrap(struct engine *engine) static int checkpoint_write_row(struct xlog *l, struct xrow_header *row) { - struct errinj *errinj = errinj(ERRINJ_SNAP_WRITE_ROW_TIMEOUT, - ERRINJ_DOUBLE); - if (errinj != NULL && errinj->dparam > 0) - usleep(errinj->dparam * 1000000); - static ev_tstamp last = 0; if (last == 0) { ev_now_update(loop()); @@ -674,6 +669,7 @@ checkpoint_f(va_list ap) return -1; say_info("saving snapshot `%s'", snap.filename); + ERROR_INJECT_SLEEP(ERRINJ_SNAP_WRITE_DELAY); struct checkpoint_entry *entry; rlist_foreach_entry(entry, &ckpt->entries, link) { uint32_t size; diff --git a/src/lib/core/errinj.h b/src/lib/core/errinj.h index a55f583c..3933e1e3 100644 --- a/src/lib/core/errinj.h +++ b/src/lib/core/errinj.h @@ -117,8 +117,8 @@ struct errinj { _(ERRINJ_IPROTO_TX_DELAY, ERRINJ_BOOL, {.bparam = false}) \ _(ERRINJ_HTTPC_EXECUTE, ERRINJ_BOOL, {.bparam = false}) \ _(ERRINJ_LOG_ROTATE, ERRINJ_BOOL, {.bparam = false}) \ - _(ERRINJ_SNAP_COMMIT_DELAY, ERRINJ_BOOL, {.bparam = 0}) \ - _(ERRINJ_SNAP_WRITE_ROW_TIMEOUT, ERRINJ_DOUBLE, {.dparam = 0}) \ + _(ERRINJ_SNAP_WRITE_DELAY, ERRINJ_BOOL, {.bparam = false}) \ + _(ERRINJ_SNAP_COMMIT_DELAY, ERRINJ_BOOL, {.bparam = false}) \ _(ERRINJ_HTTP_RESPONSE_ADD_WAIT, ERRINJ_BOOL, {.bparam = false}) \ _(ERRINJ_VY_LOG_FILE_RENAME, ERRINJ_BOOL, {.bparam = false}) \ _(ERRINJ_VY_RUN_FILE_RENAME, ERRINJ_BOOL, {.bparam = false}) \ diff --git a/test/box/errinj.result b/test/box/errinj.result index 6c5af29e..cb463e1a 100644 --- a/test/box/errinj.result +++ b/test/box/errinj.result @@ -20,12 +20,12 @@ errinj.info() state: false ERRINJ_VYRUN_DATA_READ: state: false - ERRINJ_SNAP_WRITE_ROW_TIMEOUT: - state: 0 ERRINJ_SQL_NAME_NORMALIZATION: state: false ERRINJ_VY_SCHED_TIMEOUT: state: 0 + ERRINJ_COIO_SENDFILE_CHUNK: + state: -1 ERRINJ_WAL_WRITE_PARTIAL: state: -1 ERRINJ_VY_GC: @@ -36,34 +36,34 @@ errinj.info() state: -1 ERRINJ_WAL_WRITE_EOF: state: false - ERRINJ_COIO_SENDFILE_CHUNK: - state: -1 + ERRINJ_VY_LOG_FILE_RENAME: + state: false ERRINJ_VYRUN_INDEX_GARBAGE: state: false ERRINJ_BUILD_INDEX_DELAY: state: false - ERRINJ_VY_RUN_FILE_RENAME: - state: false ERRINJ_BUILD_INDEX: state: -1 - ERRINJ_RELAY_BREAK_LSN: - state: -1 + ERRINJ_VY_INDEX_FILE_RENAME: + state: false + ERRINJ_CHECK_FORMAT_DELAY: + state: false ERRINJ_VY_DELAY_PK_LOOKUP: state: false ERRINJ_VY_TASK_COMPLETE: state: false ERRINJ_PORT_DUMP: state: false - ERRINJ_CHECK_FORMAT_DELAY: + ERRINJ_VY_DUMP_DELAY: state: false ERRINJ_WAL_IO: state: false ERRINJ_WAL_FALLOCATE: state: 0 - ERRINJ_VY_DUMP_DELAY: - state: false ERRINJ_WAL_BREAK_LSN: state: -1 + ERRINJ_RELAY_BREAK_LSN: + state: -1 ERRINJ_TUPLE_FORMAT_COUNT: state: -1 ERRINJ_TUPLE_ALLOC: @@ -74,7 +74,7 @@ errinj.info() state: false ERRINJ_RELAY_REPORT_INTERVAL: state: 0 - ERRINJ_VY_INDEX_FILE_RENAME: + ERRINJ_VY_RUN_FILE_RENAME: state: false ERRINJ_VY_READ_PAGE_TIMEOUT: state: 0 @@ -82,14 +82,14 @@ errinj.info() state: false ERRINJ_SIO_READ_MAX: state: -1 - ERRINJ_VY_LOG_FILE_RENAME: - state: false - ERRINJ_WAL_WRITE_DISK: - state: false ERRINJ_HTTP_RESPONSE_ADD_WAIT: state: false + ERRINJ_WAL_WRITE_DISK: + state: false ERRINJ_SNAP_COMMIT_DELAY: state: false + ERRINJ_SNAP_WRITE_DELAY: + state: false ERRINJ_VY_RUN_WRITE: state: false ERRINJ_LOG_ROTATE: @@ -1485,7 +1485,7 @@ for i = 1, count do box.space.tmp:insert{i, pad} end c = fiber.channel(1) --- ... -box.error.injection.set('ERRINJ_SNAP_WRITE_ROW_TIMEOUT', 0.01) +box.error.injection.set('ERRINJ_SNAP_WRITE_DELAY', true) --- - ok ... @@ -1504,7 +1504,7 @@ _ = collectgarbage('collect') for i = 1, count do box.space.tmp:insert{i, pad} end --- ... -box.error.injection.set('ERRINJ_SNAP_WRITE_ROW_TIMEOUT', 0) +box.error.injection.set('ERRINJ_SNAP_WRITE_DELAY', false) --- - ok ... @@ -1549,7 +1549,7 @@ _ = box.space.test:create_index('primary') for i = 1, 10 do box.space.test:insert{i} end --- ... -errinj.set('ERRINJ_SNAP_WRITE_ROW_TIMEOUT', 9000) +errinj.set('ERRINJ_SNAP_WRITE_DELAY', true) --- - ok ... diff --git a/test/box/errinj.test.lua b/test/box/errinj.test.lua index 386d2beb..093168b7 100644 --- a/test/box/errinj.test.lua +++ b/test/box/errinj.test.lua @@ -501,7 +501,7 @@ for i = 1, count do box.space.tmp:insert{i, pad} end -- Start background snapshot. c = fiber.channel(1) -box.error.injection.set('ERRINJ_SNAP_WRITE_ROW_TIMEOUT', 0.01) +box.error.injection.set('ERRINJ_SNAP_WRITE_DELAY', true) _ = fiber.create(function() box.snapshot() c:put(true) end) -- Overwrite data stored in the temporary space while snapshot @@ -511,7 +511,7 @@ for i = 1, count do box.space.tmp:delete{i} end _ = collectgarbage('collect') for i = 1, count do box.space.tmp:insert{i, pad} end -box.error.injection.set('ERRINJ_SNAP_WRITE_ROW_TIMEOUT', 0) +box.error.injection.set('ERRINJ_SNAP_WRITE_DELAY', false) c:get() box.space.tmp:drop() @@ -532,7 +532,7 @@ _ = box.schema.space.create('test') _ = box.space.test:create_index('primary') for i = 1, 10 do box.space.test:insert{i} end -errinj.set('ERRINJ_SNAP_WRITE_ROW_TIMEOUT', 9000) +errinj.set('ERRINJ_SNAP_WRITE_DELAY', true) _ = fiber.create(function() box.snapshot() end) path = fio.pathjoin(box.cfg.memtx_dir, '*.snap.inprogress') while #fio.glob(path) == 0 do fiber.sleep(0.001) end diff --git a/test/xlog/errinj.result b/test/xlog/errinj.result index 7f15bef3..d6d4141b 100644 --- a/test/xlog/errinj.result +++ b/test/xlog/errinj.result @@ -94,7 +94,7 @@ fio = require('fio') box.space._schema:delete('test') -- bump LSN --- ... -box.error.injection.set('ERRINJ_SNAP_WRITE_ROW_TIMEOUT', 0.1) +box.error.injection.set('ERRINJ_SNAP_WRITE_DELAY', true) --- - ok ... @@ -132,7 +132,7 @@ box.cfg{checkpoint_interval = 10} box.cfg{checkpoint_interval = default_checkpoint_interval} --- ... -box.error.injection.set('ERRINJ_SNAP_WRITE_ROW_TIMEOUT', 0) +box.error.injection.set('ERRINJ_SNAP_WRITE_DELAY', false) --- - ok ... diff --git a/test/xlog/errinj.test.lua b/test/xlog/errinj.test.lua index e433b2fc..de0e2e7e 100644 --- a/test/xlog/errinj.test.lua +++ b/test/xlog/errinj.test.lua @@ -48,7 +48,7 @@ errinj = nil -- fio = require('fio') box.space._schema:delete('test') -- bump LSN -box.error.injection.set('ERRINJ_SNAP_WRITE_ROW_TIMEOUT', 0.1) +box.error.injection.set('ERRINJ_SNAP_WRITE_DELAY', true) default_checkpoint_interval = box.cfg.checkpoint_interval box.cfg{checkpoint_interval = 0.01} -- Wait for the checkpoint daemon to start making a checkpoint. @@ -62,7 +62,7 @@ box.cfg{checkpoint_interval = 0.1} box.cfg{checkpoint_interval = 1} box.cfg{checkpoint_interval = 10} box.cfg{checkpoint_interval = default_checkpoint_interval} -box.error.injection.set('ERRINJ_SNAP_WRITE_ROW_TIMEOUT', 0) +box.error.injection.set('ERRINJ_SNAP_WRITE_DELAY', false) -- Wait for the checkpoint daemon to finish making a checkpoint. test_run:cmd("setopt delimiter ';'") test_run:wait_cond(function() -- 2.11.0
next prev parent reply other threads:[~2019-06-30 19:40 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 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 ` Vladimir Davydov [this message] 2019-07-03 19:13 ` [PATCH 2/6] Replace ERRINJ_SNAP_WRITE_ROW_TIMEOUT with ERRINJ_SNAP_WRITE_DELAY 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=261dbd467f492c233f2339f401e25fc148a2abe3.1561922496.git.vdavydov.dev@gmail.com \ --to=vdavydov.dev@gmail.com \ --cc=kostja@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH 2/6] Replace ERRINJ_SNAP_WRITE_ROW_TIMEOUT with ERRINJ_SNAP_WRITE_DELAY' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox