|
|
|
@ -1899,6 +1899,7 @@ mdb_dcmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b) |
|
|
|
|
|
|
|
|
|
/** Allocate memory for a page.
|
|
|
|
|
* Re-use old malloc'd pages first for singletons, otherwise just malloc. |
|
|
|
|
* Set #MDB_TXN_ERROR on failure. |
|
|
|
|
*/ |
|
|
|
|
static MDB_page * |
|
|
|
|
mdb_page_malloc(MDB_txn *txn, unsigned num) |
|
|
|
@ -2310,7 +2311,7 @@ mdb_page_dirty(MDB_txn *txn, MDB_page *mp) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** Allocate page numbers and memory for writing. Maintain me_pglast,
|
|
|
|
|
* me_pghead and mt_next_pgno. |
|
|
|
|
* me_pghead and mt_next_pgno. Set #MDB_TXN_ERROR on failure. |
|
|
|
|
* |
|
|
|
|
* If there are free pages available from older transactions, they |
|
|
|
|
* are re-used first. Otherwise allocate a new page at mt_next_pgno. |
|
|
|
@ -2442,7 +2443,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) |
|
|
|
|
np = m2.mc_pg[m2.mc_top]; |
|
|
|
|
leaf = NODEPTR(np, m2.mc_ki[m2.mc_top]); |
|
|
|
|
if ((rc = mdb_node_read(&m2, leaf, &data)) != MDB_SUCCESS) |
|
|
|
|
return rc; |
|
|
|
|
goto fail; |
|
|
|
|
|
|
|
|
|
idl = (MDB_ID *) data.mv_data; |
|
|
|
|
i = idl[0]; |
|
|
|
@ -2606,6 +2607,7 @@ mdb_page_unspill(MDB_txn *txn, MDB_page *mp, MDB_page **ret) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** Touch a page: make it dirty and re-insert into tree with updated pgno.
|
|
|
|
|
* Set #MDB_TXN_ERROR on failure. |
|
|
|
|
* @param[in] mc cursor pointing to the page to be touched |
|
|
|
|
* @return 0 on success, non-zero on failure. |
|
|
|
|
*/ |
|
|
|
@ -5788,7 +5790,9 @@ mdb_cursor_pop(MDB_cursor *mc) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** Push a page onto the top of the cursor's stack. */ |
|
|
|
|
/** Push a page onto the top of the cursor's stack.
|
|
|
|
|
* Set #MDB_TXN_ERROR on failure. |
|
|
|
|
*/ |
|
|
|
|
static int |
|
|
|
|
mdb_cursor_push(MDB_cursor *mc, MDB_page *mp) |
|
|
|
|
{ |
|
|
|
@ -6096,6 +6100,7 @@ ok: |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/** Find the address of the page corresponding to a given page number.
|
|
|
|
|
* Set #MDB_TXN_ERROR on failure. |
|
|
|
|
* @param[in] mc the cursor accessing the page. |
|
|
|
|
* @param[in] pgno the page number for the page to retrieve. |
|
|
|
|
* @param[out] ret address of a pointer where the page's address will be stored. |
|
|
|
@ -7884,6 +7889,7 @@ fail: |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** Allocate and initialize new pages for a database.
|
|
|
|
|
* Set #MDB_TXN_ERROR on failure. |
|
|
|
|
* @param[in] mc a cursor on the database being added to. |
|
|
|
|
* @param[in] flags flags defining what type of page is being allocated. |
|
|
|
|
* @param[in] num the number of pages to allocate. This is usually 1, |
|
|
|
@ -7969,6 +7975,7 @@ mdb_branch_size(MDB_env *env, MDB_val *key) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** Add a node to the page pointed to by the cursor.
|
|
|
|
|
* Set #MDB_TXN_ERROR on failure. |
|
|
|
|
* @param[in] mc The cursor for this operation. |
|
|
|
|
* @param[in] indx The index on the page where the new node should be added. |
|
|
|
|
* @param[in] key The key for the new node. |
|
|
|
@ -8460,6 +8467,7 @@ mdb_cursor_dbi(MDB_cursor *mc) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** Replace the key for a branch node with a new key.
|
|
|
|
|
* Set #MDB_TXN_ERROR on failure. |
|
|
|
|
* @param[in] mc Cursor pointing to the node to operate on. |
|
|
|
|
* @param[in] key The new key to use. |
|
|
|
|
* @return 0 on success, non-zero on failure. |
|
|
|
@ -9289,6 +9297,7 @@ mdb_del0(MDB_txn *txn, MDB_dbi dbi, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** Split a page and insert a new node.
|
|
|
|
|
* Set #MDB_TXN_ERROR on failure. |
|
|
|
|
* @param[in,out] mc Cursor pointing to the page and desired insertion index. |
|
|
|
|
* The cursor will be updated to point to the actual page and index where |
|
|
|
|
* the node got inserted after the split. |
|
|
|
|