I encountered a problem trying to change the mapsize of an existing store.
It turned out to be that the newsize argument to mdb_env_map wasn't set correctly when coming from mdb_env_open2.
So I had to change the call to be: rc = mdb_env_map(env, meta.mm_address, newenv || env->me_mapsize != meta.mm_mapsize);
(adding the || != test)
Also I had some issues with large files (4GB) and I made some small changes which better match documentation and reported issues, but not sure if the original code was flawed or not. It is in mdb_env_map when we set the file pointer and EOF:
if (newsize) { if ((SetFilePointer(env->me_fd, sizelo, &sizehi, 0) == INVALID_SET_FILE_POINTER && GetLastError() != ERROR_SUCCESS) || !SetEndOfFile(env->me_fd) || (SetFilePointer(env->me_fd, 0, NULL, 0) == INVALID_SET_FILE_POINTER && GetLastError() != ERROR_SUCCESS)) return ErrCode(); }
Again, I made those changes according to what I noticed and this might not be the perfect final solution.
Cheers, Alain
Alain wrote:
I encountered a problem trying to change the mapsize of an existing store.
It turned out to be that the newsize argument to mdb_env_map wasn't set correctly when coming from mdb_env_open2.
So I had to change the call to be: rc = mdb_env_map(env, meta.mm_address, newenv || env->me_mapsize != meta.mm_mapsize);
Please use diff -u when discussing changes. Or git diff. And tell what revision you're diffing against.
(adding the || != test)
Also I had some issues with large files (4GB) and I made some small changes which better match documentation and reported issues, but not sure if the original code was flawed or not. It is in mdb_env_map when we set the file pointer and EOF:
if (newsize) { if ((SetFilePointer(env->me_fd, sizelo, &sizehi, 0) ==
INVALID_SET_FILE_POINTER && GetLastError() != ERROR_SUCCESS) || !SetEndOfFile(env->me_fd) || (SetFilePointer(env->me_fd, 0, NULL, 0) == INVALID_SET_FILE_POINTER && GetLastError() != ERROR_SUCCESS)) return ErrCode(); }
Again, I made those changes according to what I noticed and this might not be the perfect final solution.
Cheers, Alain
Howard,
Here is the current diff file with all the changes discussed.
I am using version f39bcebhttps://gitorious.org/mdb/mdb/commit/f39bceb800dd1b1b4b05cfb45a3ddde94a273ffffrom November 12.
Alain
On Thu, Dec 5, 2013 at 1:28 PM, Howard Chu hyc@symas.com wrote:
Alain wrote:
I encountered a problem trying to change the mapsize of an existing store.
It turned out to be that the newsize argument to mdb_env_map wasn't set correctly when coming from mdb_env_open2.
So I had to change the call to be: rc = mdb_env_map(env, meta.mm_address, newenv || env->me_mapsize != meta.mm_mapsize);
Please use diff -u when discussing changes. Or git diff. And tell what revision you're diffing against.
(adding the || != test)
Also I had some issues with large files (4GB) and I made some small changes which better match documentation and reported issues, but not sure if the original code was flawed or not. It is in mdb_env_map when we set the file pointer and EOF:
if (newsize) { if ((SetFilePointer(env->me_fd, sizelo, &sizehi, 0) ==
INVALID_SET_FILE_POINTER && GetLastError() != ERROR_SUCCESS) || !SetEndOfFile(env->me_fd) || (SetFilePointer(env->me_fd, 0, NULL, 0) == INVALID_SET_FILE_POINTER && GetLastError() != ERROR_SUCCESS)) return ErrCode(); }
Again, I made those changes according to what I noticed and this might not be the perfect final solution.
Cheers, Alain
-- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/
openldap-technical@openldap.org