Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache_metadata_size size varaible questions #152

Open
pahome opened this issue Sep 26, 2020 · 1 comment
Open

cache_metadata_size size varaible questions #152

pahome opened this issue Sep 26, 2020 · 1 comment

Comments

@pahome
Copy link

pahome commented Sep 26, 2020

I nearly read cache like tools and read the cache_metadata_size.cc with some questions.

uint64_t
cache_metadata_size_cmd::calc_size(uint64_t nr_blocks, uint32_t max_hint_width)
{
	uint64_t const SECTOR_SIZE = 512;
	uint64_t const TRANSACTION_OVERHEAD = meg(4);
	uint64_t const BYTES_PER_BLOCK = 16;
	uint64_t const HINT_OVERHEAD_PER_BLOCK = 8;

I want to ask how to estimate the BYTES_PER_BLOCK & HINT_OVERHEAD_PER_BLOCK ?

I thought BYTES_PER_BLOCK be 12 ? because the following struct in mapping_array.h

struct mapping {
		uint64_t oblock_;
		uint32_t flags_;
	};

And what's the HINT_OVERHEAD_PER_BLOCK meaning?

thanks.

@mingnus
Copy link
Collaborator

mingnus commented Oct 25, 2021

The equation in cache_metadata_size assumes the mappings and hints are stored in btrees rather than arrays: The BYTES_PER_BLOCK denotes the 16-byte key & value for each cache block, and the HINT_OVERHEAD_PER_BLOCK stands for the 8-byte key for each hint entry. It's an outdated design and will be revised someday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants