Commit 2c3b019e authored by Hallvard Furuseth's avatar Hallvard Furuseth
Browse files

Note functions which must set MDB_TXN_ERROR on failure

Other functions depend on them to do so.
For mdb_node_read(), instead remove such a dependence.
parent 8de0788b
......@@ -1747,6 +1747,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)
......@@ -2114,7 +2115,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.
......@@ -2237,7 +2238,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];
......@@ -2387,6 +2388,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.
*/
......@@ -5342,7 +5344,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)
{
......@@ -5362,6 +5366,7 @@ mdb_cursor_push(MDB_cursor *mc, MDB_page *mp)
}
/** 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.
......@@ -7100,6 +7105,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,
......@@ -7185,6 +7191,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.
......@@ -7673,6 +7680,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.
......@@ -8501,6 +8509,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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment