#include "btree.h"
int btthresh(
BTA* btact, int threshold)
;
The btthresh
function sets the write
threshold for the btree index file associated with the
btact
context pointer. The
threshold
defines the number of updates
on a block that will cause it to be written to disk. A value
of zero (the default for a btree index) means that a block is
not written to disk until the memory it occupies is required
for a new block.
btthresh
offers finer-grained control
over disk writes than in previous versions of Btree, which was
either only when necessary (in exclusive mode), or after every
API call (in shared mode). The intention is to allow the
application program to reduce the chance of lost data in a
btree index should a hardware or software falure interrupt the
running program before the indexes are closed and dirty blocks
flushed to disk.
NB: If threshold
is set to a small
value, it may reduce performance of the BTree application.
A non-zero return code indicates an error occurred.