From 64a4b538fefdf5ef2c378f62256d163f8a763ce0 Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov.dev@gmail.com> Date: Wed, 1 Nov 2017 19:22:10 +0300 Subject: [PATCH] vinyl: cleanup global statistics - Remove vy_stat::rmean statistics, which were left from Sophia, as now we have per index statistics which are much more verbose than those. - Move vy_stat::dump_bw to vy_env and remove struct vy_stat as there's nothing left in it. - Move quota statistics from box.info.vinyl().performance.memory to box.info.vinyl().quota. Remove 'ratio', which equals used / limit, as this kind of calculations should be done by a script aggregating statistics. Report 'use_rate' and 'dump_bandwidth' there. - Report 'limit' in cache statistics to make them consistent with 'quota' statistics, where 'limit' is reported. Rename 'cache.count' to 'cache.tuples'. Remove vy_cache_env::cache_count, use mempool stats instead. - Move 'tx_allocated', 'txv_allocated', 'read_interval', 'read_view' from box.info.vinyl().performance to box.info.vinyl().tx and name them 'transactions', 'statements', 'gap_locks', and 'read_views', respectively. Remove vy_tx_stat::active and 'tx.active' as the same value is shown by 'tx.transactions', extracted from the mempool. - Zap box.info.vinyl().performance - there's nothing left there. Now global statistics look like: tarantool> box.info.vinyl() --- - cache: limit: 134217728 tuples: 32344 used: 34898794 tx: conflict: 1 commit: 324 rollback: 13 statements: 10 transactions: 3 gap_locks: 4 read_views: 1 quota: dump_bandwidth: 10000000 watermark: 119488351 use_rate: 1232703 limit: 134217728 used: 34014634 ... Closes #2861 --- src/box/vinyl.c | 249 +++++++++++------------------ src/box/vy_cache.c | 4 - src/box/vy_cache.h | 2 - src/box/vy_stat.h | 2 - src/box/vy_tx.c | 5 - src/box/vy_tx.h | 2 - test/vinyl/errinj.result | 12 +- test/vinyl/errinj.test.lua | 12 +- test/vinyl/mvcc.result | 32 ++-- test/vinyl/mvcc.test.lua | 32 ++-- test/vinyl/quota.result | 16 +- test/vinyl/quota.test.lua | 16 +- test/vinyl/quota_timeout.result | 10 +- test/vinyl/quota_timeout.test.lua | 10 +- test/vinyl/recovery_quota.result | 6 +- test/vinyl/recovery_quota.test.lua | 6 +- test/vinyl/tx_gap_lock.result | 2 +- test/vinyl/tx_gap_lock.test.lua | 2 +- test/vinyl/upgrade/fill.lua | 2 +- 19 files changed, 168 insertions(+), 254 deletions(-) diff --git a/src/box/vinyl.c b/src/box/vinyl.c index fc2091bee8..8d41162d4b 100644 --- a/src/box/vinyl.c +++ b/src/box/vinyl.c @@ -74,7 +74,6 @@ enum { VY_YIELD_LOOPS = 128 }; enum { VY_YIELD_LOOPS = 2 }; #endif -struct vy_stat; struct vy_squash_queue; enum vy_status { @@ -91,8 +90,6 @@ struct vy_env { enum vy_status status; /** TX manager */ struct tx_manager *xm; - /** Statistics */ - struct vy_stat *stat; /** Upsert squash queue */ struct vy_squash_queue *squash_queue; /** Mempool for struct vy_cursor */ @@ -112,6 +109,18 @@ struct vy_env { * moving average of quota_use_curr. */ size_t quota_use_rate; + /** + * Dump bandwidth is needed for calculating the quota watermark. + * The higher the bandwidth, the later we can start dumping w/o + * suffering from transaction throttling. So we want to be very + * conservative about estimating the bandwidth. + * + * To make sure we don't overestimate it, we maintain a + * histogram of all observed measurements and assume the + * bandwidth to be equal to the 10th percentile, i.e. the + * best result among 10% worst measurements. + */ + struct histogram *dump_bw; /** Common index environment. */ struct vy_index_env index_env; /** Environment for cache subsystem */ @@ -151,6 +160,13 @@ enum { VY_QUOTA_RATE_AVG_PERIOD = 5, }; +static inline int64_t +vy_dump_bandwidth(struct vy_env *env) +{ + /* See comment to vy_env::dump_bw. */ + return histogram_percentile(env->dump_bw, 10); +} + /** Mask passed to vy_gc(). */ enum { /** Delete incomplete runs. */ @@ -163,100 +179,6 @@ static void vy_gc(struct vy_env *env, struct vy_recovery *recovery, unsigned int gc_mask, int64_t gc_lsn); -enum vy_stat_name { - VY_STAT_GET, - VY_STAT_TX, - VY_STAT_TX_OPS, - VY_STAT_TX_WRITE, - VY_STAT_CURSOR, - VY_STAT_CURSOR_OPS, - VY_STAT_LAST, -}; - -static const char *vy_stat_strings[] = { - "get", - "tx", - "tx_ops", - "tx_write", - "cursor", - "cursor_ops", -}; - -struct vy_stat { - struct rmean *rmean; - /** - * Dump bandwidth is needed for calculating the quota watermark. - * The higher the bandwidth, the later we can start dumping w/o - * suffering from transaction throttling. So we want to be very - * conservative about estimating the bandwidth. - * - * To make sure we don't overestimate it, we maintain a - * histogram of all observed measurements and assume the - * bandwidth to be equal to the 10th percentile, i.e. the - * best result among 10% worst measurements. - */ - struct histogram *dump_bw; -}; - -static struct vy_stat * -vy_stat_new() -{ - enum { KB = 1000, MB = 1000 * 1000 }; - static int64_t bandwidth_buckets[] = { - 100 * KB, 200 * KB, 300 * KB, 400 * KB, 500 * KB, - 1 * MB, 2 * MB, 3 * MB, 4 * MB, 5 * MB, - 10 * MB, 20 * MB, 30 * MB, 40 * MB, 50 * MB, - 60 * MB, 70 * MB, 80 * MB, 90 * MB, 100 * MB, - 110 * MB, 120 * MB, 130 * MB, 140 * MB, 150 * MB, - 160 * MB, 170 * MB, 180 * MB, 190 * MB, 200 * MB, - 220 * MB, 240 * MB, 260 * MB, 280 * MB, 300 * MB, - 320 * MB, 340 * MB, 360 * MB, 380 * MB, 400 * MB, - 450 * MB, 500 * MB, 550 * MB, 600 * MB, 650 * MB, - 700 * MB, 750 * MB, 800 * MB, 850 * MB, 900 * MB, - 950 * MB, 1000 * MB, - }; - - struct vy_stat *s = calloc(1, sizeof(*s)); - if (s == NULL) { - diag_set(OutOfMemory, sizeof(*s), "stat", "struct"); - return NULL; - } - s->dump_bw = histogram_new(bandwidth_buckets, - lengthof(bandwidth_buckets)); - if (s->dump_bw == NULL) { - free(s); - return NULL; - } - /* - * Until we dump anything, assume bandwidth to be 10 MB/s, - * which should be fine for initial guess. - */ - histogram_collect(s->dump_bw, 10 * MB); - - s->rmean = rmean_new(vy_stat_strings, VY_STAT_LAST); - if (s->rmean == NULL) { - histogram_delete(s->dump_bw); - free(s); - return NULL; - } - return s; -} - -static void -vy_stat_delete(struct vy_stat *s) -{ - histogram_delete(s->dump_bw); - rmean_delete(s->rmean); - free(s); -} - -static int64_t -vy_stat_dump_bandwidth(struct vy_stat *s) -{ - /* See comment to vy_stat->dump_bw. */ - return histogram_percentile(s->dump_bw, 10); -} - /** Cursor. */ struct vy_cursor { /** @@ -318,56 +240,56 @@ struct vy_cursor { /** {{{ Introspection */ static void -vy_info_append_memory(struct vy_env *env, struct info_handler *h) +vy_info_append_quota(struct vy_env *env, struct info_handler *h) { - char buf[16]; struct vy_quota *q = &env->quota; - info_table_begin(h, "memory"); + + info_table_begin(h, "quota"); info_append_int(h, "used", q->used); info_append_int(h, "limit", q->limit); info_append_int(h, "watermark", q->watermark); - snprintf(buf, sizeof(buf), "%d%%", (int)(100 * q->used / q->limit)); - info_append_str(h, "ratio", buf); + info_append_int(h, "use_rate", env->quota_use_rate); + info_append_int(h, "dump_bandwidth", vy_dump_bandwidth(env)); info_table_end(h); } -static int -vy_info_append_stat_rmean(const char *name, int rps, int64_t total, void *ctx) +static void +vy_info_append_cache(struct vy_env *env, struct info_handler *h) { - struct info_handler *h = ctx; - info_table_begin(h, name); - info_append_int(h, "rps", rps); - info_append_int(h, "total", total); + struct vy_cache_env *c = &env->cache_env; + + info_table_begin(h, "cache"); + + info_append_int(h, "used", c->mem_used); + info_append_int(h, "limit", c->mem_quota); + + struct mempool_stats mstats; + mempool_stats(&c->cache_entry_mempool, &mstats); + info_append_int(h, "tuples", mstats.objcount); + info_table_end(h); - return 0; } static void -vy_info_append_performance(struct vy_env *env, struct info_handler *h) +vy_info_append_tx(struct vy_env *env, struct info_handler *h) { - struct vy_stat *stat = env->stat; + struct tx_manager *xm = env->xm; - info_table_begin(h, "performance"); + info_table_begin(h, "tx"); - rmean_foreach(stat->rmean, vy_info_append_stat_rmean, h); + info_append_int(h, "commit", xm->stat.commit); + info_append_int(h, "rollback", xm->stat.rollback); + info_append_int(h, "conflict", xm->stat.conflict); struct mempool_stats mstats; - mempool_stats(&env->xm->tx_mempool, &mstats); - info_append_int(h, "tx_allocated", mstats.objcount); - mempool_stats(&env->xm->txv_mempool, &mstats); - info_append_int(h, "txv_allocated", mstats.objcount); - mempool_stats(&env->xm->read_interval_mempool, &mstats); - info_append_int(h, "read_interval", mstats.objcount); - mempool_stats(&env->xm->read_view_mempool, &mstats); - info_append_int(h, "read_view", mstats.objcount); - - info_append_int(h, "dump_bandwidth", vy_stat_dump_bandwidth(stat)); - - struct vy_cache_env *ce = &env->cache_env; - info_table_begin(h, "cache"); - info_append_int(h, "count", ce->cached_count); - info_append_int(h, "used", ce->mem_used); - info_table_end(h); + mempool_stats(&xm->tx_mempool, &mstats); + info_append_int(h, "transactions", mstats.objcount); + mempool_stats(&xm->txv_mempool, &mstats); + info_append_int(h, "statements", mstats.objcount); + mempool_stats(&xm->read_interval_mempool, &mstats); + info_append_int(h, "gap_locks", mstats.objcount); + mempool_stats(&xm->read_view_mempool, &mstats); + info_append_int(h, "read_views", mstats.objcount); info_table_end(h); } @@ -376,19 +298,9 @@ void vy_info(struct vy_env *env, struct info_handler *h) { info_begin(h); - - vy_info_append_memory(env, h); - vy_info_append_performance(env, h); - info_append_int(h, "lsn", env->xm->lsn); - - struct vy_tx_stat *tx_stat = &env->xm->stat; - info_table_begin(h, "tx"); - info_append_int(h, "active", tx_stat->active); - info_append_int(h, "commit", tx_stat->commit); - info_append_int(h, "rollback", tx_stat->rollback); - info_append_int(h, "conflict", tx_stat->conflict); - info_table_end(h); - + vy_info_append_quota(env, h); + vy_info_append_cache(env, h); + vy_info_append_tx(env, h); info_end(h); } @@ -1103,10 +1015,7 @@ vy_index_get(struct vy_env *env, struct vy_tx *tx, struct vy_index *index, if (*result != NULL) tuple_ref(*result); vy_read_iterator_close(&itr); - if (rc != 0) - return -1; - rmean_collect(env->stat->rmean, VY_STAT_GET, 1); - return 0; + return rc; } /** @@ -2123,9 +2032,6 @@ vy_prepare(struct vy_env *env, struct vy_tx *tx) if (rc != 0) return -1; - rmean_collect(env->stat->rmean, VY_STAT_TX, 1); - rmean_collect(env->stat->rmean, VY_STAT_TX_OPS, tx->write_count); - rmean_collect(env->stat->rmean, VY_STAT_TX_WRITE, write_size); env->quota_use_curr += write_size; return 0; } @@ -2208,8 +2114,6 @@ vy_env_quota_timer_cb(ev_loop *loop, ev_timer *timer, int events) weight * e->quota_use_curr / VY_QUOTA_UPDATE_INTERVAL; e->quota_use_curr = 0; - int64_t dump_bandwidth = vy_stat_dump_bandwidth(e->stat); - /* * Due to log structured nature of the lsregion allocator, * which is used for allocating statements, we cannot free @@ -2221,6 +2125,7 @@ vy_env_quota_timer_cb(ev_loop *loop, ev_timer *timer, int events) * ----------------- = -------------- * quota_use_rate dump_bandwidth */ + int64_t dump_bandwidth = vy_dump_bandwidth(e); size_t watermark = ((double)e->quota.limit * dump_bandwidth / (dump_bandwidth + e->quota_use_rate + 1)); @@ -2277,7 +2182,7 @@ vy_env_dump_complete_cb(struct vy_scheduler *scheduler, /* Account dump bandwidth. */ if (dump_duration > 0) - histogram_collect(env->stat->dump_bw, + histogram_collect(env->dump_bw, mem_dumped / dump_duration); } @@ -2293,6 +2198,21 @@ struct vy_env * vy_env_new(const char *path, size_t memory, size_t cache, int read_threads, int write_threads, double timeout) { + enum { KB = 1000, MB = 1000 * 1000 }; + static int64_t dump_bandwidth_buckets[] = { + 100 * KB, 200 * KB, 300 * KB, 400 * KB, 500 * KB, + 1 * MB, 2 * MB, 3 * MB, 4 * MB, 5 * MB, + 10 * MB, 20 * MB, 30 * MB, 40 * MB, 50 * MB, + 60 * MB, 70 * MB, 80 * MB, 90 * MB, 100 * MB, + 110 * MB, 120 * MB, 130 * MB, 140 * MB, 150 * MB, + 160 * MB, 170 * MB, 180 * MB, 190 * MB, 200 * MB, + 220 * MB, 240 * MB, 260 * MB, 280 * MB, 300 * MB, + 320 * MB, 340 * MB, 360 * MB, 380 * MB, 400 * MB, + 450 * MB, 500 * MB, 550 * MB, 600 * MB, 650 * MB, + 700 * MB, 750 * MB, 800 * MB, 850 * MB, 900 * MB, + 950 * MB, 1000 * MB, + }; + struct vy_env *e = malloc(sizeof(*e)); if (unlikely(e == NULL)) { diag_set(OutOfMemory, sizeof(*e), "malloc", "struct vy_env"); @@ -2310,12 +2230,23 @@ vy_env_new(const char *path, size_t memory, size_t cache, int read_threads, "malloc", "env->path"); goto error_path; } + + e->dump_bw = histogram_new(dump_bandwidth_buckets, + lengthof(dump_bandwidth_buckets)); + if (e->dump_bw == NULL) { + diag_set(OutOfMemory, 0, "histogram_new", + "dump bandwidth histogram"); + goto error_dump_bw; + } + /* + * Until we dump anything, assume bandwidth to be 10 MB/s, + * which should be fine for initial guess. + */ + histogram_collect(e->dump_bw, 10 * MB); + e->xm = tx_manager_new(); if (e->xm == NULL) goto error_xm; - e->stat = vy_stat_new(); - if (e->stat == NULL) - goto error_stat; e->squash_queue = vy_squash_queue_new(); if (e->squash_queue == NULL) goto error_squash_queue; @@ -2348,10 +2279,10 @@ vy_env_new(const char *path, size_t memory, size_t cache, int read_threads, vy_scheduler_destroy(&e->scheduler); vy_squash_queue_delete(e->squash_queue); error_squash_queue: - vy_stat_delete(e->stat); -error_stat: tx_manager_delete(e->xm); error_xm: + histogram_delete(e->dump_bw); +error_dump_bw: free(e->path); error_path: free(e); @@ -2366,7 +2297,7 @@ vy_env_delete(struct vy_env *e) vy_squash_queue_delete(e->squash_queue); tx_manager_delete(e->xm); free(e->path); - vy_stat_delete(e->stat); + histogram_delete(e->dump_bw); mempool_destroy(&e->cursor_pool); vy_run_env_destroy(&e->run_env); vy_index_env_destroy(&e->index_env); @@ -3446,8 +3377,6 @@ vy_cursor_delete(struct vy_env *env, struct vy_cursor *c) if (c->key) tuple_unref(c->key); vy_index_unref(c->index); - rmean_collect(env->stat->rmean, VY_STAT_CURSOR, 1); - rmean_collect(env->stat->rmean, VY_STAT_CURSOR_OPS, c->n_reads); TRASH(c); mempool_free(&env->cursor_pool, c); } diff --git a/src/box/vy_cache.c b/src/box/vy_cache.c index 5e861a27b4..24ce2fa348 100644 --- a/src/box/vy_cache.c +++ b/src/box/vy_cache.c @@ -59,7 +59,6 @@ vy_cache_env_create(struct vy_cache_env *e, struct slab_cache *slab_cache, e->mem_quota = mem_quota; mempool_create(&e->cache_entry_mempool, slab_cache, sizeof(struct vy_cache_entry)); - e->cached_count = 0; } void @@ -90,7 +89,6 @@ vy_cache_entry_new(struct vy_cache_env *env, struct vy_cache *cache, entry->right_boundary_level = cache->cmp_def->part_count; rlist_add(&env->cache_lru, &entry->in_lru); env->mem_used += vy_cache_entry_size(entry); - env->cached_count++; vy_stmt_counter_acct_tuple(&cache->stat.count, stmt); return entry; } @@ -99,8 +97,6 @@ static void vy_cache_entry_delete(struct vy_cache_env *env, struct vy_cache_entry *entry) { vy_stmt_counter_unacct_tuple(&entry->cache->stat.count, entry->stmt); - assert(env->cached_count > 0); - env->cached_count--; assert(env->mem_used >= vy_cache_entry_size(entry)); env->mem_used -= vy_cache_entry_size(entry); tuple_unref(entry->stmt); diff --git a/src/box/vy_cache.h b/src/box/vy_cache.h index 424281f2d8..b3ad3d0da2 100644 --- a/src/box/vy_cache.h +++ b/src/box/vy_cache.h @@ -117,8 +117,6 @@ struct vy_cache_env { struct rlist cache_lru; /** Common mempool for vy_cache_entry struct */ struct mempool cache_entry_mempool; - /** Number of cached tuples */ - size_t cached_count; /** Size of memory occupied by cached tuples */ size_t mem_used; /** Max memory size that can be used for cache */ diff --git a/src/box/vy_stat.h b/src/box/vy_stat.h index 468c0d5b97..35442629d9 100644 --- a/src/box/vy_stat.h +++ b/src/box/vy_stat.h @@ -178,8 +178,6 @@ struct vy_cache_stat { /** Transaction statistics. */ struct vy_tx_stat { - /** Number of active transactions. */ - int32_t active; /** Number of committed transactions. */ int64_t commit; /** Number of rolled back transactions. */ diff --git a/src/box/vy_tx.c b/src/box/vy_tx.c index 15f7b5d6fa..d71e8896b6 100644 --- a/src/box/vy_tx.c +++ b/src/box/vy_tx.c @@ -289,7 +289,6 @@ vy_tx_create(struct tx_manager *xm, struct vy_tx *tx) vy_tx_read_set_new(&tx->read_set); tx->psn = 0; rlist_create(&tx->on_destroy); - xm->stat.active++; } void @@ -308,8 +307,6 @@ vy_tx_destroy(struct vy_tx *tx) } vy_tx_read_set_iter(&tx->read_set, NULL, vy_tx_read_set_free_cb, NULL); - - tx->xm->stat.active--; } /** Return true if the transaction is read-only. */ @@ -818,7 +815,6 @@ vy_tx_set(struct vy_tx *tx, struct vy_index *index, struct tuple *stmt) if (old != NULL) { /* Leave the old txv in TX log but remove it from write set */ assert(tx->write_size >= tuple_size(old->stmt)); - tx->write_count--; tx->write_size -= tuple_size(old->stmt); write_set_remove(&tx->write_set, old); old->is_overwritten = true; @@ -838,7 +834,6 @@ vy_tx_set(struct vy_tx *tx, struct vy_index *index, struct tuple *stmt) v->overwritten = old; write_set_insert(&tx->write_set, v); tx->write_set_version++; - tx->write_count++; tx->write_size += tuple_size(stmt); vy_stmt_counter_acct_tuple(&index->stat.txw.count, stmt); stailq_add_tail_entry(&tx->log, v, next_in_log); diff --git a/src/box/vy_tx.h b/src/box/vy_tx.h index fbdfc80add..bfbeffa438 100644 --- a/src/box/vy_tx.h +++ b/src/box/vy_tx.h @@ -142,8 +142,6 @@ struct vy_tx { * (insert/remove), the version is incremented. */ uint32_t write_set_version; - /** Number of statements in the write set. */ - int write_count; /** * Total size of memory occupied by statements of * the write set. diff --git a/test/vinyl/errinj.result b/test/vinyl/errinj.result index b8696a8e45..4a5bc14d07 100644 --- a/test/vinyl/errinj.result +++ b/test/vinyl/errinj.result @@ -583,7 +583,7 @@ errinj.set("ERRINJ_WAL_DELAY", true) --- - ok ... -lsn = box.info.vinyl().lsn +lsn = box.info.lsn --- ... c0('s:replace{1, "c0"}') @@ -601,7 +601,7 @@ c0('s:replace{3, "c0"}') _ = fiber.create(c0.commit, c0) --- ... -box.info.vinyl().lsn == lsn +box.info.lsn == lsn --- - true ... @@ -616,7 +616,7 @@ c1('s:replace{2, "c1"}') _ = fiber.create(c1.commit, c1) --- ... -box.info.vinyl().lsn == lsn +box.info.lsn == lsn --- - true ... @@ -635,7 +635,7 @@ c2('s:replace{3, "c2"}') _ = fiber.create(c2.commit, c2) --- ... -box.info.vinyl().lsn == lsn +box.info.lsn == lsn --- - true ... @@ -659,10 +659,10 @@ errinj.set("ERRINJ_WAL_DELAY", false) REQ_COUNT = 7 --- ... -while box.info.vinyl().lsn - lsn < REQ_COUNT do fiber.sleep(0.01) end +while box.info.lsn - lsn < REQ_COUNT do fiber.sleep(0.01) end --- ... -box.info.vinyl().lsn == lsn + REQ_COUNT +box.info.lsn == lsn + REQ_COUNT --- - true ... diff --git a/test/vinyl/errinj.test.lua b/test/vinyl/errinj.test.lua index 23b723bcb9..5def06a0ec 100644 --- a/test/vinyl/errinj.test.lua +++ b/test/vinyl/errinj.test.lua @@ -227,21 +227,21 @@ c3:begin() -- Pause WAL writer to cause all further calls to box.commit() to move -- transactions into prepared, but not committed yet state. errinj.set("ERRINJ_WAL_DELAY", true) -lsn = box.info.vinyl().lsn +lsn = box.info.lsn c0('s:replace{1, "c0"}') c0('s:replace{2, "c0"}') c0('s:replace{3, "c0"}') _ = fiber.create(c0.commit, c0) -box.info.vinyl().lsn == lsn +box.info.lsn == lsn c1('s:replace{1, "c1"}') c1('s:replace{2, "c1"}') _ = fiber.create(c1.commit, c1) -box.info.vinyl().lsn == lsn +box.info.lsn == lsn c3('s:select{1}') -- c1 is visible c2('s:replace{1, "c2"}') c2('s:replace{3, "c2"}') _ = fiber.create(c2.commit, c2) -box.info.vinyl().lsn == lsn +box.info.lsn == lsn c3('s:select{1}') -- c1 is visible, c2 is not c3('s:select{2}') -- c1 is visible c3('s:select{3}') -- c2 is not visible @@ -249,8 +249,8 @@ c3('s:select{3}') -- c2 is not visible -- Resume WAL writer and wait until all transactions will been committed errinj.set("ERRINJ_WAL_DELAY", false) REQ_COUNT = 7 -while box.info.vinyl().lsn - lsn < REQ_COUNT do fiber.sleep(0.01) end -box.info.vinyl().lsn == lsn + REQ_COUNT +while box.info.lsn - lsn < REQ_COUNT do fiber.sleep(0.01) end +box.info.lsn == lsn + REQ_COUNT c3('s:select{1}') -- c1 is visible, c2 is not c3('s:select{2}') -- c1 is visible diff --git a/test/vinyl/mvcc.result b/test/vinyl/mvcc.result index 16534827fe..be10f2d6ee 100644 --- a/test/vinyl/mvcc.result +++ b/test/vinyl/mvcc.result @@ -4012,11 +4012,11 @@ s:replace{7, 8, 9} --- - [7, 8, 9] ... -box.info.vinyl().performance.read_view -- 0 (no read views needed) +box.info.vinyl().tx.read_views -- 0 (no read views needed) --- - 0 ... -box.info.vinyl().performance.tx_allocated -- 0 +box.info.vinyl().tx.transactions -- 0 --- - 0 ... @@ -4048,11 +4048,11 @@ c4:begin() --- - ... -box.info.vinyl().performance.read_view -- 0 (no read views needed) +box.info.vinyl().tx.read_views -- 0 (no read views needed) --- - 0 ... -box.info.vinyl().performance.tx_allocated -- 0 +box.info.vinyl().tx.transactions -- 0 --- - 0 ... @@ -4072,11 +4072,11 @@ c4("s:select{1}") --- - - [[1, 2, 3]] ... -box.info.vinyl().performance.read_view -- 0 (no read views needed) +box.info.vinyl().tx.read_views -- 0 (no read views needed) --- - 0 ... -box.info.vinyl().performance.tx_allocated -- 4 +box.info.vinyl().tx.transactions -- 4 --- - 4 ... @@ -4084,11 +4084,11 @@ c4("s:replace{1, 0, 0}") --- - - [1, 0, 0] ... -box.info.vinyl().performance.read_view -- 0 (no read views needed) +box.info.vinyl().tx.read_views -- 0 (no read views needed) --- - 0 ... -box.info.vinyl().performance.tx_allocated -- 4 +box.info.vinyl().tx.transactions -- 4 --- - 4 ... @@ -4096,11 +4096,11 @@ c4:commit() --- - ... -box.info.vinyl().performance.read_view -- 1 (one read view for all TXs) +box.info.vinyl().tx.read_views -- 1 (one read view for all TXs) --- - 1 ... -box.info.vinyl().performance.tx_allocated -- 3 +box.info.vinyl().tx.transactions -- 3 --- - 3 ... @@ -4108,11 +4108,11 @@ c1:commit() --- - ... -box.info.vinyl().performance.read_view -- 1 (one read view for all TXs) +box.info.vinyl().tx.read_views -- 1 (one read view for all TXs) --- - 1 ... -box.info.vinyl().performance.tx_allocated-- 2 +box.info.vinyl().tx.transactions -- 2 --- - 2 ... @@ -4120,11 +4120,11 @@ c2:rollback() --- - ... -box.info.vinyl().performance.read_view -- 1 (one read view for all TXs) +box.info.vinyl().tx.read_views -- 1 (one read view for all TXs) --- - 1 ... -box.info.vinyl().performance.tx_allocated -- 1 +box.info.vinyl().tx.transactions -- 1 --- - 1 ... @@ -4132,11 +4132,11 @@ c3:commit() --- - ... -box.info.vinyl().performance.read_view -- 0 (no read views needed) +box.info.vinyl().tx.read_views -- 0 (no read views needed) --- - 0 ... -box.info.vinyl().performance.tx_allocated -- 0 (all done) +box.info.vinyl().tx.transactions -- 0 (all done) --- - 0 ... diff --git a/test/vinyl/mvcc.test.lua b/test/vinyl/mvcc.test.lua index 67de94db1a..5f30c7ccaa 100644 --- a/test/vinyl/mvcc.test.lua +++ b/test/vinyl/mvcc.test.lua @@ -1587,8 +1587,8 @@ s:replace{1, 2, 3} s:replace{4, 5, 6} s:replace{7, 8, 9} -box.info.vinyl().performance.read_view -- 0 (no read views needed) -box.info.vinyl().performance.tx_allocated -- 0 +box.info.vinyl().tx.read_views -- 0 (no read views needed) +box.info.vinyl().tx.transactions -- 0 c1 = txn_proxy.new() c2 = txn_proxy.new() @@ -1600,40 +1600,40 @@ c2:begin() c3:begin() c4:begin() -box.info.vinyl().performance.read_view -- 0 (no read views needed) -box.info.vinyl().performance.tx_allocated -- 0 +box.info.vinyl().tx.read_views -- 0 (no read views needed) +box.info.vinyl().tx.transactions -- 0 c1("s:select{1}") c2("s:select{1}") c3("s:select{1}") c4("s:select{1}") -box.info.vinyl().performance.read_view -- 0 (no read views needed) -box.info.vinyl().performance.tx_allocated -- 4 +box.info.vinyl().tx.read_views -- 0 (no read views needed) +box.info.vinyl().tx.transactions -- 4 c4("s:replace{1, 0, 0}") -box.info.vinyl().performance.read_view -- 0 (no read views needed) -box.info.vinyl().performance.tx_allocated -- 4 +box.info.vinyl().tx.read_views -- 0 (no read views needed) +box.info.vinyl().tx.transactions -- 4 c4:commit() -box.info.vinyl().performance.read_view -- 1 (one read view for all TXs) -box.info.vinyl().performance.tx_allocated -- 3 +box.info.vinyl().tx.read_views -- 1 (one read view for all TXs) +box.info.vinyl().tx.transactions -- 3 c1:commit() -box.info.vinyl().performance.read_view -- 1 (one read view for all TXs) -box.info.vinyl().performance.tx_allocated-- 2 +box.info.vinyl().tx.read_views -- 1 (one read view for all TXs) +box.info.vinyl().tx.transactions -- 2 c2:rollback() -box.info.vinyl().performance.read_view -- 1 (one read view for all TXs) -box.info.vinyl().performance.tx_allocated -- 1 +box.info.vinyl().tx.read_views -- 1 (one read view for all TXs) +box.info.vinyl().tx.transactions -- 1 c3:commit() -box.info.vinyl().performance.read_view -- 0 (no read views needed) -box.info.vinyl().performance.tx_allocated -- 0 (all done) +box.info.vinyl().tx.read_views -- 0 (no read views needed) +box.info.vinyl().tx.transactions -- 0 (all done) s:drop() diff --git a/test/vinyl/quota.result b/test/vinyl/quota.result index fdadbad192..1fa773dd1a 100644 --- a/test/vinyl/quota.result +++ b/test/vinyl/quota.result @@ -12,7 +12,7 @@ test_run:cmd('restart server default') -- -- gh-1863 add BPS tree extents to memory quota -- -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 0 ... @@ -29,7 +29,7 @@ space:insert({1, 1}) --- - [1, 1] ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 98343 ... @@ -37,7 +37,7 @@ space:insert({1, 1}) --- - error: Duplicate key exists in unique index 'pk' in space 'test' ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 98343 ... @@ -45,7 +45,7 @@ space:update({1}, {{'!', 1, 100}}) -- try to modify the primary key --- - error: Attempt to modify a tuple field which is part of index 'pk' in space 'test' ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 98343 ... @@ -61,7 +61,7 @@ space:insert({4, 4}) --- - [4, 4] ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 98460 ... @@ -69,7 +69,7 @@ box.snapshot() --- - ok ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 0 ... @@ -80,14 +80,14 @@ space:select{} - [3, 3] - [4, 4] ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 0 ... _ = space:replace{1, 1, string.rep('a', 1024 * 1024 * 5)} --- ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 5341228 ... diff --git a/test/vinyl/quota.test.lua b/test/vinyl/quota.test.lua index ea5c5832d8..c4cea8fb1a 100644 --- a/test/vinyl/quota.test.lua +++ b/test/vinyl/quota.test.lua @@ -12,7 +12,7 @@ test_run:cmd('restart server default') -- gh-1863 add BPS tree extents to memory quota -- -box.info.vinyl().memory.used +box.info.vinyl().quota.used space = box.schema.space.create('test', { engine = 'vinyl' }) pk = space:create_index('pk') @@ -20,32 +20,32 @@ sec = space:create_index('sec', { parts = {2, 'unsigned'} }) space:insert({1, 1}) -box.info.vinyl().memory.used +box.info.vinyl().quota.used space:insert({1, 1}) -box.info.vinyl().memory.used +box.info.vinyl().quota.used space:update({1}, {{'!', 1, 100}}) -- try to modify the primary key -box.info.vinyl().memory.used +box.info.vinyl().quota.used space:insert({2, 2}) space:insert({3, 3}) space:insert({4, 4}) -box.info.vinyl().memory.used +box.info.vinyl().quota.used box.snapshot() -box.info.vinyl().memory.used +box.info.vinyl().quota.used space:select{} -box.info.vinyl().memory.used +box.info.vinyl().quota.used _ = space:replace{1, 1, string.rep('a', 1024 * 1024 * 5)} -box.info.vinyl().memory.used +box.info.vinyl().quota.used space:drop() diff --git a/test/vinyl/quota_timeout.result b/test/vinyl/quota_timeout.result index 7a38e706b9..fe2c80f549 100644 --- a/test/vinyl/quota_timeout.result +++ b/test/vinyl/quota_timeout.result @@ -47,7 +47,7 @@ s:count() --- - 1 ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 748241 ... @@ -61,7 +61,7 @@ s:count() --- - 1 ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 748241 ... @@ -93,7 +93,7 @@ _ = s2:create_index('pk') _ = s1:auto_increment{} --- ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 49186 ... @@ -104,10 +104,10 @@ _ = s2:auto_increment{pad} --- - error: Timed out waiting for Vinyl memory quota ... -while box.info.vinyl().memory.used > 0 do fiber.sleep(0.01) end +while box.info.vinyl().quota.used > 0 do fiber.sleep(0.01) end --- ... -box.info.vinyl().memory.used +box.info.vinyl().quota.used --- - 0 ... diff --git a/test/vinyl/quota_timeout.test.lua b/test/vinyl/quota_timeout.test.lua index 32bcf2cb49..8f3b9ad89b 100644 --- a/test/vinyl/quota_timeout.test.lua +++ b/test/vinyl/quota_timeout.test.lua @@ -21,13 +21,13 @@ _ = s:create_index('pk') pad = string.rep('x', 2 * box.cfg.vinyl_memory / 3) _ = s:auto_increment{pad} s:count() -box.info.vinyl().memory.used +box.info.vinyl().quota.used -- Since the following operation requires more memory than configured -- and dump is disabled, it should fail with ER_VY_QUOTA_TIMEOUT. _ = s:auto_increment{pad} s:count() -box.info.vinyl().memory.used +box.info.vinyl().quota.used s:drop() @@ -43,13 +43,13 @@ s2 = box.schema.space.create('test2', {engine = 'vinyl'}) _ = s2:create_index('pk') _ = s1:auto_increment{} -box.info.vinyl().memory.used +box.info.vinyl().quota.used pad = string.rep('x', box.cfg.vinyl_memory) _ = s2:auto_increment{pad} -while box.info.vinyl().memory.used > 0 do fiber.sleep(0.01) end -box.info.vinyl().memory.used +while box.info.vinyl().quota.used > 0 do fiber.sleep(0.01) end +box.info.vinyl().quota.used -- -- Check that exceeding quota doesn't hang the scheduler diff --git a/test/vinyl/recovery_quota.result b/test/vinyl/recovery_quota.result index e073ab2210..433dc47c3c 100644 --- a/test/vinyl/recovery_quota.result +++ b/test/vinyl/recovery_quota.result @@ -74,7 +74,7 @@ test_run:cmd('switch test') stat = box.info.vinyl() --- ... -stat.memory.used <= stat.memory.limit or {stat.memory.used, stat.memory.limit} +stat.quota.used <= stat.quota.limit or {stat.quota.used, stat.quota.limit} --- - true ... @@ -123,7 +123,7 @@ for i = 1, box.cfg.vinyl_memory / pad_size do box.space.test:replace{i, pad} end --- - error: Timed out waiting for Vinyl memory quota ... -box.info.vinyl().memory.used > 1024 * 1024 +box.info.vinyl().quota.used > 1024 * 1024 --- - true ... @@ -155,7 +155,7 @@ while box.space.test.index.pk:info().disk.dump.count == 0 do fiber.sleep(0.001) stat = box.info.vinyl() --- ... -stat.memory.used <= stat.memory.limit or {stat.memory.used, stat.memory.limit} +stat.quota.used <= stat.quota.limit or {stat.quota.used, stat.quota.limit} --- - true ... diff --git a/test/vinyl/recovery_quota.test.lua b/test/vinyl/recovery_quota.test.lua index 871aa0aba4..9f38f5ce1e 100644 --- a/test/vinyl/recovery_quota.test.lua +++ b/test/vinyl/recovery_quota.test.lua @@ -32,7 +32,7 @@ test_run:cmd('restart server test') test_run:cmd('switch test') -- Check that we do not exceed quota. stat = box.info.vinyl() -stat.memory.used <= stat.memory.limit or {stat.memory.used, stat.memory.limit} +stat.quota.used <= stat.quota.limit or {stat.quota.used, stat.quota.limit} -- Check that we did not replay statements dumped before restart. stat = box.space.test.index.pk:info() var = box.space.var @@ -48,7 +48,7 @@ box.cfg{vinyl_timeout=0.001} pad_size = 1000 pad = string.rep('x', pad_size) for i = 1, box.cfg.vinyl_memory / pad_size do box.space.test:replace{i, pad} end -box.info.vinyl().memory.used > 1024 * 1024 +box.info.vinyl().quota.used > 1024 * 1024 test_run:cmd('switch default') test_run:cmd('stop server test') @@ -61,7 +61,7 @@ fiber = require 'fiber' -- All memory above the limit must be dumped after recovery. while box.space.test.index.pk:info().disk.dump.count == 0 do fiber.sleep(0.001) end stat = box.info.vinyl() -stat.memory.used <= stat.memory.limit or {stat.memory.used, stat.memory.limit} +stat.quota.used <= stat.quota.limit or {stat.quota.used, stat.quota.limit} _ = test_run:cmd('switch default') test_run:cmd('stop server test2') diff --git a/test/vinyl/tx_gap_lock.result b/test/vinyl/tx_gap_lock.result index 50104b7604..2a5087bf92 100644 --- a/test/vinyl/tx_gap_lock.result +++ b/test/vinyl/tx_gap_lock.result @@ -681,7 +681,7 @@ s:drop() ---------------------------------------------------------------- -- Interval merging ---------------------------------------------------------------- -function gap_lock_count() return box.info.vinyl().performance.read_interval end +function gap_lock_count() return box.info.vinyl().tx.gap_locks end --- ... s = box.schema.space.create('test', {engine = 'vinyl'}) diff --git a/test/vinyl/tx_gap_lock.test.lua b/test/vinyl/tx_gap_lock.test.lua index 2d72803382..2343a719a1 100644 --- a/test/vinyl/tx_gap_lock.test.lua +++ b/test/vinyl/tx_gap_lock.test.lua @@ -219,7 +219,7 @@ s:drop() ---------------------------------------------------------------- -- Interval merging ---------------------------------------------------------------- -function gap_lock_count() return box.info.vinyl().performance.read_interval end +function gap_lock_count() return box.info.vinyl().tx.gap_locks end s = box.schema.space.create('test', {engine = 'vinyl'}) _ = s:create_index('pk') diff --git a/test/vinyl/upgrade/fill.lua b/test/vinyl/upgrade/fill.lua index 81a0d946b5..37c0ab443b 100644 --- a/test/vinyl/upgrade/fill.lua +++ b/test/vinyl/upgrade/fill.lua @@ -17,7 +17,7 @@ dump_trigger:create_index('pk') function dump() pcall(dump_trigger.insert, dump_trigger, {1, string.rep('x', 1024 * 1024)}) - while box.info.vinyl().memory.used > 0 do + while box.info.vinyl().quota.used > 0 do fiber.sleep(0.1) end end -- GitLab