diff --git a/src/box/box.cc b/src/box/box.cc index b4dc0e41fd8ca6b22785e7fba0926460912325de..ca6c65f0ade26b558268eb839090351f6657cea5 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -286,8 +286,6 @@ struct wal_stream { struct xstream base; /** How many rows have been recovered so far. */ size_t rows; - /** Yield once per 'yield' rows. */ - size_t yield; }; /** @@ -341,22 +339,15 @@ apply_wal_row(struct xstream *stream, struct xrow_header *row) * Yield once in a while, but not too often, * mostly to allow signal handling to take place. */ - if (++xstream->rows % xstream->yield == 0) + if (++xstream->rows % WAL_ROWS_PER_YIELD == 0) fiber_sleep(0); } static void -wal_stream_create(struct wal_stream *ctx, size_t wal_max_rows) +wal_stream_create(struct wal_stream *ctx) { xstream_create(&ctx->base, apply_wal_row); ctx->rows = 0; - /** - * Make the yield logic covered by the functional test - * suite, which has a small setting for rows_per_wal. - * Each yield can take up to 1ms if there are no events, - * so we can't afford many of them during recovery. - */ - ctx->yield = (wal_max_rows >> 4) + 1; } /* {{{ configuration bindings */ @@ -528,17 +519,6 @@ box_check_checkpoint_count(int checkpoint_count) } } -static int64_t -box_check_wal_max_rows(int64_t wal_max_rows) -{ - /* check rows_per_wal configuration */ - if (wal_max_rows <= 1) { - tnt_raise(ClientError, ER_CFG, "rows_per_wal", - "the value must be greater than one"); - } - return wal_max_rows; -} - static int64_t box_check_wal_max_size(int64_t wal_max_size) { @@ -626,7 +606,6 @@ box_check_config() box_check_replication_sync_timeout(); box_check_readahead(cfg_geti("readahead")); box_check_checkpoint_count(cfg_geti("checkpoint_count")); - box_check_wal_max_rows(cfg_geti64("rows_per_wal")); box_check_wal_max_size(cfg_geti64("wal_max_size")); box_check_wal_mode(cfg_gets("wal_mode")); box_check_memtx_memory(cfg_geti64("memtx_memory")); @@ -1931,7 +1910,7 @@ local_recovery(const struct tt_uuid *instance_uuid, say_info("instance uuid %s", tt_uuid_str(&INSTANCE_UUID)); struct wal_stream wal_stream; - wal_stream_create(&wal_stream, cfg_geti64("rows_per_wal")); + wal_stream_create(&wal_stream); struct recovery *recovery; recovery = recovery_new(cfg_gets("wal_dir"), @@ -2117,10 +2096,9 @@ box_cfg_xc(void) iproto_init(); sql_init(); - int64_t wal_max_rows = box_check_wal_max_rows(cfg_geti64("rows_per_wal")); int64_t wal_max_size = box_check_wal_max_size(cfg_geti64("wal_max_size")); enum wal_mode wal_mode = box_check_wal_mode(cfg_gets("wal_mode")); - if (wal_init(wal_mode, cfg_gets("wal_dir"), wal_max_rows, + if (wal_init(wal_mode, cfg_gets("wal_dir"), wal_max_size, &INSTANCE_UUID, on_wal_garbage_collection, on_wal_checkpoint_threshold) != 0) { diag_raise(); diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua index 79bde4d231b3a6bfe431564dc7ac0c5904430e0b..e7f62cf4e2c3cdaa8383df0154cd9a55f46953f4 100644 --- a/src/box/lua/load_cfg.lua +++ b/src/box/lua/load_cfg.lua @@ -54,7 +54,6 @@ local default_cfg = { snap_io_rate_limit = nil, -- no limit too_long_threshold = 0.5, wal_mode = "write", - rows_per_wal = 500000, wal_max_size = 256 * 1024 * 1024, wal_dir_rescan_delay= 2, force_recovery = false, @@ -118,7 +117,6 @@ local template_cfg = { snap_io_rate_limit = 'number', too_long_threshold = 'number', wal_mode = 'string', - rows_per_wal = 'number', wal_max_size = 'number', wal_dir_rescan_delay= 'number', force_recovery = 'boolean', diff --git a/src/box/wal.c b/src/box/wal.c index 58a58e5b5f903c6e6d22b1891fc2744e64a87aa2..388de6a064bc072050f2c44031b02c2dffea3758 100644 --- a/src/box/wal.c +++ b/src/box/wal.c @@ -92,8 +92,6 @@ struct wal_writer /** A memory pool for messages. */ struct mempool msg_pool; /* ----------------- wal ------------------- */ - /** A setting from instance configuration - rows_per_wal */ - int64_t wal_max_rows; /** A setting from instance configuration - wal_max_size */ int64_t wal_max_size; /** Another one - wal_mode */ @@ -344,13 +342,12 @@ tx_notify_checkpoint(struct cmsg *msg) */ static void wal_writer_create(struct wal_writer *writer, enum wal_mode wal_mode, - const char *wal_dirname, int64_t wal_max_rows, + const char *wal_dirname, int64_t wal_max_size, const struct tt_uuid *instance_uuid, wal_on_garbage_collection_f on_garbage_collection, wal_on_checkpoint_threshold_f on_checkpoint_threshold) { writer->wal_mode = wal_mode; - writer->wal_max_rows = wal_max_rows; writer->wal_max_size = wal_max_size; journal_create(&writer->base, wal_mode == WAL_NONE ? wal_write_in_wal_mode_none : wal_write, NULL); @@ -461,16 +458,14 @@ wal_open(struct wal_writer *writer) } int -wal_init(enum wal_mode wal_mode, const char *wal_dirname, int64_t wal_max_rows, +wal_init(enum wal_mode wal_mode, const char *wal_dirname, int64_t wal_max_size, const struct tt_uuid *instance_uuid, wal_on_garbage_collection_f on_garbage_collection, wal_on_checkpoint_threshold_f on_checkpoint_threshold) { - assert(wal_max_rows > 1); - /* Initialize the state. */ struct wal_writer *writer = &wal_writer_singleton; - wal_writer_create(writer, wal_mode, wal_dirname, wal_max_rows, + wal_writer_create(writer, wal_mode, wal_dirname, wal_max_size, instance_uuid, on_garbage_collection, on_checkpoint_threshold); @@ -734,8 +729,7 @@ wal_opt_rotate(struct wal_writer *writer) * one. */ if (xlog_is_open(&writer->current_wal) && - (writer->current_wal.rows >= writer->wal_max_rows || - writer->current_wal.offset >= writer->wal_max_size)) { + writer->current_wal.offset >= writer->wal_max_size) { /* * We can not handle xlog_close() * failure in any reasonable way. diff --git a/src/box/wal.h b/src/box/wal.h index 4e500d2a30fa62f40354cd1787d990a5bf9324ff..8157ba4ce76b38b78bfefa9d63b68a67750dfb41 100644 --- a/src/box/wal.h +++ b/src/box/wal.h @@ -43,6 +43,15 @@ struct tt_uuid; enum wal_mode { WAL_NONE = 0, WAL_WRITE, WAL_FSYNC, WAL_MODE_MAX }; +enum { + /** + * Recovery yields once per that number of rows read and + * applied from WAL. It allows not to block the event + * loop for the whole recovery stage. + */ + WAL_ROWS_PER_YIELD = 32000, +}; + /** String constants for the supported modes. */ extern const char *wal_mode_STRS[]; @@ -72,7 +81,7 @@ typedef void (*wal_on_checkpoint_threshold_f)(void); * Start WAL thread and initialize WAL writer. */ int -wal_init(enum wal_mode wal_mode, const char *wal_dirname, int64_t wal_max_rows, +wal_init(enum wal_mode wal_mode, const char *wal_dirname, int64_t wal_max_size, const struct tt_uuid *instance_uuid, wal_on_garbage_collection_f on_garbage_collection, wal_on_checkpoint_threshold_f on_checkpoint_threshold); diff --git a/test/app-tap/init_script.result b/test/app-tap/init_script.result index 6a296d9f6b9f04331a28a1e523a866797d4ba919..799297ba0ea6677f544e31c1ad7c16855f2ffa0b 100644 --- a/test/app-tap/init_script.result +++ b/test/app-tap/init_script.result @@ -30,26 +30,25 @@ box.cfg 25 replication_sync_lag:10 26 replication_sync_timeout:300 27 replication_timeout:1 -28 rows_per_wal:500000 -29 slab_alloc_factor:1.05 -30 strip_core:true -31 too_long_threshold:0.5 -32 vinyl_bloom_fpr:0.05 -33 vinyl_cache:134217728 -34 vinyl_dir:. -35 vinyl_max_tuple_size:1048576 -36 vinyl_memory:134217728 -37 vinyl_page_size:8192 -38 vinyl_read_threads:1 -39 vinyl_run_count_per_level:2 -40 vinyl_run_size_ratio:3.5 -41 vinyl_timeout:60 -42 vinyl_write_threads:4 -43 wal_dir:. -44 wal_dir_rescan_delay:2 -45 wal_max_size:268435456 -46 wal_mode:write -47 worker_pool_threads:4 +28 slab_alloc_factor:1.05 +29 strip_core:true +30 too_long_threshold:0.5 +31 vinyl_bloom_fpr:0.05 +32 vinyl_cache:134217728 +33 vinyl_dir:. +34 vinyl_max_tuple_size:1048576 +35 vinyl_memory:134217728 +36 vinyl_page_size:8192 +37 vinyl_read_threads:1 +38 vinyl_run_count_per_level:2 +39 vinyl_run_size_ratio:3.5 +40 vinyl_timeout:60 +41 vinyl_write_threads:4 +42 wal_dir:. +43 wal_dir_rescan_delay:2 +44 wal_max_size:268435456 +45 wal_mode:write +46 worker_pool_threads:4 -- -- Test insert from detached fiber -- diff --git a/test/app-tap/snapshot.test.lua b/test/app-tap/snapshot.test.lua index d86f32fe5ffcec64c9ec9c1e6c3da9af6b293e01..587f8279ba4804e0ce043ddd3079bd0ffe18688f 100755 --- a/test/app-tap/snapshot.test.lua +++ b/test/app-tap/snapshot.test.lua @@ -6,7 +6,7 @@ local tap = require('tap') local ffi = require('ffi') local fio = require('fio') -box.cfg{ log="tarantool.log", memtx_memory=107374182, rows_per_wal=5000} +box.cfg{ log="tarantool.log", memtx_memory=107374182} local test = tap.test("snapshot") test:plan(5) diff --git a/test/app/app.lua b/test/app/app.lua index 3a0eaa7dc018489f1c66e341295fdd8dd9b6bef1..dfd159e4b654f48c095feb436d661d3f93953b92 100644 --- a/test/app/app.lua +++ b/test/app/app.lua @@ -4,7 +4,7 @@ box.cfg{ listen = os.getenv("LISTEN"), memtx_memory = 107374182, pid_file = "tarantool.pid", - rows_per_wal = 50 + wal_max_size = 2500 } require('console').listen(os.getenv('ADMIN')) diff --git a/test/app/fiber.result b/test/app/fiber.result index 94e690f6cf6cb3f1451a0807f86a6138313405a6..3c6115a33f1c2c486537f67f16a0758fe2f86a53 100644 --- a/test/app/fiber.result +++ b/test/app/fiber.result @@ -17,12 +17,12 @@ test_run = env.new() -- and wal_schedule fiber schedulers. -- The same fiber should not be scheduled by ev_schedule (e.g. -- due to cancellation) if it is within th wal_schedule queue. --- The test case is dependent on rows_per_wal, since this is when +-- The test case is dependent on wal_max_size, since this is when -- we reopen the .xlog file and thus wal_scheduler takes a long -- pause -box.cfg.rows_per_wal +box.cfg.wal_max_size --- -- 50 +- 2500 ... space:insert{1, 'testing', 'lua rocks'} --- diff --git a/test/app/fiber.test.lua b/test/app/fiber.test.lua index bb8c249905b503de26c25f16146442503ca07567..c5647b8f22df51e0b8b403daf7ecacde2a917ec0 100644 --- a/test/app/fiber.test.lua +++ b/test/app/fiber.test.lua @@ -8,10 +8,10 @@ test_run = env.new() -- and wal_schedule fiber schedulers. -- The same fiber should not be scheduled by ev_schedule (e.g. -- due to cancellation) if it is within th wal_schedule queue. --- The test case is dependent on rows_per_wal, since this is when +-- The test case is dependent on wal_max_size, since this is when -- we reopen the .xlog file and thus wal_scheduler takes a long -- pause -box.cfg.rows_per_wal +box.cfg.wal_max_size space:insert{1, 'testing', 'lua rocks'} space:delete{1} space:insert{1, 'testing', 'lua rocks'} diff --git a/test/box-py/box.lua b/test/box-py/box.lua index 00c592c81aa214cbf3fe581607c99334daaf6e11..e9403774c7a3e5d481a3e76d774c83b6ee8c93d3 100644 --- a/test/box-py/box.lua +++ b/test/box-py/box.lua @@ -6,7 +6,7 @@ box.cfg{ memtx_memory = 107374182, pid_file = "tarantool.pid", force_recovery = true, - rows_per_wal = 10 + wal_max_size = 500 } require('console').listen(os.getenv('ADMIN')) diff --git a/test/box-tap/cfg.test.lua b/test/box-tap/cfg.test.lua index 8faedaec602c89f3d95375c6fc4966fdc8296255..d529447bbd526d9610db8cebb494ed1f55f53939 100755 --- a/test/box-tap/cfg.test.lua +++ b/test/box-tap/cfg.test.lua @@ -6,7 +6,7 @@ local socket = require('socket') local fio = require('fio') local uuid = require('uuid') local msgpack = require('msgpack') -test:plan(105) +test:plan(104) -------------------------------------------------------------------------------- -- Invalid values @@ -36,7 +36,6 @@ invalid('replication_connect_timeout', -1) invalid('replication_connect_timeout', 0) invalid('replication_connect_quorum', -1) invalid('wal_mode', 'invalid') -invalid('rows_per_wal', -1) invalid('listen', '//!') invalid('log', ':') invalid('log', 'syslog:xxx=') diff --git a/test/box/admin.result b/test/box/admin.result index 0c137e3712347eb518dda7a06d24007766e542bc..6126f3a97b590445d8d3b9c5b4e3f42e985a7ad5 100644 --- a/test/box/admin.result +++ b/test/box/admin.result @@ -81,8 +81,6 @@ cfg_filter(box.cfg) - 300 - - replication_timeout - 1 - - - rows_per_wal - - 500000 - - slab_alloc_factor - 1.05 - - strip_core diff --git a/test/box/cfg.result b/test/box/cfg.result index cdca64ef0cf921c9d026af93c7acb260ba762aa6..5370bb8703db81148544913746b3f24c813eeee6 100644 --- a/test/box/cfg.result +++ b/test/box/cfg.result @@ -69,8 +69,6 @@ cfg_filter(box.cfg) | - 300 | - - replication_timeout | - 1 - | - - rows_per_wal - | - 500000 | - - slab_alloc_factor | - 1.05 | - - strip_core @@ -170,8 +168,6 @@ cfg_filter(box.cfg) | - 300 | - - replication_timeout | - 1 - | - - rows_per_wal - | - 500000 | - - slab_alloc_factor | - 1.05 | - - strip_core diff --git a/test/box/configuration.result b/test/box/configuration.result deleted file mode 100644 index c885c28dc2e4acf5a57da36cdd3c58fb31b1917e..0000000000000000000000000000000000000000 --- a/test/box/configuration.result +++ /dev/null @@ -1,107 +0,0 @@ - -# Bug #876541: -# Test floating point values (wal_fsync_delay) with fractional part -# (https://bugs.launchpad.net/bugs/876541) - -box.cfg.wal_fsync_delay ---- -- 0.01 -... -print_config() ---- -- io_collect_interval: 0 - pid_file: box.pid - slab_alloc_factor: 2 - slab_alloc_minimal: 64 - admin_port: <number> - logger: cat - >> tarantool.log - readahead: 16320 - wal_dir: . - logger_nonblock: true - log_level: 5 - snap_dir: . - coredump: false - background: false - too_long_threshold: 0.5 - rows_per_wal: 50 - wal_mode: fsync_delay - snap_io_rate_limit: 0 - panic_on_snap_error: true - panic_on_wal_error: false - local_hot_standby: false - slab_alloc_arena: 0.1 - bind_ipaddr: INADDR_ANY - wal_fsync_delay: 0 - primary_port: <number> - wal_dir_rescan_delay: 0.1 -... - -# Test bug #977898 - -box.space.tweedledum:insert{4, 8, 16} ---- -- [4, 8, 16] -... - -# Test insert from init.lua - -box.space.tweedledum:get(1) ---- -- [1, 2, 4, 8] -... -box.space.tweedledum:get(2) ---- -- [2, 4, 8, 16] -... -box.space.tweedledum:get(4) ---- -- [4, 8, 16] -... - -# Test bug #1002272 - -floor(0.5) ---- -- 0 -... -floor(0.9) ---- -- 0 -... -floor(1.1) ---- -- 1 -... -mod.test(10, 15) ---- -- 25 -... - -# Bug#99 Salloc initialization is not checked on startup -# (https://github.com/tarantool/tarantool/issues/99) - -Can't start Tarantool -ok - -# Bug#100 Segmentation fault if rows_per_wal = 0 -# (https://github.com/tarantool/tarantool/issues/100) - -Can't start Tarantool -ok -# -# Check that --background doesn't work if there is no logger -# This is a test case for -# https://bugs.launchpad.net/tarantool/+bug/750658 -# "--background neither closes nor redirects stdin/stdout/stderr" - -Can't start Tarantool -ok - -# A test case for Bug#726778 "Gopt broke wal_dir and snap_dir: they are no -# longer relative to work_dir". -# https://bugs.launchpad.net/tarantool/+bug/726778 -# After addition of gopt(), we started to chdir() to the working -# directory after option parsing. -# Verify that this is not the case, and snap_dir and xlog_dir -# can be relative to work_dir. - diff --git a/test/box/proxy.lua b/test/box/proxy.lua index fa87ab879c7f49d4297604220c3b3b8f568a9f6a..8bbd505f8c05097444bbec9aac9d3c33d5460cc4 100644 --- a/test/box/proxy.lua +++ b/test/box/proxy.lua @@ -5,7 +5,7 @@ box.cfg{ listen = os.getenv("LISTEN"), memtx_memory = 107374182, pid_file = "tarantool.pid", - rows_per_wal = 50 + wal_max_size = 2500 } require('console').listen(os.getenv('ADMIN')) diff --git a/test/box/tiny.lua b/test/box/tiny.lua index 8d30250831470df9a4b181bf3c52e283c6b640af..04b523fb292cbe19ddbb8baa36e1d4f2d60e5833 100644 --- a/test/box/tiny.lua +++ b/test/box/tiny.lua @@ -7,7 +7,6 @@ box.cfg{ pid_file = "tarantool.pid", force_recovery = false, slab_alloc_factor = 1.1, - rows_per_wal = 5000000 } require('console').listen(os.getenv('ADMIN')) diff --git a/test/engine/box.lua b/test/engine/box.lua index b1a379dafba73c860dc623a0f32128a69070c23b..e2f04cba2819c95d4f7523d88cb07532e65b5714 100644 --- a/test/engine/box.lua +++ b/test/engine/box.lua @@ -11,7 +11,7 @@ box.cfg{ listen = os.getenv("LISTEN"), memtx_memory = 107374182, pid_file = "tarantool.pid", - rows_per_wal = 50, + wal_max_size = 2500, vinyl_read_threads = 2, vinyl_write_threads = 3, vinyl_range_size = 64 * 1024, diff --git a/test/engine/recover_snapshot_wal.result b/test/engine/recover_snapshot_wal.result index d2667559d676fd3d759752bef681d6b6ad9753d0..1abe386c6dc9448b9cede8712bb7bc09f49bf565 100644 --- a/test/engine/recover_snapshot_wal.result +++ b/test/engine/recover_snapshot_wal.result @@ -23,9 +23,9 @@ box.snapshot() --- - ok ... -space:insert({1001}) +space:insert({33001}) --- -- [1001] +- [33001] ... test_run:cmd("restart server default") space = box.space['test'] @@ -37,7 +37,7 @@ index = space.index['primary'] index:select({}, {iterator = box.index.ALL}) --- - - [0] - - [1001] + - [33001] ... for key = 1, 351 do space:insert({key}) end --- @@ -46,7 +46,18 @@ box.snapshot() --- - ok ... -for key = 352, 1000 do space:insert({key}) end +-- Insert so many tuples, that recovery would need to yield +-- periodically to allow other fibers do something. At the moment +-- of writing this the yield period was 32k tuples. +box.begin() \ +for key = 352, 33000 do \ + space:insert({key}) \ + if key % 10000 == 0 then \ + box.commit() \ + box.begin() \ + end \ +end \ +box.commit() --- ... test_run:cmd("restart server default") @@ -56,1010 +67,28 @@ space = box.space['test'] index = space.index['primary'] --- ... -index:select({}, {iterator = box.index.ALL}) +i = 0 --- -- - [0] - - [1] - - [2] - - [3] - - [4] - - [5] - - [6] - - [7] - - [8] - - [9] - - [10] - - [11] - - [12] - - [13] - - [14] - - [15] - - [16] - - [17] - - [18] - - [19] - - [20] - - [21] - - [22] - - [23] - - [24] - - [25] - - [26] - - [27] - - [28] - - [29] - - [30] - - [31] - - [32] - - [33] - - [34] - - [35] - - [36] - - [37] - - [38] - - [39] - - [40] - - [41] - - [42] - - [43] - - [44] - - [45] - - [46] - - [47] - - [48] - - [49] - - [50] - - [51] - - [52] - - [53] - - [54] - - [55] - - [56] - - [57] - - [58] - - [59] - - [60] - - [61] - - [62] - - [63] - - [64] - - [65] - - [66] - - [67] - - [68] - - [69] - - [70] - - [71] - - [72] - - [73] - - [74] - - [75] - - [76] - - [77] - - [78] - - [79] - - [80] - - [81] - - [82] - - [83] - - [84] - - [85] - - [86] - - [87] - - [88] - - [89] - - [90] - - [91] - - [92] - - [93] - - [94] - - [95] - - [96] - - [97] - - [98] - - [99] - - [100] - - [101] - - [102] - - [103] - - [104] - - [105] - - [106] - - [107] - - [108] - - [109] - - [110] - - [111] - - [112] - - [113] - - [114] - - [115] - - [116] - - [117] - - [118] - - [119] - - [120] - - [121] - - [122] - - [123] - - [124] - - [125] - - [126] - - [127] - - [128] - - [129] - - [130] - - [131] - - [132] - - [133] - - [134] - - [135] - - [136] - - [137] - - [138] - - [139] - - [140] - - [141] - - [142] - - [143] - - [144] - - [145] - - [146] - - [147] - - [148] - - [149] - - [150] - - [151] - - [152] - - [153] - - [154] - - [155] - - [156] - - [157] - - [158] - - [159] - - [160] - - [161] - - [162] - - [163] - - [164] - - [165] - - [166] - - [167] - - [168] - - [169] - - [170] - - [171] - - [172] - - [173] - - [174] - - [175] - - [176] - - [177] - - [178] - - [179] - - [180] - - [181] - - [182] - - [183] - - [184] - - [185] - - [186] - - [187] - - [188] - - [189] - - [190] - - [191] - - [192] - - [193] - - [194] - - [195] - - [196] - - [197] - - [198] - - [199] - - [200] - - [201] - - [202] - - [203] - - [204] - - [205] - - [206] - - [207] - - [208] - - [209] - - [210] - - [211] - - [212] - - [213] - - [214] - - [215] - - [216] - - [217] - - [218] - - [219] - - [220] - - [221] - - [222] - - [223] - - [224] - - [225] - - [226] - - [227] - - [228] - - [229] - - [230] - - [231] - - [232] - - [233] - - [234] - - [235] - - [236] - - [237] - - [238] - - [239] - - [240] - - [241] - - [242] - - [243] - - [244] - - [245] - - [246] - - [247] - - [248] - - [249] - - [250] - - [251] - - [252] - - [253] - - [254] - - [255] - - [256] - - [257] - - [258] - - [259] - - [260] - - [261] - - [262] - - [263] - - [264] - - [265] - - [266] - - [267] - - [268] - - [269] - - [270] - - [271] - - [272] - - [273] - - [274] - - [275] - - [276] - - [277] - - [278] - - [279] - - [280] - - [281] - - [282] - - [283] - - [284] - - [285] - - [286] - - [287] - - [288] - - [289] - - [290] - - [291] - - [292] - - [293] - - [294] - - [295] - - [296] - - [297] - - [298] - - [299] - - [300] - - [301] - - [302] - - [303] - - [304] - - [305] - - [306] - - [307] - - [308] - - [309] - - [310] - - [311] - - [312] - - [313] - - [314] - - [315] - - [316] - - [317] - - [318] - - [319] - - [320] - - [321] - - [322] - - [323] - - [324] - - [325] - - [326] - - [327] - - [328] - - [329] - - [330] - - [331] - - [332] - - [333] - - [334] - - [335] - - [336] - - [337] - - [338] - - [339] - - [340] - - [341] - - [342] - - [343] - - [344] - - [345] - - [346] - - [347] - - [348] - - [349] - - [350] - - [351] - - [352] - - [353] - - [354] - - [355] - - [356] - - [357] - - [358] - - [359] - - [360] - - [361] - - [362] - - [363] - - [364] - - [365] - - [366] - - [367] - - [368] - - [369] - - [370] - - [371] - - [372] - - [373] - - [374] - - [375] - - [376] - - [377] - - [378] - - [379] - - [380] - - [381] - - [382] - - [383] - - [384] - - [385] - - [386] - - [387] - - [388] - - [389] - - [390] - - [391] - - [392] - - [393] - - [394] - - [395] - - [396] - - [397] - - [398] - - [399] - - [400] - - [401] - - [402] - - [403] - - [404] - - [405] - - [406] - - [407] - - [408] - - [409] - - [410] - - [411] - - [412] - - [413] - - [414] - - [415] - - [416] - - [417] - - [418] - - [419] - - [420] - - [421] - - [422] - - [423] - - [424] - - [425] - - [426] - - [427] - - [428] - - [429] - - [430] - - [431] - - [432] - - [433] - - [434] - - [435] - - [436] - - [437] - - [438] - - [439] - - [440] - - [441] - - [442] - - [443] - - [444] - - [445] - - [446] - - [447] - - [448] - - [449] - - [450] - - [451] - - [452] - - [453] - - [454] - - [455] - - [456] - - [457] - - [458] - - [459] - - [460] - - [461] - - [462] - - [463] - - [464] - - [465] - - [466] - - [467] - - [468] - - [469] - - [470] - - [471] - - [472] - - [473] - - [474] - - [475] - - [476] - - [477] - - [478] - - [479] - - [480] - - [481] - - [482] - - [483] - - [484] - - [485] - - [486] - - [487] - - [488] - - [489] - - [490] - - [491] - - [492] - - [493] - - [494] - - [495] - - [496] - - [497] - - [498] - - [499] - - [500] - - [501] - - [502] - - [503] - - [504] - - [505] - - [506] - - [507] - - [508] - - [509] - - [510] - - [511] - - [512] - - [513] - - [514] - - [515] - - [516] - - [517] - - [518] - - [519] - - [520] - - [521] - - [522] - - [523] - - [524] - - [525] - - [526] - - [527] - - [528] - - [529] - - [530] - - [531] - - [532] - - [533] - - [534] - - [535] - - [536] - - [537] - - [538] - - [539] - - [540] - - [541] - - [542] - - [543] - - [544] - - [545] - - [546] - - [547] - - [548] - - [549] - - [550] - - [551] - - [552] - - [553] - - [554] - - [555] - - [556] - - [557] - - [558] - - [559] - - [560] - - [561] - - [562] - - [563] - - [564] - - [565] - - [566] - - [567] - - [568] - - [569] - - [570] - - [571] - - [572] - - [573] - - [574] - - [575] - - [576] - - [577] - - [578] - - [579] - - [580] - - [581] - - [582] - - [583] - - [584] - - [585] - - [586] - - [587] - - [588] - - [589] - - [590] - - [591] - - [592] - - [593] - - [594] - - [595] - - [596] - - [597] - - [598] - - [599] - - [600] - - [601] - - [602] - - [603] - - [604] - - [605] - - [606] - - [607] - - [608] - - [609] - - [610] - - [611] - - [612] - - [613] - - [614] - - [615] - - [616] - - [617] - - [618] - - [619] - - [620] - - [621] - - [622] - - [623] - - [624] - - [625] - - [626] - - [627] - - [628] - - [629] - - [630] - - [631] - - [632] - - [633] - - [634] - - [635] - - [636] - - [637] - - [638] - - [639] - - [640] - - [641] - - [642] - - [643] - - [644] - - [645] - - [646] - - [647] - - [648] - - [649] - - [650] - - [651] - - [652] - - [653] - - [654] - - [655] - - [656] - - [657] - - [658] - - [659] - - [660] - - [661] - - [662] - - [663] - - [664] - - [665] - - [666] - - [667] - - [668] - - [669] - - [670] - - [671] - - [672] - - [673] - - [674] - - [675] - - [676] - - [677] - - [678] - - [679] - - [680] - - [681] - - [682] - - [683] - - [684] - - [685] - - [686] - - [687] - - [688] - - [689] - - [690] - - [691] - - [692] - - [693] - - [694] - - [695] - - [696] - - [697] - - [698] - - [699] - - [700] - - [701] - - [702] - - [703] - - [704] - - [705] - - [706] - - [707] - - [708] - - [709] - - [710] - - [711] - - [712] - - [713] - - [714] - - [715] - - [716] - - [717] - - [718] - - [719] - - [720] - - [721] - - [722] - - [723] - - [724] - - [725] - - [726] - - [727] - - [728] - - [729] - - [730] - - [731] - - [732] - - [733] - - [734] - - [735] - - [736] - - [737] - - [738] - - [739] - - [740] - - [741] - - [742] - - [743] - - [744] - - [745] - - [746] - - [747] - - [748] - - [749] - - [750] - - [751] - - [752] - - [753] - - [754] - - [755] - - [756] - - [757] - - [758] - - [759] - - [760] - - [761] - - [762] - - [763] - - [764] - - [765] - - [766] - - [767] - - [768] - - [769] - - [770] - - [771] - - [772] - - [773] - - [774] - - [775] - - [776] - - [777] - - [778] - - [779] - - [780] - - [781] - - [782] - - [783] - - [784] - - [785] - - [786] - - [787] - - [788] - - [789] - - [790] - - [791] - - [792] - - [793] - - [794] - - [795] - - [796] - - [797] - - [798] - - [799] - - [800] - - [801] - - [802] - - [803] - - [804] - - [805] - - [806] - - [807] - - [808] - - [809] - - [810] - - [811] - - [812] - - [813] - - [814] - - [815] - - [816] - - [817] - - [818] - - [819] - - [820] - - [821] - - [822] - - [823] - - [824] - - [825] - - [826] - - [827] - - [828] - - [829] - - [830] - - [831] - - [832] - - [833] - - [834] - - [835] - - [836] - - [837] - - [838] - - [839] - - [840] - - [841] - - [842] - - [843] - - [844] - - [845] - - [846] - - [847] - - [848] - - [849] - - [850] - - [851] - - [852] - - [853] - - [854] - - [855] - - [856] - - [857] - - [858] - - [859] - - [860] - - [861] - - [862] - - [863] - - [864] - - [865] - - [866] - - [867] - - [868] - - [869] - - [870] - - [871] - - [872] - - [873] - - [874] - - [875] - - [876] - - [877] - - [878] - - [879] - - [880] - - [881] - - [882] - - [883] - - [884] - - [885] - - [886] - - [887] - - [888] - - [889] - - [890] - - [891] - - [892] - - [893] - - [894] - - [895] - - [896] - - [897] - - [898] - - [899] - - [900] - - [901] - - [902] - - [903] - - [904] - - [905] - - [906] - - [907] - - [908] - - [909] - - [910] - - [911] - - [912] - - [913] - - [914] - - [915] - - [916] - - [917] - - [918] - - [919] - - [920] - - [921] - - [922] - - [923] - - [924] - - [925] - - [926] - - [927] - - [928] - - [929] - - [930] - - [931] - - [932] - - [933] - - [934] - - [935] - - [936] - - [937] - - [938] - - [939] - - [940] - - [941] - - [942] - - [943] - - [944] - - [945] - - [946] - - [947] - - [948] - - [949] - - [950] - - [951] - - [952] - - [953] - - [954] - - [955] - - [956] - - [957] - - [958] - - [959] - - [960] - - [961] - - [962] - - [963] - - [964] - - [965] - - [966] - - [967] - - [968] - - [969] - - [970] - - [971] - - [972] - - [973] - - [974] - - [975] - - [976] - - [977] - - [978] - - [979] - - [980] - - [981] - - [982] - - [983] - - [984] - - [985] - - [986] - - [987] - - [988] - - [989] - - [990] - - [991] - - [992] - - [993] - - [994] - - [995] - - [996] - - [997] - - [998] - - [999] - - [1000] - - [1001] +... +err = nil +--- +... +for _, t in space:pairs() do \ + if t[1] ~= i then \ + err = {i, t} \ + break \ + end \ + i = i + 1 \ +end +--- +... +i +--- +- 33002 +... +err +--- +- null ... space:drop() --- diff --git a/test/engine/recover_snapshot_wal.test.lua b/test/engine/recover_snapshot_wal.test.lua index 1f133dd72ac4eff93c49bb0522d39f1ae150f4fe..a3067a49681ab9ff7dc4ed191552d0d427d3933b 100644 --- a/test/engine/recover_snapshot_wal.test.lua +++ b/test/engine/recover_snapshot_wal.test.lua @@ -10,7 +10,7 @@ index = space:create_index('primary') space:insert({0}) box.snapshot() -space:insert({1001}) +space:insert({33001}) test_run:cmd("restart server default") @@ -20,13 +20,34 @@ index:select({}, {iterator = box.index.ALL}) for key = 1, 351 do space:insert({key}) end box.snapshot() -for key = 352, 1000 do space:insert({key}) end +-- Insert so many tuples, that recovery would need to yield +-- periodically to allow other fibers do something. At the moment +-- of writing this the yield period was 32k tuples. +box.begin() \ +for key = 352, 33000 do \ + space:insert({key}) \ + if key % 10000 == 0 then \ + box.commit() \ + box.begin() \ + end \ +end \ +box.commit() test_run:cmd("restart server default") space = box.space['test'] index = space.index['primary'] -index:select({}, {iterator = box.index.ALL}) +i = 0 +err = nil +for _, t in space:pairs() do \ + if t[1] ~= i then \ + err = {i, t} \ + break \ + end \ + i = i + 1 \ +end +i +err space:drop() test_run:cmd("restart server default with cleanup=1") diff --git a/test/engine_long/box.lua b/test/engine_long/box.lua index c24eac5fe29bbf2b1a50031483eae0495bddedd4..28a1560d538311fca9859021c64b12ff5a4d35be 100644 --- a/test/engine_long/box.lua +++ b/test/engine_long/box.lua @@ -9,7 +9,6 @@ box.cfg { listen = os.getenv("LISTEN"), memtx_memory = 107374182, pid_file = "tarantool.pid", - rows_per_wal = 500000, vinyl_dir = "./vinyl_test", vinyl_memory = 107374182, vinyl_read_threads = 3, diff --git a/test/long_run-py/box.lua b/test/long_run-py/box.lua index 8b0738bf8d423b6fb46f1225f6e40a3c79abee0e..b4f65dcdb8baf5f53a09fcd0083ede93746c6a3c 100644 --- a/test/long_run-py/box.lua +++ b/test/long_run-py/box.lua @@ -9,7 +9,6 @@ box.cfg { listen = os.getenv("LISTEN"), memtx_memory = 107374182, pid_file = "tarantool.pid", - rows_per_wal = 500000, vinyl_dir = "./vinyl_test", vinyl_read_threads = 3, vinyl_write_threads = 5, diff --git a/test/vinyl/vinyl.lua b/test/vinyl/vinyl.lua index 34bd948ffc5570b54c9759326be0779d7caad163..31307f4bc92e868fb39532f9e5d49522d18dc143 100644 --- a/test/vinyl/vinyl.lua +++ b/test/vinyl/vinyl.lua @@ -4,7 +4,6 @@ box.cfg { listen = os.getenv("LISTEN"), memtx_memory = 512 * 1024 * 1024, memtx_max_tuple_size = 4 * 1024 * 1024, - rows_per_wal = 1000000, vinyl_read_threads = 2, vinyl_write_threads = 3, vinyl_memory = 512 * 1024 * 1024, diff --git a/test/xlog-py/box.lua b/test/xlog-py/box.lua index 00c592c81aa214cbf3fe581607c99334daaf6e11..c87f7b94b21e152b782f51b1eb54a63f200cde80 100644 --- a/test/xlog-py/box.lua +++ b/test/xlog-py/box.lua @@ -6,7 +6,6 @@ box.cfg{ memtx_memory = 107374182, pid_file = "tarantool.pid", force_recovery = true, - rows_per_wal = 10 } require('console').listen(os.getenv('ADMIN')) diff --git a/test/xlog/checkpoint_daemon.result b/test/xlog/checkpoint_daemon.result index 6c96da0d5b51e7be2a3c7bc0d5e5f554b285d57d..5be7124fe84b076a7a8b269cf40e0885f64f0e84 100644 --- a/test/xlog/checkpoint_daemon.result +++ b/test/xlog/checkpoint_daemon.result @@ -87,12 +87,15 @@ box.cfg{checkpoint_interval = PERIOD, checkpoint_count = 2 } no = 1 --- ... +row_count_per_wal = box.cfg.wal_max_size / 50 +--- +... -- first xlog -for i = 1, box.cfg.rows_per_wal + 10 do space:insert { no } no = no + 1 end +for i = 1, row_count_per_wal + 10 do space:insert { no } no = no + 1 end --- ... -- second xlog -for i = 1, box.cfg.rows_per_wal + 10 do space:insert { no } no = no + 1 end +for i = 1, row_count_per_wal + 10 do space:insert { no } no = no + 1 end --- ... wait_snapshot(WAIT_COND_TIMEOUT) @@ -100,11 +103,11 @@ wait_snapshot(WAIT_COND_TIMEOUT) - true ... -- third xlog -for i = 1, box.cfg.rows_per_wal + 10 do space:insert { no } no = no + 1 end +for i = 1, row_count_per_wal + 10 do space:insert { no } no = no + 1 end --- ... -- fourth xlog -for i = 1, box.cfg.rows_per_wal + 10 do space:insert { no } no = no + 1 end +for i = 1, row_count_per_wal + 10 do space:insert { no } no = no + 1 end --- ... wait_snapshot(WAIT_COND_TIMEOUT) diff --git a/test/xlog/checkpoint_daemon.test.lua b/test/xlog/checkpoint_daemon.test.lua index 37d7f7528911e29fa18b275563aeefe23f49b9ec..d3138f356d830f1b3b3b672e689cdd5cd9324436 100644 --- a/test/xlog/checkpoint_daemon.test.lua +++ b/test/xlog/checkpoint_daemon.test.lua @@ -54,17 +54,18 @@ test_run:cmd("setopt delimiter ''"); box.cfg{checkpoint_interval = PERIOD, checkpoint_count = 2 } no = 1 +row_count_per_wal = box.cfg.wal_max_size / 50 -- first xlog -for i = 1, box.cfg.rows_per_wal + 10 do space:insert { no } no = no + 1 end +for i = 1, row_count_per_wal + 10 do space:insert { no } no = no + 1 end -- second xlog -for i = 1, box.cfg.rows_per_wal + 10 do space:insert { no } no = no + 1 end +for i = 1, row_count_per_wal + 10 do space:insert { no } no = no + 1 end wait_snapshot(WAIT_COND_TIMEOUT) -- third xlog -for i = 1, box.cfg.rows_per_wal + 10 do space:insert { no } no = no + 1 end +for i = 1, row_count_per_wal + 10 do space:insert { no } no = no + 1 end -- fourth xlog -for i = 1, box.cfg.rows_per_wal + 10 do space:insert { no } no = no + 1 end +for i = 1, row_count_per_wal + 10 do space:insert { no } no = no + 1 end wait_snapshot(WAIT_COND_TIMEOUT) wait_snapshot_gc(WAIT_COND_TIMEOUT) diff --git a/test/xlog/errinj.result b/test/xlog/errinj.result index d6d4141b5136e08176bcb7a9d8313b83b3c0bf69..c524d7a80a536f7edde06474b1506d4bc5c9c14b 100644 --- a/test/xlog/errinj.result +++ b/test/xlog/errinj.result @@ -58,7 +58,10 @@ _ = test:create_index('primary') box.schema.user.grant('guest', 'write', 'space', 'test') --- ... -for i=1, box.cfg.rows_per_wal do test:insert{i, 'test'} end +row_count_per_wal = box.cfg.wal_max_size / 50 + 10 +--- +... +for i=1, row_count_per_wal do test:insert{i, 'test'} end --- ... c = require('net.box').connect(box.cfg.listen) @@ -69,7 +72,7 @@ errinj.set('ERRINJ_WAL_WRITE', true) --- - ok ... -c.space.test:insert({box.cfg.rows_per_wal + 1,1,2,3}) +c.space.test:insert({row_count_per_wal + 1,1,2,3}) --- - error: Failed to write to disk ... diff --git a/test/xlog/errinj.test.lua b/test/xlog/errinj.test.lua index de0e2e7e8e7d025cacc3323de7007ae16c69f5ba..3d72dc4e4d928009d1fa40492f6c89e020319695 100644 --- a/test/xlog/errinj.test.lua +++ b/test/xlog/errinj.test.lua @@ -30,12 +30,13 @@ _ = test:create_index('primary') box.schema.user.grant('guest', 'write', 'space', 'test') -for i=1, box.cfg.rows_per_wal do test:insert{i, 'test'} end +row_count_per_wal = box.cfg.wal_max_size / 50 + 10 +for i=1, row_count_per_wal do test:insert{i, 'test'} end c = require('net.box').connect(box.cfg.listen) -- try to write xlog without permission to write to disk errinj.set('ERRINJ_WAL_WRITE', true) -c.space.test:insert({box.cfg.rows_per_wal + 1,1,2,3}) +c.space.test:insert({row_count_per_wal + 1,1,2,3}) errinj.set('ERRINJ_WAL_WRITE', false) -- Cleanup diff --git a/test/xlog/panic.lua b/test/xlog/panic.lua index dee83e608d218ca44030a47b6985b1be3cd53a01..2d4eb8d2e3490479367c09f81ad426f95cd65f06 100644 --- a/test/xlog/panic.lua +++ b/test/xlog/panic.lua @@ -6,7 +6,6 @@ box.cfg{ memtx_memory = 107374182, pid_file = "tarantool.pid", force_recovery = false, - rows_per_wal = 10 } require('console').listen(os.getenv('ADMIN')) diff --git a/test/xlog/upgrade/fill.lua b/test/xlog/upgrade/fill.lua index cb38b08e3c0b0bd0bc044d225bee8a5b9c5cfd20..0ef1a8bb9d83980b435c1bfee17d196aa09c2155 100644 --- a/test/xlog/upgrade/fill.lua +++ b/test/xlog/upgrade/fill.lua @@ -2,7 +2,7 @@ --- A script to generate some dataset used by migration.test.lua --- -box.cfg{ rows_per_wal = 5 } +box.cfg{ wal_max_size = 250 } box.schema.space.create("distro") box.space.distro:create_index('primary', { type = 'hash', unique = true, parts = {1, 'str', 2, 'str', 3, 'num'}}) diff --git a/test/xlog/xlog.lua b/test/xlog/xlog.lua index b1c9719abd9e8b5ad707bc42a820fd3bf079ad16..004096d2db84dd22d3e325b64ba7fd8c83fba28d 100644 --- a/test/xlog/xlog.lua +++ b/test/xlog/xlog.lua @@ -6,7 +6,7 @@ box.cfg{ memtx_memory = 107374182, pid_file = "tarantool.pid", force_recovery = true, - rows_per_wal = 10, + wal_max_size = 500, snap_io_rate_limit = 16 }