#574 problems with dbcachesize disk space calculation
Closed: wontfix Opened by rmeggins.

This is in dblayer_start and no_diskspace
1) no_diskspace() - does not take into consideration that some of the available disk space is taken up by region/cache files already that will be reused, so that should not count against available disk space
2) checks for disk space in the db directory, not the db home directory
3) should not check for disk space if using RAM or shared mem (or should check for memory instead of disk space)
4) no_diskspace() should cast all values to unsigned long long (PRUint64)
5) no_diskspace() should use statvfs() instead of statfs()
6) error message is faulty:

  • should print name of directory
  • using %lu to print values of type double (should not be double - see 4)

Your fix looks good. I'm putting my "ack". Please do me one favour. Could you check if li->li_dblayer_private->dblayer_dbhome_directory is not NULL, as well?
1415 if(strcmp(li->li_dblayer_private->dblayer_dbhome_directory,"") &&
1416 strcmp(li->li_directory, li->li_dblayer_private->dblayer_dbhome_directory))

Replying to [comment:5 nhosoi]:

Your fix looks good. I'm putting my "ack". Please do me one favour. Could you check if li->li_dblayer_private->dblayer_dbhome_directory is not NULL, as well?
1415 if(strcmp(li->li_dblayer_private->dblayer_dbhome_directory,"") &&
1416 strcmp(li->li_directory, li->li_dblayer_private->dblayer_dbhome_directory))

Thanks, and no problem I added the check. In my testing though, db_home_directory was never NULL, either set to something or set to "". Better to be safe than sorry.

This is a little bit misleading:
{{{
int using_shared_mem = (dbenv_flags & ( DB_PRIVATE | DB_SYSTEM_MEM));
}}}

What "using_shared_mem" really means is "using malloc or shmget". Perhaps it would be better to invert the condition:
{{{
int using_region_files = !(dbenv_flags & ( DB_PRIVATE | DB_SYSTEM_MEM));
}}}

{{{
PRUint64 expected_siz = li->li_dbcachesize * 1.5; / dbcache + region files /
}}}
This forces a temporary coercion to double - probably better to keep it entirely integer like this:
{{{
PRUint64 expected_siz = li->li_dbcachesize + li->li_dbcachesize/2; / dbcache + region files /
}}}

Also, why remove these?
{{{

include

include

}}}

Replying to [comment:7 rmeggins]:

This is a little bit misleading:
{{{
int using_shared_mem = (dbenv_flags & ( DB_PRIVATE | DB_SYSTEM_MEM));
}}}

What "using_shared_mem" really means is "using malloc or shmget". Perhaps it would be better to invert the condition:
{{{
int using_region_files = !(dbenv_flags & ( DB_PRIVATE | DB_SYSTEM_MEM));
}}}

Ok

{{{
PRUint64 expected_siz = li->li_dbcachesize * 1.5; / dbcache + region files /
}}}
This forces a temporary coercion to double - probably better to keep it entirely integer like this:
{{{
PRUint64 expected_siz = li->li_dbcachesize + li->li_dbcachesize/2; / dbcache + region files /
}}}

Sure

Also, why remove these?
{{{

include

include

}}}

I moved them to the top of the file(with the other header files).

Replying to [comment:8 mreynolds]:

Also, why remove these?
{{{

include

include

}}}

I moved them to the top of the file(with the other header files).

Sorry, I missed that. Ok.

From the original patch;

git merge ticket574
Updating febd0db..98b4232
Fast-forward
ldap/servers/slapd/back-ldbm/dblayer.c | 167 ++++++++++++++++++--------------
1 files changed, 94 insertions(+), 73 deletions(-)

git push origin master
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 2.20 KiB, done.
Total 7 (delta 5), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
febd0db..98b4232 master -> master

The amendment:

git merge ticket574
Updating fa7972a..9101026
Fast-forward
ldap/servers/slapd/back-ldbm/dblayer.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

git push origin master
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 818 bytes, done.
Total 7 (delta 5), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
fa7972a..9101026 master -> master

commit 7d26ba1f6edbf1b0959c37fb638bc757cba9dfa6
Author: Rich Megginson rmeggins@redhat.com
Date: Tue Apr 2 17:55:14 2013 -0600

I think the mpool and mutex env file is dependent on the configured dbcache size, the others will depend on the txn log buffer and the configured (default) number of lockers/lock objects - so maybe a better approximation would be possibble

Metadata Update from @mreynolds:
- Issue assigned to mreynolds
- Issue set to the milestone: 1.3.1

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/574

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

Metadata