mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 17:34:14 +08:00
mdbx: clarify ov-pages copying in cursor_put().
Change-Id: I48ae57579a7d68178ec1857785ffdd6f0c0f7e13
This commit is contained in:
parent
1ef0106b51
commit
09d7904317
13
mdb.c
13
mdb.c
@ -6885,7 +6885,6 @@ current:
|
|||||||
*/
|
*/
|
||||||
if (unlikely(level > 1)) {
|
if (unlikely(level > 1)) {
|
||||||
/* It is writable only in a parent txn */
|
/* It is writable only in a parent txn */
|
||||||
size_t sz = (size_t) env->me_psize * ovpages, off;
|
|
||||||
MDB_page *np = mdb_page_malloc(mc->mc_txn, ovpages);
|
MDB_page *np = mdb_page_malloc(mc->mc_txn, ovpages);
|
||||||
MDB_ID2 id2;
|
MDB_ID2 id2;
|
||||||
if (unlikely(!np))
|
if (unlikely(!np))
|
||||||
@ -6899,8 +6898,13 @@ current:
|
|||||||
* parent txn, in case the user peeks at MDB_RESERVEd
|
* parent txn, in case the user peeks at MDB_RESERVEd
|
||||||
* or unused parts. Some users treat ovpages specially.
|
* or unused parts. Some users treat ovpages specially.
|
||||||
*/
|
*/
|
||||||
if (1 || /* LY: Hm, why we should do this differently in dependence from MDB_RESERVE? */
|
#if MDBX_MODE_ENABLED
|
||||||
!(flags & MDB_RESERVE)) {
|
/* LY: New page will contain only header from origin,
|
||||||
|
* but no any payload */
|
||||||
|
memcpy(np, omp, PAGEHDRSZ);
|
||||||
|
#else
|
||||||
|
size_t sz = (size_t) env->me_psize * ovpages, off;
|
||||||
|
if (!(flags & MDB_RESERVE)) {
|
||||||
/* Skip the part where LMDB will put *data.
|
/* Skip the part where LMDB will put *data.
|
||||||
* Copy end of page, adjusting alignment so
|
* Copy end of page, adjusting alignment so
|
||||||
* compiler may copy words instead of bytes.
|
* compiler may copy words instead of bytes.
|
||||||
@ -6910,7 +6914,8 @@ current:
|
|||||||
(size_t *)((char *)omp + off), sz - off);
|
(size_t *)((char *)omp + off), sz - off);
|
||||||
sz = PAGEHDRSZ;
|
sz = PAGEHDRSZ;
|
||||||
}
|
}
|
||||||
memcpy(np, omp, sz); /* Copy whole or beginning of page */
|
memcpy(np, omp, sz); /* Copy whole or header of page */
|
||||||
|
#endif /* MDBX_MODE_ENABLED */
|
||||||
omp = np;
|
omp = np;
|
||||||
}
|
}
|
||||||
SETDSZ(leaf, data->mv_size);
|
SETDSZ(leaf, data->mv_size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user