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

revert to original, fixed 20 percent for internal databasses #102

Merged
merged 1 commit into from
Oct 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions util/flexcache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,24 @@ FlexCache::GetDBCacheCapacity(
bool IsInternal) //!< value describing cache attributes of caller
{
uint64_t ret_val, shared_total;
size_t user_count, internal_count, count;
size_t count, internal_count;

// get count of database by type
user_count=DBList()->GetDBCount(false);
internal_count=DBList()->GetDBCount(true);
count=DBList()->GetDBCount(IsInternal);
if (IsInternal)
internal_count=count;
else
internal_count=DBList()->GetDBCount(true);

// what is total memory assigned to a type
if (IsInternal && 0!=user_count)
if (IsInternal)
shared_total=(m_TotalMemory*2)/10; // integer *.2
else if (!IsInternal && 0!=internal_count)
else if (0!=internal_count)
shared_total=(m_TotalMemory*8)/10;
else // no databases in "other" category
else // no internal database
shared_total=m_TotalMemory;

// split up type specific aggregate to "per database" value
count = (IsInternal ? internal_count : user_count);
if (0!=count)
ret_val=shared_total / count;
else
Expand Down
4 changes: 2 additions & 2 deletions util/flexcache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ TEST(FlexCacheTest, MixedSizing) {
ASSERT_EQ(0, DBList()->GetDBCount(false));
ASSERT_EQ(1, DBList()->GetDBCount(true));
db[1]->GetProperty("leveldb.block-cache", &value);
ASSERT_EQ(552*1024*1024L, atoi(value.c_str()));
ASSERT_EQ(72*1024*1024L, atoi(value.c_str()));

db[1]->GetProperty("leveldb.file-cache", &value);
ASSERT_EQ(550*1024*1024L, atoi(value.c_str()));
ASSERT_EQ(70*1024*1024L, atoi(value.c_str()));

delete db[1];

Expand Down