[patches] [PATCH 2/2] vinyl: implement space.bsize, index.bsize, and index.len

Konstantin Osipov kostja at tarantool.org
Sat Feb 10 21:35:06 MSK 2018


* Vladimir Davydov <vdavydov.dev at gmail.com> [18/02/04 21:12]:

I checked the docs and found a different way to explain what
looked wrong.

>  static size_t
>  vinyl_space_bsize(struct space *space)
>  {
> -	(void)space;
> -	return 0;
> +	struct index *pk_base = space_index(space, 0);
> +	if (pk_base == NULL)
> +		return 0;
> +	struct vy_index *pk = vy_index(pk_base);
> +	return pk->stat.memory.count.bytes + pk->stat.disk.count.bytes;
> +}
> +
> +static ssize_t
> +vinyl_index_size(struct index *base)
> +{
> +	struct vy_index *index = vy_index(base);
> +	return index->stat.memory.count.rows + index->stat.disk.count.rows;
>  }

As far as I can see, in your implementation, primary key bsize is
the same as space bsize(). According to the docs, bsize() of the
space is binary footprint of data, bsize of index is how much
space an index itself takes, not accounting the data.

The total sum of space bsize() and index bsize() for all defined
indexes provides you an estimate of how much memory is used by a
space - be it in RAM or on disk.

Please let's stick to this both in memtx and in vinyl.


-- 
Konstantin Osipov, Moscow, Russia, +7 903 626 22 32
http://tarantool.org - www.twitter.com/kostja_osipov



More information about the Tarantool-patches mailing list