[tarantool-patches] Re: [PATCH 09/13] memtx: enter small delayed free mode from snapshot iterator

Konstantin Osipov kostja at tarantool.org
Tue Aug 13 01:27:49 MSK 2019


* Vladimir Davydov <vdavydov.dev at gmail.com> [19/08/10 23:22]:
> We must enable SMALL_DELAYED_FREE_MODE to safely use a memtx snapshot
> iterator. Currently, we do that in checkpoint related callbacks, but if
> we want to reuse snapshot iterators for other purposes, e.g. feeding
> a read view to a newly joined replica, we better hide this code behind
> snapshot iterator constructors.

this is not enough, you may have multiple replicas joining, and
you need multiple checkpoint support  for that. 

Currently delayed free mode only supports one active checkpoint.

> +void
> +memtx_enter_delayed_free_mode(struct memtx_engine *memtx)
> +{
> +	memtx->snapshot_version++;
> +	if (memtx->delayed_free_mode++ == 0)
> +		small_alloc_setopt(&memtx->alloc, SMALL_DELAYED_FREE_MODE, true);
> +}

Just adding a counter will easily never free any memory if it
never drops below 1.

-- 
Konstantin Osipov, Moscow, Russia




More information about the Tarantool-patches mailing list