mdbx: add MDBX_DBG_NOFALLOC_INCORE.

It is a workaround to sporadic test failures due to lack of space in tmpfs and/or free memory.
This commit is contained in:
Леонид Юрьев (Leonid Yuriev)
2025-10-09 21:39:07 +03:00
parent ed2cb62f39
commit ee6a045f17
6 changed files with 24 additions and 7 deletions

View File

@@ -2087,7 +2087,7 @@ int osal_mmap(const int flags, osal_mmap_t *map, size_t size, const size_t limit
return err;
if ((flags & MDBX_RDONLY) == 0 && (options & MMAP_OPTION_SETLENGTH) != 0) {
err = osal_fallocate(map->fd, size);
err = ((options & MMAP_OPTION_NOFALLOC) ? osal_ftruncate : osal_fallocate)(map->fd, size);
VERBOSE("ftruncate %zu, err %d", size, err);
if (err != MDBX_SUCCESS)
return err;
@@ -2333,7 +2333,7 @@ retry_file_and_section:
}
if ((flags & MDBX_RDONLY) == 0 && map->filesize != size) {
err = osal_fallocate(map->fd, size);
err = ((flags & MDBX_MRESIZE_NO_FALLOC) ? osal_ftruncate : osal_fallocate)(map->fd, size);
if (err == MDBX_SUCCESS)
map->filesize = size;
/* ignore error, because Windows unable shrink file
@@ -2413,7 +2413,7 @@ retry_mapview:;
} else {
if (map->filesize != size) {
if (size > map->filesize) {
rc = osal_fallocate(map->fd, size);
rc = ((flags & MDBX_MRESIZE_NO_FALLOC) ? osal_ftruncate : osal_fallocate)(map->fd, size);
VERBOSE("f%s-%s %zu, err %d", "allocate", "extend", size, rc);
} else if (flags & txn_shrink_allowed) {
rc = osal_ftruncate(map->fd, size);