diff --git a/src/box/box.cc b/src/box/box.cc index 139796c8cd6fc3355d74ac340706d9f3daa2ff5a..6442b071bf3f6800d5b7d5e63dfc26b42ad36f9d 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -395,6 +395,7 @@ box_init() tuple_init(cfg_getd("slab_alloc_arena"), cfg_geti("slab_alloc_minimal"), + cfg_geti("slab_alloc_maximal"), cfg_getd("slab_alloc_factor")); try { diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua index ba8d14e7f7f3a41a97692315169fdf83bb0f7b58..929e5a802cdcc4c3a47f87ed25b27e0f9e011274 100644 --- a/src/box/lua/load_cfg.lua +++ b/src/box/lua/load_cfg.lua @@ -27,6 +27,7 @@ local default_cfg = { listen = nil, slab_alloc_arena = 1.0, slab_alloc_minimal = 64, + slab_alloc_maximal = 1024 * 1024, slab_alloc_factor = 2.0, work_dir = nil, snap_dir = ".", @@ -71,6 +72,7 @@ local template_cfg = { listen = 'string, number', slab_alloc_arena = 'number', slab_alloc_minimal = 'number', + slab_alloc_maximal = 'number', slab_alloc_factor = 'number', work_dir = 'string', snap_dir = 'string', diff --git a/src/box/memtx_hash.cc b/src/box/memtx_hash.cc index edc46d8ef922955ee96bde3eaf4f60e443ce71dd..fbf880eb193a163b35409494ff8595af7b3be0cd 100644 --- a/src/box/memtx_hash.cc +++ b/src/box/memtx_hash.cc @@ -228,8 +228,7 @@ MemtxHash::MemtxHash(struct key_def *key_def) 0, SLAB_SIZE, MAP_PRIVATE)) { panic_syserror("failed to initialize index arena"); } - slab_cache_create(&index_arena_slab_cache, &index_arena, - SLAB_SIZE); + slab_cache_create(&index_arena_slab_cache, &index_arena); mempool_create(&hash_extent_pool, &index_arena_slab_cache, HASH_INDEX_EXTENT_SIZE); index_arena_initialized = true; diff --git a/src/box/memtx_tree.cc b/src/box/memtx_tree.cc index 46a47ce07d658afc0ea61b9bfb5a0616766ecd3a..6ed291202b9d3f445992b20acc2552efb6020658 100644 --- a/src/box/memtx_tree.cc +++ b/src/box/memtx_tree.cc @@ -211,8 +211,7 @@ MemtxTree::MemtxTree(struct key_def *key_def_arg) 0, SLAB_SIZE, MAP_PRIVATE)) { panic_syserror("failed to initialize index arena"); } - slab_cache_create(&index_arena_slab_cache, &index_arena, - SLAB_SIZE); + slab_cache_create(&index_arena_slab_cache, &index_arena); mempool_create(&tree_extent_pool, &index_arena_slab_cache, BPS_TREE_EXTENT_SIZE); index_arena_initialized = true; diff --git a/src/box/tuple.cc b/src/box/tuple.cc index 0791038dbcfdb5790a0f7f76cbe9900d13070978..6fc4b2b00fd52f3f69fd2004015400057621eaac 100644 --- a/src/box/tuple.cc +++ b/src/box/tuple.cc @@ -50,6 +50,13 @@ struct slab_arena memtx_arena; static struct slab_cache memtx_slab_cache; struct small_alloc memtx_alloc; +/* Lowest allowed objsize_min setting of tuple arena */ +const uint32_t MIN_TUPLE_SIZE_NOT_LESS_THAN = 16; +/* Lowest allowed objsize_max setting of tuple arena */ +const uint32_t MAX_TUPLE_SIZE_NOT_LESS_THAN = 16 * 1024; +/* Lowest allowed slab size for tuple arena */ +const size_t SLAB_SIZE_NOT_LESS_THAN = 1024 * 1024; + /** Extract all available type info from keys. */ void field_type_create(enum field_type *types, uint32_t field_count, @@ -276,12 +283,13 @@ tuple_delete(struct tuple *tuple) say_debug("tuple_delete(%p)", tuple); assert(tuple->refs == 0); struct tuple_format *format = tuple_format(tuple); + size_t total = sizeof(struct tuple) + tuple->bsize + format->field_map_size; char *ptr = (char *) tuple - format->field_map_size; tuple_format_ref(format, -1); if (!memtx_alloc.is_delayed_free_mode || tuple->version == snapshot_version) - smfree(&memtx_alloc, ptr); + smfree(&memtx_alloc, ptr, total); else - smfree_delayed(&memtx_alloc, ptr); + smfree_delayed(&memtx_alloc, ptr, total); } /** @@ -519,13 +527,23 @@ tuple_compare_with_key(const struct tuple *tuple, const char *key, void tuple_init(float tuple_arena_max_size, uint32_t objsize_min, - float alloc_factor) + uint32_t objsize_max, float alloc_factor) { tuple_format_ber = tuple_format_new(&rlist_nil); /* Make sure this one stays around. */ tuple_format_ref(tuple_format_ber, 1); - const uint32_t SLAB_SIZE = 4 * 1024 * 1024; + /* Apply lowest allowed objsize bounds */ + if (objsize_min < MIN_TUPLE_SIZE_NOT_LESS_THAN) + objsize_min = MIN_TUPLE_SIZE_NOT_LESS_THAN; + if (objsize_max < MAX_TUPLE_SIZE_NOT_LESS_THAN) + objsize_max = MAX_TUPLE_SIZE_NOT_LESS_THAN; + + /* Calculate slab size for tuple arena */ + size_t max_slab_size = small_round(objsize_max * 4); + if (max_slab_size < SLAB_SIZE_NOT_LESS_THAN) + max_slab_size = SLAB_SIZE_NOT_LESS_THAN; + size_t max_size = tuple_arena_max_size * 1024 * 1024 * 1024; quota_init(&memtx_quota, max_size); @@ -541,7 +559,7 @@ tuple_init(float tuple_arena_max_size, uint32_t objsize_min, } if (slab_arena_create(&memtx_arena, &memtx_quota, - max_size, SLAB_SIZE, flags)) { + max_size, max_slab_size, flags)) { if (ENOMEM == errno) { panic("failed to preallocate %zu bytes: " "Cannot allocate memory, check option " @@ -552,8 +570,7 @@ tuple_init(float tuple_arena_max_size, uint32_t objsize_min, max_size); } } - slab_cache_create(&memtx_slab_cache, &memtx_arena, - SLAB_SIZE); + slab_cache_create(&memtx_slab_cache, &memtx_arena); small_alloc_create(&memtx_alloc, &memtx_slab_cache, objsize_min, alloc_factor); } diff --git a/src/box/tuple.h b/src/box/tuple.h index 4e2b2902ea65bcf7d3763229ea7830dd331ec3fe..815e1918746d7cd54dce35bad9bd6f9d68332473 100644 --- a/src/box/tuple.h +++ b/src/box/tuple.h @@ -536,7 +536,7 @@ tuple_to_buf(struct tuple *tuple, char *buf); /** Initialize tuple library */ void tuple_init(float alloc_arena_max_size, uint32_t slab_alloc_minimal, - float alloc_factor); + uint32_t slab_alloc_maximal, float alloc_factor); /** Cleanup tuple library */ void diff --git a/src/box/user.cc b/src/box/user.cc index b7ee0157f03919317b32ac3a11c8f2054c1e3162..c3a4aab31f2b0a08052396e0b848fe88f1967f79 100644 --- a/src/box/user.cc +++ b/src/box/user.cc @@ -467,6 +467,7 @@ user_cache_init() struct user *user = user_cache_replace(&def); /* 0 is the auth token and user id by default. */ assert(user->uid == GUEST && user->auth_token == GUEST); + (void)user; memset(&def, 0, sizeof(def)); snprintf(def.name, sizeof(def.name), "admin"); diff --git a/src/fiber.cc b/src/fiber.cc index 13d1aff1c8b807118b10a75be56d83044301e0b9..d1d64f6d1ed95ff4ea30265dced120cf97bde1e0 100644 --- a/src/fiber.cc +++ b/src/fiber.cc @@ -470,7 +470,7 @@ cord_create(struct cord *cord, const char *name) cord->id = pthread_self(); cord->loop = cord->id == main_thread_id ? ev_default_loop(EVFLAG_AUTO) : ev_loop_new(EVFLAG_AUTO); - slab_cache_create(&cord->slabc, &runtime, 0); + slab_cache_create(&cord->slabc, &runtime); mempool_create(&cord->fiber_pool, &cord->slabc, sizeof(struct fiber)); rlist_create(&cord->fibers); diff --git a/src/lib/small/mempool.h b/src/lib/small/mempool.h index a012aa175031b3bc32c6eb6e9415d5995a2cac8d..dab88d42fd80f71779a64576126ba427c1df50c2 100644 --- a/src/lib/small/mempool.h +++ b/src/lib/small/mempool.h @@ -89,7 +89,7 @@ struct mslab { * Mempool will try to allocate blocks large enough to have overhead * less than specified below */ -static const double expected_overhead_max = 0.05; +static const double expected_overhead_max = 0.01; static inline uint32_t mslab_sizeof() @@ -194,6 +194,8 @@ mempool_create(struct mempool *pool, struct slab_cache *cache, size_t expected_loss = objsize > sizeof(struct mslab) ? objsize : sizeof(struct mslab); size_t slab_size_min = (size_t)(expected_loss / expected_overhead_max); + if (slab_size_min > cache->arena->slab_size) + slab_size_min = cache->arena->slab_size; /* * Calculate the amount of usable space in a slab. @@ -201,6 +203,7 @@ mempool_create(struct mempool *pool, struct slab_cache *cache, * SLAB_ORDER_MAX. */ uint8_t order = slab_order(cache, slab_size_min); + assert(order <= cache->order_max); return mempool_create_with_order(pool, cache, objsize, order); } diff --git a/src/lib/small/slab_cache.c b/src/lib/small/slab_cache.c index e955e4bad95169bdcd018083055d9a76f18e3dde..d837fe462d2841616cb7a0232586fe2a00c15fce 100644 --- a/src/lib/small/slab_cache.c +++ b/src/lib/small/slab_cache.c @@ -159,25 +159,19 @@ slab_merge(struct slab_cache *cache, struct slab *slab, struct slab *buddy) } void -slab_cache_create(struct slab_cache *cache, struct slab_arena *arena, - uint32_t order0_size) +slab_cache_create(struct slab_cache *cache, struct slab_arena *arena) { cache->arena = arena; - if (order0_size < sysconf(_SC_PAGESIZE)) - order0_size = sysconf(_SC_PAGESIZE); - - cache->order0_size = small_round(order0_size); - - if (cache->order0_size > arena->slab_size) - cache->order0_size = arena->slab_size; + long lowest_order0_size = small_round(sysconf(_SC_PAGESIZE)); + assert(arena->slab_size >= lowest_order0_size); + cache->order_max = small_lb(arena->slab_size / lowest_order0_size); + if (cache->order_max > ORDER_MAX - 1) + cache->order_max = ORDER_MAX - 1; + cache->order0_size = arena->slab_size >> cache->order_max; cache->order0_size_lb = small_lb(cache->order0_size); - cache->order_max = (small_lb(arena->slab_size) - - cache->order0_size_lb); - assert(cache->order_max < ORDER_MAX); - slab_list_create(&cache->allocated); for (uint8_t i = 0; i <= cache->order_max; i++) slab_list_create(&cache->orders[i]); diff --git a/src/lib/small/slab_cache.h b/src/lib/small/slab_cache.h index 892872e617ffc4a8d6052f441651b0f70f3d5595..abc684f4a23d002c50cfd2bf5944d1b9d4b3b802 100644 --- a/src/lib/small/slab_cache.h +++ b/src/lib/small/slab_cache.h @@ -162,8 +162,7 @@ struct slab_cache { }; void -slab_cache_create(struct slab_cache *cache, struct slab_arena *arena, - uint32_t order0_size); +slab_cache_create(struct slab_cache *cache, struct slab_arena *arena); void slab_cache_destroy(struct slab_cache *cache); diff --git a/src/lib/small/small.c b/src/lib/small/small.c index a3ea57b7e2c60f0a6f35ca4c28bede8b8fd5ebe7..c665020e2bf29e4b290bea19d51e0af302438c54 100644 --- a/src/lib/small/small.c +++ b/src/lib/small/small.c @@ -42,6 +42,15 @@ enum { STEP_SIZE_LB = 3, }; +/** + * Extended lifo struct for store object size in addition to pointer + * to the next object in the list + */ +struct small_lifo_ext { + struct lifo base; + size_t size; +}; + rb_proto(, factor_tree_, factor_tree_t, struct factor_pool) /** Used for search in the tree. */ @@ -86,9 +95,8 @@ factor_pool_create(struct small_alloc *alloc, if (objsize > alloc->objsize_max) objsize = alloc->objsize_max; struct factor_pool *pool = alloc->factor_pool_next; - alloc->factor_pool_next= pool->next; - mempool_create_with_order(&pool->pool, alloc->cache, - objsize, alloc->slab_order); + alloc->factor_pool_next = pool->next; + mempool_create(&pool->pool, alloc->cache, objsize); pool->objsize_min = prevsize + 1; factor_tree_insert(&alloc->factor_pools, pool); return pool; @@ -101,7 +109,11 @@ small_alloc_create(struct small_alloc *alloc, struct slab_cache *cache, { alloc->cache = cache; /* Align sizes. */ - objsize_min = small_align(objsize_min, sizeof(intptr_t)); + objsize_min = small_align(objsize_min, sizeof(STEP_SIZE)); + /* An object must be large enough to contain struct small_lifo_ext */ + if (objsize_min < sizeof(struct small_lifo_ext)) + objsize_min = small_align(sizeof(struct small_lifo_ext), + sizeof(STEP_SIZE)); alloc->slab_order = cache->order_max; /* Make sure at least 4 largest objects can fit in a slab. */ alloc->objsize_max = @@ -112,9 +124,7 @@ small_alloc_create(struct small_alloc *alloc, struct slab_cache *cache, for (step_pool = alloc->step_pools; step_pool < alloc->step_pools + STEP_POOL_MAX; step_pool++) { - - mempool_create_with_order(step_pool, alloc->cache, - objsize_min, alloc->slab_order); + mempool_create(step_pool, alloc->cache, objsize_min); objsize_min += STEP_SIZE; } alloc->step_pool_objsize_max = (step_pool - 1)->objsize; @@ -175,7 +185,9 @@ smfree_batch(struct small_alloc *alloc) void *item = lifo_pop(&alloc->delayed); if (item == NULL) break; - smfree(alloc, item); + struct small_lifo_ext *ext = (struct small_lifo_ext *) item; + size_t size = ext->size; + smfree(alloc, item, size); } } @@ -229,8 +241,7 @@ smalloc_nothrow(struct small_alloc *alloc, size_t size) return mempool_alloc_nothrow(pool); } - -void +static void small_recycle_pool(struct small_alloc *alloc, struct mempool *pool) { if (mempool_used(pool) == 0 && @@ -245,6 +256,68 @@ small_recycle_pool(struct small_alloc *alloc, struct mempool *pool) } } +/** Free memory chunk allocated by the small allocator. */ +/** + * Free a small objects. + * + * This boils down to finding the object's mempool and delegating + * to mempool_free(). + * + * If the pool becomes completely empty, and it's a factored pool, + * and the factored pool's cache is empty, put back the empty + * factored pool into the factored pool cache. + */ +void +smfree(struct small_alloc *alloc, void *ptr, size_t size) +{ + struct mempool *pool; + if (size <= alloc->step_pool_objsize_max) { + /* Allocated in a stepped pool. */ + int idx; + if (size <= alloc->step_pools[0].objsize) + idx = 0; + else { + idx = (size - alloc->step_pools[0].objsize + + STEP_SIZE - 1) >> STEP_SIZE_LB; + } + pool = &alloc->step_pools[idx]; + assert(size <= pool->objsize && + (size + STEP_SIZE > pool->objsize || idx == 0)); + } else { + /* Allocated in a factor pool. */ + struct factor_pool pattern; + pattern.pool.objsize = size; + struct factor_pool *upper_bound = + factor_tree_nsearch(&alloc->factor_pools, &pattern); + assert(upper_bound != NULL); + assert(size >= upper_bound->objsize_min); + pool = &upper_bound->pool; + } + assert(size <= pool->objsize); + mempool_free(pool, ptr); + + if (mempool_used(pool) == 0) + small_recycle_pool(alloc, pool); +} + +/** + * Free memory chunk allocated by the small allocator + * if not in snapshot mode, otherwise put to the delayed + * free list. + */ +void +smfree_delayed(struct small_alloc *alloc, void *ptr, size_t size) +{ + assert(size >= sizeof(struct small_lifo_ext)); + if (alloc->is_delayed_free_mode && ptr) { + struct small_lifo_ext *ext = (struct small_lifo_ext *)ptr; + ext->size = size; + lifo_push(&alloc->delayed, ptr); + } else { + smfree(alloc, ptr, size); + } +} + /** Simplify iteration over small allocator mempools. */ struct mempool_iterator { diff --git a/src/lib/small/small.h b/src/lib/small/small.h index 2efcab7e9dcf6b4cde4b7530a9026ef1ff1aa2f6..e400b613bfd4d17c4736992503c9015fa4d7331c 100644 --- a/src/lib/small/small.h +++ b/src/lib/small/small.h @@ -186,9 +186,6 @@ small_alloc_destroy(struct small_alloc *alloc); void * smalloc_nothrow(struct small_alloc *alloc, size_t size); -void -small_recycle_pool(struct small_alloc *alloc, struct mempool *pool); - /** Free memory chunk allocated by the small allocator. */ /** * Free a small objects. @@ -200,35 +197,16 @@ small_recycle_pool(struct small_alloc *alloc, struct mempool *pool); * and the factored pool's cache is empty, put back the empty * factored pool into the factored pool cache. */ -static inline void -smfree(struct small_alloc *alloc, void *ptr) -{ - struct mslab *slab = (struct mslab *) - slab_from_ptr(alloc->cache, ptr, alloc->slab_order); - struct mempool *pool = slab->pool; - pool->slabs.stats.used -= pool->objsize; - mslab_free(pool, slab, ptr); - /* - * Don't keep around empty factored pools - * if the allocator is out of them. - */ - if (mempool_used(pool) == 0) - small_recycle_pool(alloc, pool); -} +void +smfree(struct small_alloc *alloc, void *ptr, size_t size); /** * Free memory chunk allocated by the small allocator * if not in snapshot mode, otherwise put to the delayed * free list. */ -static inline void -smfree_delayed(struct small_alloc *alloc, void *ptr) -{ - if (alloc->is_delayed_free_mode && ptr) - lifo_push(&alloc->delayed, ptr); - else - smfree(alloc, ptr); -} +void +smfree_delayed(struct small_alloc *alloc, void *ptr, size_t size); /** * @brief Return an unique index associated with a chunk allocated diff --git a/test/app/float_value.result b/test/app/float_value.result index 99dcf5f9a045b9f8ef947b1f7b2fcd40f410ca63..76c7acde8226824518866d3967ed1a5df8341316 100644 --- a/test/app/float_value.result +++ b/test/app/float_value.result @@ -5,22 +5,23 @@ box.cfg 4 rows_per_wal:50 5 background:false 6 logger:tarantool.log -7 readahead:16320 +7 slab_alloc_arena:0.1 8 listen:3313 9 logger_nonblock:true 10 snap_dir:. 11 coredump:false -12 sophia_dir:. -13 wal_mode:write -14 snapshot_period:0 -15 panic_on_snap_error:true -16 panic_on_wal_error:false -17 log_level:5 -18 wal_dir:. -19 slab_alloc_minimal:64 -20 too_long_threshold:0.01 -21 slab_alloc_arena:0.1 -22 wal_dir_rescan_delay:0.1 +12 slab_alloc_minimal:64 +13 sophia_dir:. +14 wal_mode:write +15 wal_dir:. +16 panic_on_snap_error:true +17 panic_on_wal_error:false +18 log_level:5 +19 readahead:16320 +20 slab_alloc_maximal:1048576 +21 too_long_threshold:0.01 +22 snapshot_period:0 +23 wal_dir_rescan_delay:0.1 ------------------------------------------------------ Check that too_long_threshold = 0.01 0.01 diff --git a/test/app/init_script.result b/test/app/init_script.result index f99fbf708bf8d5d58f46ffd56aedc56616ab9362..d9fe981cd130f6e24888c94ef74990821f66c5f1 100644 --- a/test/app/init_script.result +++ b/test/app/init_script.result @@ -6,25 +6,26 @@ box.cfg 1 snapshot_count:6 2 pid_file:box.pid 3 slab_alloc_factor:2 -4 slab_alloc_minimal:64 +4 slab_alloc_maximal:1048576 5 background:false 6 logger:tarantool.log -7 readahead:16320 +7 slab_alloc_arena:0.1 8 listen:3314 9 logger_nonblock:true 10 snap_dir:. 11 coredump:false -12 sophia_dir:. -13 wal_mode:write -14 slab_alloc_arena:0.1 -15 panic_on_snap_error:true -16 panic_on_wal_error:false -17 log_level:5 -18 rows_per_wal:500000 -19 wal_dir:. -20 too_long_threshold:0.5 -21 snapshot_period:0 -22 wal_dir_rescan_delay:0.1 +12 slab_alloc_minimal:64 +13 sophia_dir:. +14 wal_mode:write +15 rows_per_wal:500000 +16 panic_on_snap_error:true +17 panic_on_wal_error:false +18 wal_dir:. +19 log_level:5 +20 readahead:16320 +21 too_long_threshold:0.5 +22 snapshot_period:0 +23 wal_dir_rescan_delay:0.1 -- -- Test insert from detached fiber -- diff --git a/test/box/admin.result b/test/box/admin.result index bd872e6e6e14e7b07c7d3ed1bd11abd945666621..17c77b4cb34d78c68e472687d9a6b78a6ca71650 100644 --- a/test/box/admin.result +++ b/test/box/admin.result @@ -21,9 +21,9 @@ box.cfg - snapshot_count: 6 too_long_threshold: 0.5 slab_alloc_factor: 2 - slab_alloc_minimal: 64 + slab_alloc_maximal: 1048576 background: false - readahead: 16320 + slab_alloc_arena: 0.1 sophia: page_size: 131072 threads: 5 @@ -33,16 +33,17 @@ box.cfg logger_nonblock: true snap_dir: . coredump: false + slab_alloc_minimal: 64 sophia_dir: . wal_mode: write - snapshot_period: 0 + wal_dir: . panic_on_snap_error: true panic_on_wal_error: false log_level: 5 - wal_dir: . + readahead: 16320 pid_file: tarantool.pid rows_per_wal: 50 - slab_alloc_arena: 0.1 + snapshot_period: 0 wal_dir_rescan_delay: 0.1 ... space:insert{1, 'tuple'} diff --git a/test/box/cfg.result b/test/box/cfg.result index fa118a555eecadfae23eed7f733d351efa719017..782d4860c7c81fcd7a1b070da8772205fc15b014 100644 --- a/test/box/cfg.result +++ b/test/box/cfg.result @@ -2,7 +2,7 @@ --# push filter 'admin: .*' to 'admin: <uri>' box.cfg.nosuchoption = 1 --- -- error: '[string "-- load_cfg.lua - internal file..."]:243: Attempt to modify a read-only +- error: '[string "-- load_cfg.lua - internal file..."]:245: Attempt to modify a read-only table' ... t = {} for k,v in pairs(box.cfg) do if type(v) ~= 'table' and type(v) ~= 'function' then table.insert(t, k..': '..tostring(v)) end end @@ -13,23 +13,24 @@ t - - 'snapshot_count: 6' - 'too_long_threshold: 0.5' - 'slab_alloc_factor: 2' - - 'slab_alloc_minimal: 64' + - 'slab_alloc_maximal: 1048576' - 'background: false' - - 'readahead: 16320' + - 'slab_alloc_arena: 0.1' - 'primary: <uri> - 'logger_nonblock: true' - 'snap_dir: .' - 'coredump: false' + - 'slab_alloc_minimal: 64' - 'sophia_dir: .' - 'wal_mode: write' - - 'snapshot_period: 0' + - 'wal_dir: .' - 'panic_on_snap_error: true' - 'panic_on_wal_error: false' - 'log_level: 5' - - 'wal_dir: .' + - 'readahead: 16320' - 'pid_file: tarantool.pid' - 'rows_per_wal: 50' - - 'slab_alloc_arena: 0.1' + - 'snapshot_period: 0' - 'wal_dir_rescan_delay: 0.1' ... -- must be read-only @@ -44,45 +45,46 @@ t - - 'snapshot_count: 6' - 'too_long_threshold: 0.5' - 'slab_alloc_factor: 2' - - 'slab_alloc_minimal: 64' + - 'slab_alloc_maximal: 1048576' - 'background: false' - - 'readahead: 16320' + - 'slab_alloc_arena: 0.1' - 'primary: <uri> - 'logger_nonblock: true' - 'snap_dir: .' - 'coredump: false' + - 'slab_alloc_minimal: 64' - 'sophia_dir: .' - 'wal_mode: write' - - 'snapshot_period: 0' + - 'wal_dir: .' - 'panic_on_snap_error: true' - 'panic_on_wal_error: false' - 'log_level: 5' - - 'wal_dir: .' + - 'readahead: 16320' - 'pid_file: tarantool.pid' - 'rows_per_wal: 50' - - 'slab_alloc_arena: 0.1' + - 'snapshot_period: 0' - 'wal_dir_rescan_delay: 0.1' ... -- check that cfg with unexpected parameter fails. box.cfg{sherlock = 'holmes'} --- -- error: '[string "-- load_cfg.lua - internal file..."]:147: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:149: Error: cfg parameter ''sherlock'' is unexpected' ... -- check that cfg with unexpected type of parameter failes box.cfg{listen = {}} --- -- error: '[string "-- load_cfg.lua - internal file..."]:167: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:169: Error: cfg parameter ''listen'' should be one of types: string, number' ... box.cfg{wal_dir = 0} --- -- error: '[string "-- load_cfg.lua - internal file..."]:161: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:163: Error: cfg parameter ''wal_dir'' should be of type string' ... box.cfg{coredump = 'true'} --- -- error: '[string "-- load_cfg.lua - internal file..."]:161: Error: cfg parameter +- error: '[string "-- load_cfg.lua - internal file..."]:163: Error: cfg parameter ''coredump'' should be of type boolean' ... --# clear filter diff --git a/test/unit/mempool.c b/test/unit/mempool.c index 44fe1b128a3dfba963e686864708d44ed938026d..f37b691d39ae4f4ed39bd0baced75c3303ed6bfc 100644 --- a/test/unit/mempool.c +++ b/test/unit/mempool.c @@ -126,7 +126,7 @@ int main() slab_arena_create(&arena, "a, 0, 4000000, MAP_PRIVATE); - slab_cache_create(&cache, &arena, 0); + slab_cache_create(&cache, &arena); mempool_basic(); diff --git a/test/unit/region.c b/test/unit/region.c index b1fbd342387bfc1dee65bf72cadaa98efd38fddf..df4da9dcab81ecc3da8cb2341c92f9f055b20055 100644 --- a/test/unit/region.c +++ b/test/unit/region.c @@ -80,7 +80,7 @@ int main() quota_init("a, UINT_MAX); slab_arena_create(&arena, "a, 0, 4000000, MAP_PRIVATE); - slab_cache_create(&cache, &arena, 0); + slab_cache_create(&cache, &arena); region_basic(); region_test_truncate(); diff --git a/test/unit/slab_cache.c b/test/unit/slab_cache.c index 81839a0ff621d4d252b9ac60193c5a14beae3de5..a52c09ff9dd69aa0346909c218973dfb5e339cf7 100644 --- a/test/unit/slab_cache.c +++ b/test/unit/slab_cache.c @@ -21,7 +21,7 @@ int main() quota_init("a, UINT_MAX); slab_arena_create(&arena, "a, 0, 4000000, MAP_PRIVATE); - slab_cache_create(&cache, &arena, 0); + slab_cache_create(&cache, &arena); int i = 0; diff --git a/test/unit/small_alloc.c b/test/unit/small_alloc.c index 96126ac3ad2ed401ebe7bd798c449ee5a9f8e50b..9761da701faf93cd13ca719deb8b13b18146d093 100644 --- a/test/unit/small_alloc.c +++ b/test/unit/small_alloc.c @@ -32,7 +32,7 @@ free_checked(int *ptr) int pos = ptr[0]; fail_unless(ptrs[pos] == ptr); ptrs[pos][0] = ptrs[pos][ptr[1]/sizeof(int)-1] = INT_MAX; - smfree(&alloc, ptrs[pos]); + smfree(&alloc, ptrs[pos], ptrs[pos][1]); ptrs[pos] = NULL; } @@ -98,7 +98,7 @@ int main() slab_arena_create(&arena, "a, 0, 4000000, MAP_PRIVATE); - slab_cache_create(&cache, &arena, 0); + slab_cache_create(&cache, &arena); small_alloc_basic(); diff --git a/test/wal/oom.result b/test/wal/oom.result index 7487cd4252efadeca13d0263545e7c3de65ad122..7bb5031baf05f07606cd87add8219c73d14b1126 100644 --- a/test/wal/oom.result +++ b/test/wal/oom.result @@ -15,11 +15,11 @@ while true do i = i + 1 end; --- -- error: Failed to allocate 244 bytes in slab allocator for tuple +- error: Failed to allocate 22491 bytes in slab allocator for tuple ... space:len(); --- -- 56 +- 5617 ... i = 1; --- @@ -29,11 +29,11 @@ while true do i = i + 1 end; --- -- error: Failed to allocate 244 bytes in slab allocator for tuple +- error: Failed to allocate 4203 bytes in slab allocator for tuple ... space:len(); --- -- 112 +- 6662 ... i = 1; --- @@ -43,12 +43,12 @@ while true do i = i + 1 end; --- -- error: Failed to allocate 241 bytes in slab allocator for tuple +- error: Failed to allocate 1043 bytes in slab allocator for tuple ... --# setopt delimiter '' space:len() --- -- 167 +- 6917 ... space.index['primary']:get{0} ---