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 bedrock branch via the

wal2 intermediary.

FossilOrigin-Name: b1860b637232f6e14b6b4ee73be3c64be6622d6c4d934b423269da37d32d6ccc
This commit is contained in:
drh
2025-03-15 20:32:24 +00:00
55 changed files with 700 additions and 367 deletions

View File

@@ -885,9 +885,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
@@ -2501,8 +2505,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)