1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Merge the latest trunk enhancements into the wal2 branch.

FossilOrigin-Name: c8d8f613ed0d7639a8b859e8c7fa7da21bd1221a605c5da6a8fe041f7c9a3f5e
This commit is contained in:
drh
2025-03-15 20:28:42 +00:00
55 changed files with 699 additions and 366 deletions

View File

@@ -860,9 +860,13 @@ struct WalIterator {
u32 *aPgno; /* Array of page numbers. */
int nEntry; /* Nr. of entries in aPgno[] and aIndex[] */
int iZero; /* Frame number associated with aPgno[0] */
} aSegment[1]; /* One for every 32KB page in the wal-index */
} aSegment[FLEXARRAY]; /* One for every 32KB page in the wal-index */
};
/* Size (in bytes) of a WalIterator object suitable for N or fewer segments */
#define SZ_WALITERATOR(N) \
(offsetof(WalIterator,aSegment)*(N)*sizeof(struct WalSegment))
/*
** Define the parameters of the hash tables in the wal-index file. There
** is a hash-table following every HASHTABLE_NPAGE page numbers in the
@@ -2463,8 +2467,7 @@ static int walIteratorInit(
nSegment = 1 + (iLastSeg/iMode);
/* Allocate space for the WalIterator object. */
nByte = sizeof(WalIterator)
+ (nSegment-1)*sizeof(struct WalSegment)
nByte = SZ_WALITERATOR(nSegment)
+ iLast*sizeof(ht_slot);
p = (WalIterator *)sqlite3_malloc64(nByte
+ sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast)