1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Merge recent trunk enhancements.

FossilOrigin-Name: 2100b2c8f339e9778723fa0c91e479bab8675cf6fbea1664b6af49f40db6d27b
This commit is contained in:
drh
2020-05-01 15:04:13 +00:00
33 changed files with 1352 additions and 169 deletions

View File

@@ -2857,8 +2857,11 @@ int sqlite3BtreeSetPagerFlags(
int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){
int rc = SQLITE_OK;
BtShared *pBt = p->pBt;
assert( nReserve>=-1 && nReserve<=255 );
assert( nReserve>=-1 && nReserve<=254 );
sqlite3BtreeEnter(p);
if( nReserve>=0 ){
pBt->nReserveWanted = nReserve + 1;
}
if( pBt->btsFlags & BTS_PAGESIZE_FIXED ){
sqlite3BtreeLeave(p);
return SQLITE_READONLY;
@@ -2911,14 +2914,15 @@ int sqlite3BtreeGetReserveNoMutex(Btree *p){
** are intentually left unused. This is the "reserved" space that is
** sometimes used by extensions.
**
** If SQLITE_HAS_MUTEX is defined then the number returned is the
** greater of the current reserved space and the maximum requested
** reserve space.
** The value returned is the larger of the current reserve size and
** the latest reserve size requested by SQLITE_FILECTRL_RESERVE_BYTES.
** The amount of reserve can only grow - never shrink.
*/
int sqlite3BtreeGetOptimalReserve(Btree *p){
int sqlite3BtreeGetRequestedReserve(Btree *p){
int n;
sqlite3BtreeEnter(p);
n = sqlite3BtreeGetReserveNoMutex(p);
n = ((int)p->pBt->nReserveWanted) - 1;
if( n<0 ) n = sqlite3BtreeGetReserveNoMutex(p);
sqlite3BtreeLeave(p);
return n;
}