mirror of
https://github.com/isar/libmdbx.git
synced 2025-08-23 09:04:26 +08:00
mdbx: basic cleanup from dead github and another corrupted services.
This commit is contained in:
20
src/core.c
20
src/core.c
@@ -5058,7 +5058,7 @@ static int mdbx_iov_write(MDBX_txn *const txn, struct mdbx_iov_ctx *ctx) {
|
||||
MDBX_page *wp = (MDBX_page *)ctx->iov[i].iov_base;
|
||||
const MDBX_page *rp = pgno2page(txn->mt_env, wp->mp_pgno);
|
||||
/* check with timeout as the workaround
|
||||
* for https://github.com/erthink/libmdbx/issues/269 */
|
||||
* for https://erased_by_github.none/libmdbx/issues/269 */
|
||||
while (likely(rc == MDBX_SUCCESS) &&
|
||||
unlikely(memcmp(wp, rp, ctx->iov[i].iov_len) != 0)) {
|
||||
if (!timestamp) {
|
||||
@@ -6400,7 +6400,7 @@ __hot static struct page_result mdbx_page_alloc(MDBX_cursor *mc,
|
||||
catch-up with itself by growing while trying to save it. */
|
||||
(mc->mc_flags & C_RECLAIMING) ||
|
||||
/* avoid (recursive) search inside empty tree and while tree is
|
||||
updating, https://github.com/erthink/libmdbx/issues/31 */
|
||||
updating, https://erased_by_github.none/libmdbx/issues/31 */
|
||||
txn->mt_dbs[FREE_DBI].md_entries == 0 ||
|
||||
/* If our dirty list is already full, we can't touch GC */
|
||||
(txn->tw.dirtyroom < txn->mt_dbs[FREE_DBI].md_depth &&
|
||||
@@ -6613,7 +6613,7 @@ no_loose:
|
||||
MDBX_PGL_LIMIT)) {
|
||||
/* Stop reclaiming to avoid overflow the page list.
|
||||
* This is a rare case while search for a continuously multi-page region
|
||||
* in a large database. https://github.com/erthink/libmdbx/issues/123 */
|
||||
* in a large database. https://erased_by_github.none/libmdbx/issues/123 */
|
||||
mdbx_notice("stop reclaiming to avoid PNL overflow: %u (current) + %u "
|
||||
"(chunk) -> %u",
|
||||
MDBX_PNL_SIZE(txn->tw.reclaimed_pglist), gc_len,
|
||||
@@ -7586,7 +7586,7 @@ __cold int mdbx_thread_unregister(const MDBX_env *env) {
|
||||
return MDBX_SUCCESS;
|
||||
}
|
||||
|
||||
/* check against https://github.com/erthink/libmdbx/issues/269 */
|
||||
/* check against https://erased_by_github.none/libmdbx/issues/269 */
|
||||
static bool meta_checktxnid(const MDBX_env *env, const MDBX_meta *meta,
|
||||
bool report) {
|
||||
const txnid_t meta_txnid = constmeta_txnid(env, meta);
|
||||
@@ -7662,7 +7662,7 @@ static bool meta_checktxnid(const MDBX_env *env, const MDBX_meta *meta,
|
||||
}
|
||||
|
||||
/* check with timeout as the workaround
|
||||
* for https://github.com/erthink/libmdbx/issues/269 */
|
||||
* for https://erased_by_github.none/libmdbx/issues/269 */
|
||||
static int meta_waittxnid(const MDBX_env *env, const MDBX_meta *meta,
|
||||
uint64_t *timestamp) {
|
||||
if (likely(meta_checktxnid(env, (const MDBX_meta *)meta, !*timestamp)))
|
||||
@@ -7807,7 +7807,7 @@ static int mdbx_txn_renew0(MDBX_txn *txn, const unsigned flags) {
|
||||
snap == meta_txnid(env, meta) &&
|
||||
snap >= atomic_load64(&env->me_lck->mti_oldest_reader,
|
||||
mo_AcquireRelease))) {
|
||||
/* workaround for https://github.com/erthink/libmdbx/issues/269 */
|
||||
/* workaround for https://erased_by_github.none/libmdbx/issues/269 */
|
||||
rc = meta_waittxnid(env, (const MDBX_meta *)meta, ×tamp);
|
||||
mdbx_jitter4testing(false);
|
||||
if (likely(rc == MDBX_SUCCESS))
|
||||
@@ -7895,7 +7895,7 @@ static int mdbx_txn_renew0(MDBX_txn *txn, const unsigned flags) {
|
||||
mdbx_jitter4testing(false);
|
||||
const MDBX_meta *meta = constmeta_prefer_last(env);
|
||||
uint64_t timestamp = 0;
|
||||
while ("workaround for https://github.com/erthink/libmdbx/issues/269") {
|
||||
while ("workaround for https://erased_by_github.none/libmdbx/issues/269") {
|
||||
rc = meta_waittxnid(env, (const MDBX_meta *)meta, ×tamp);
|
||||
if (likely(rc == MDBX_SUCCESS))
|
||||
break;
|
||||
@@ -11722,7 +11722,7 @@ mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower, intptr_t size_now,
|
||||
const MDBX_meta *head = constmeta_prefer_last(env);
|
||||
|
||||
uint64_t timestamp = 0;
|
||||
while ("workaround for https://github.com/erthink/libmdbx/issues/269") {
|
||||
while ("workaround for https://erased_by_github.none/libmdbx/issues/269") {
|
||||
meta = *head;
|
||||
rc = meta_waittxnid(env, &meta, ×tamp);
|
||||
if (likely(rc == MDBX_SUCCESS))
|
||||
@@ -12985,7 +12985,7 @@ __cold int mdbx_env_open(MDBX_env *env, const char *pathname,
|
||||
} else {
|
||||
#if MDBX_MMAP_INCOHERENT_FILE_WRITE
|
||||
/* Temporary `workaround` for OpenBSD kernel's flaw.
|
||||
* See https://github.com/erthink/libmdbx/issues/67 */
|
||||
* See https://erased_by_github.none/libmdbx/issues/67 */
|
||||
if ((flags & MDBX_WRITEMAP) == 0) {
|
||||
if (flags & MDBX_ACCEDE)
|
||||
flags |= MDBX_WRITEMAP;
|
||||
@@ -19944,7 +19944,7 @@ __cold static int fetch_envinfo_ex(const MDBX_env *env, const MDBX_txn *txn,
|
||||
const size_t size_before_bootid = offsetof(MDBX_envinfo, mi_bootid);
|
||||
const size_t size_before_pgop_stat = offsetof(MDBX_envinfo, mi_pgop_stat);
|
||||
|
||||
/* is the environment open? (https://github.com/erthink/libmdbx/issues/171) */
|
||||
/* is the environment open? (https://erased_by_github.none/libmdbx/issues/171) */
|
||||
if (unlikely(!env->me_map)) {
|
||||
/* environment not yet opened */
|
||||
#if 1
|
||||
|
@@ -96,4 +96,4 @@ if no quiet mode was requested.
|
||||
.BR mdbx_load (1)
|
||||
.BR mdbx_drop (1)
|
||||
.SH AUTHOR
|
||||
Leonid Yuriev <https://github.com/erthink>
|
||||
Leonid Yuriev <https://gitflic.ru/user/erthink>
|
||||
|
@@ -65,4 +65,4 @@ free during copying cannot be reused until the copy is done.
|
||||
.BR mdbx_drop (1)
|
||||
.SH AUTHOR
|
||||
Howard Chu of Symas Corporation <http://www.symas.com>,
|
||||
Leonid Yuriev <https://github.com/erthink>
|
||||
Leonid Yuriev <https://gitflic.ru/user/erthink>
|
||||
|
@@ -91,4 +91,4 @@ utility to load the database using the correct comparison functions.
|
||||
.BR mdbx_drop (1)
|
||||
.SH AUTHOR
|
||||
Howard Chu of Symas Corporation <http://www.symas.com>,
|
||||
Leonid Yuriev <https://github.com/erthink>
|
||||
Leonid Yuriev <https://gitflic.ru/user/erthink>
|
||||
|
@@ -102,4 +102,4 @@ a diagnostic message being written to standard error.
|
||||
.BR mdbx_drop (1)
|
||||
.SH AUTHOR
|
||||
Howard Chu of Symas Corporation <http://www.symas.com>,
|
||||
Leonid Yuriev <https://github.com/erthink>
|
||||
Leonid Yuriev <https://gitflic.ru/user/erthink>
|
||||
|
@@ -83,4 +83,4 @@ a diagnostic message being written to standard error.
|
||||
.BR mdbx_drop (1)
|
||||
.SH AUTHOR
|
||||
Howard Chu of Symas Corporation <http://www.symas.com>,
|
||||
Leonid Yuriev <https://github.com/erthink>
|
||||
Leonid Yuriev <https://gitflic.ru/user/erthink>
|
||||
|
@@ -1157,7 +1157,7 @@ int main(int argc, char *argv[]) {
|
||||
envflags &= ~MDBX_RDONLY;
|
||||
#if MDBX_MMAP_INCOHERENT_FILE_WRITE
|
||||
/* Temporary `workaround` for OpenBSD kernel's flaw.
|
||||
* See https://github.com/erthink/libmdbx/issues/67 */
|
||||
* See https://erased_by_github.none/libmdbx/issues/67 */
|
||||
envflags |= MDBX_WRITEMAP;
|
||||
#endif /* MDBX_MMAP_INCOHERENT_FILE_WRITE */
|
||||
break;
|
||||
|
12
src/osal.c
12
src/osal.c
@@ -678,7 +678,7 @@ MDBX_INTERNAL_FUNC int mdbx_openfile(const enum mdbx_openfile_purpose purpose,
|
||||
flags |= O_CLOEXEC;
|
||||
#endif /* O_CLOEXEC */
|
||||
|
||||
/* Safeguard for https://github.com/erthink/libmdbx/issues/144 */
|
||||
/* Safeguard for https://erased_by_github.none/libmdbx/issues/144 */
|
||||
#if STDIN_FILENO == 0 && STDOUT_FILENO == 1 && STDERR_FILENO == 2
|
||||
int stub_fd0 = -1, stub_fd1 = -1, stub_fd2 = -1;
|
||||
static const char dev_null[] = "/dev/null";
|
||||
@@ -710,7 +710,7 @@ MDBX_INTERNAL_FUNC int mdbx_openfile(const enum mdbx_openfile_purpose purpose,
|
||||
}
|
||||
#endif /* O_DIRECT */
|
||||
|
||||
/* Safeguard for https://github.com/erthink/libmdbx/issues/144 */
|
||||
/* Safeguard for https://erased_by_github.none/libmdbx/issues/144 */
|
||||
#if STDIN_FILENO == 0 && STDOUT_FILENO == 1 && STDERR_FILENO == 2
|
||||
if (*fd == STDIN_FILENO) {
|
||||
mdbx_warning("Got STD%s_FILENO/%d, avoid using it by dup(fd)", "IN",
|
||||
@@ -1547,7 +1547,7 @@ MDBX_INTERNAL_FUNC int mdbx_munmap(mdbx_mmap_t *map) {
|
||||
VALGRIND_MAKE_MEM_NOACCESS(map->address, map->current);
|
||||
/* Unpoisoning is required for ASAN to avoid false-positive diagnostic
|
||||
* when this memory will re-used by malloc or another mmapping.
|
||||
* See https://github.com/erthink/libmdbx/pull/93#issuecomment-613687203 */
|
||||
* See https://erased_by_github.none/libmdbx/pull/93#issuecomment-613687203 */
|
||||
MDBX_ASAN_UNPOISON_MEMORY_REGION(map->address,
|
||||
(map->filesize && map->filesize < map->limit)
|
||||
? map->filesize
|
||||
@@ -1623,7 +1623,7 @@ MDBX_INTERNAL_FUNC int mdbx_mresize(const int flags, mdbx_mmap_t *map,
|
||||
|
||||
/* Unpoisoning is required for ASAN to avoid false-positive diagnostic
|
||||
* when this memory will re-used by malloc or another mmapping.
|
||||
* See https://github.com/erthink/libmdbx/pull/93#issuecomment-613687203 */
|
||||
* See https://erased_by_github.none/libmdbx/pull/93#issuecomment-613687203 */
|
||||
MDBX_ASAN_UNPOISON_MEMORY_REGION(map->address, map->limit);
|
||||
status = NtUnmapViewOfSection(GetCurrentProcess(), map->address);
|
||||
if (!NT_SUCCESS(status))
|
||||
@@ -1888,7 +1888,7 @@ retry_mapview:;
|
||||
VALGRIND_MAKE_MEM_NOACCESS(map->address, map->current);
|
||||
/* Unpoisoning is required for ASAN to avoid false-positive diagnostic
|
||||
* when this memory will re-used by malloc or another mmapping.
|
||||
* See https://github.com/erthink/libmdbx/pull/93#issuecomment-613687203
|
||||
* See https://erased_by_github.none/libmdbx/pull/93#issuecomment-613687203
|
||||
*/
|
||||
MDBX_ASAN_UNPOISON_MEMORY_REGION(
|
||||
map->address,
|
||||
@@ -1908,7 +1908,7 @@ retry_mapview:;
|
||||
VALGRIND_MAKE_MEM_NOACCESS(map->address, map->current);
|
||||
/* Unpoisoning is required for ASAN to avoid false-positive diagnostic
|
||||
* when this memory will re-used by malloc or another mmapping.
|
||||
* See https://github.com/erthink/libmdbx/pull/93#issuecomment-613687203 */
|
||||
* See https://erased_by_github.none/libmdbx/pull/93#issuecomment-613687203 */
|
||||
MDBX_ASAN_UNPOISON_MEMORY_REGION(
|
||||
map->address, (map->current < map->limit) ? map->current : map->limit);
|
||||
|
||||
|
Reference in New Issue
Block a user