mirror of
https://github.com/monero-project/monero.git
synced 2024-12-13 20:06:32 +02:00
MDB_VL32 change overflow page scan
Just check the requested page, don't worry about any other pages
This commit is contained in:
parent
60b064c759
commit
f98fe467e9
41
external/db_drivers/liblmdb/mdb.c
vendored
41
external/db_drivers/liblmdb/mdb.c
vendored
@ -5829,7 +5829,7 @@ retry:
|
|||||||
if (rc)
|
if (rc)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (!el[x].mref) {
|
if (!el[x].mref) {
|
||||||
munmap(el[x].mptr, el[x].mcnt);
|
munmap(el[x].mptr, env->me_psize * el[x].mcnt);
|
||||||
el[x].mptr = id3.mptr;
|
el[x].mptr = id3.mptr;
|
||||||
el[x].mcnt = id3.mcnt;
|
el[x].mcnt = id3.mcnt;
|
||||||
} else {
|
} else {
|
||||||
@ -5881,36 +5881,15 @@ fail:
|
|||||||
pthread_mutex_unlock(&env->me_rpmutex);
|
pthread_mutex_unlock(&env->me_rpmutex);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
/* If this page is far enough from the end of the env, scan for
|
/* check for overflow size */
|
||||||
* any overflow pages that would spill onto another block.
|
p = (MDB_page *)((char *)id3.mptr + rem * env->me_psize);
|
||||||
* Note we must compare against mt_last_pgno, the last written
|
if (IS_OVERFLOW(p) && p->mp_pages + rem > id3.mcnt) {
|
||||||
* page in the environment. Not mt_next_pgno, which increases
|
id3.mcnt = p->mp_pages + rem;
|
||||||
* for every newly allocated (but not yet written) page. If
|
munmap(id3.mptr, len);
|
||||||
* we scanned beyond the last written page we'd get a bus error.
|
len = id3.mcnt * env->me_psize;
|
||||||
*/
|
MAP(rc, env, id3.mptr, len, off);
|
||||||
if (pgno + MDB_RPAGE_CHUNK <= txn->mt_last_pgno) {
|
if (rc)
|
||||||
int i;
|
goto fail;
|
||||||
char *cp = (char *)id3.mptr + rem * env->me_psize;
|
|
||||||
for (i=rem; i<MDB_RPAGE_CHUNK;) {
|
|
||||||
p = (MDB_page *)cp;
|
|
||||||
if (IS_OVERFLOW(p)) {
|
|
||||||
int nop = p->mp_pages;
|
|
||||||
if (nop + i > MDB_RPAGE_CHUNK) {
|
|
||||||
munmap(id3.mptr, len);
|
|
||||||
id3.mcnt = nop + i;
|
|
||||||
len = id3.mcnt * env->me_psize;
|
|
||||||
MAP(rc, env, id3.mptr, len, off);
|
|
||||||
if (rc)
|
|
||||||
goto fail;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
i += nop;
|
|
||||||
cp += nop * env->me_psize;
|
|
||||||
} else {
|
|
||||||
i++;
|
|
||||||
cp += env->me_psize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mdb_mid3l_insert(el, &id3);
|
mdb_mid3l_insert(el, &id3);
|
||||||
pthread_mutex_unlock(&env->me_rpmutex);
|
pthread_mutex_unlock(&env->me_rpmutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user