mdbx-windows: retry resize-mmap always with reservation (less chance to failure).

Change-Id: I472651f6906b88ba674868e0cd6c81318bfc255b
This commit is contained in:
Leonid Yuriev 2020-11-20 11:52:44 +03:00
parent 537e3d18ae
commit f76bf72021

View File

@ -1511,6 +1511,7 @@ MDBX_INTERNAL_FUNC int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t size,
return err; return err;
} }
retry_file_and_section:
/* resizing of the file may take a while, /* resizing of the file may take a while,
* therefore we reserve address space to avoid occupy it by other threads */ * therefore we reserve address space to avoid occupy it by other threads */
ReservedAddress = map->address; ReservedAddress = map->address;
@ -1526,7 +1527,6 @@ MDBX_INTERNAL_FUNC int mdbx_mresize(int flags, mdbx_mmap_t *map, size_t size,
map->address = NULL; map->address = NULL;
} }
retry_file_and_section:
err = mdbx_filesize(map->fd, &map->filesize); err = mdbx_filesize(map->fd, &map->filesize);
if (err != MDBX_SUCCESS) if (err != MDBX_SUCCESS)
goto bailout; goto bailout;
@ -1593,7 +1593,7 @@ retry_mapview:;
* but will return MDBX_UNABLE_EXTEND_MAPSIZE on success */ * but will return MDBX_UNABLE_EXTEND_MAPSIZE on success */
rc = MDBX_UNABLE_EXTEND_MAPSIZE; rc = MDBX_UNABLE_EXTEND_MAPSIZE;
size = map->current; size = map->current;
limit = map->limit; ReservedSize = limit = map->limit;
goto retry_file_and_section; goto retry_file_and_section;
} }