From c417fe788083f2dfa20970c9954facaabd9cf654 Mon Sep 17 00:00:00 2001 From: jussisaurio Date: Mon, 23 Dec 2024 21:12:40 +0200 Subject: [PATCH] add link to sqlite source about payload_overflows() --- core/storage/btree.rs | 1 + core/storage/sqlite3_ondisk.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/core/storage/btree.rs b/core/storage/btree.rs index 08ec9c855..05dacb53d 100644 --- a/core/storage/btree.rs +++ b/core/storage/btree.rs @@ -1494,6 +1494,7 @@ impl BTreeCursor { log::debug!("fill_cell_payload(overflow)"); let payload_overflow_threshold_min = self.payload_overflow_threshold_min(page_type); + // see e.g. https://github.com/sqlite/sqlite/blob/9591d3fe93936533c8c3b0dc4d025ac999539e11/src/dbstat.c#L371 let mut space_left = payload_overflow_threshold_min + (record_buf.len() - payload_overflow_threshold_min) % (self.usable_space() - 4); diff --git a/core/storage/sqlite3_ondisk.rs b/core/storage/sqlite3_ondisk.rs index 8af1c7eba..f6a7fbe2e 100644 --- a/core/storage/sqlite3_ondisk.rs +++ b/core/storage/sqlite3_ondisk.rs @@ -1274,6 +1274,7 @@ pub fn begin_write_wal_header(io: &Rc, header: &WalHeader) -> Result<( /// Checks if payload will overflow a cell based on the maximum allowed size. /// It will return the min size that will be stored in that case, /// including overflow pointer +/// see e.g. https://github.com/sqlite/sqlite/blob/9591d3fe93936533c8c3b0dc4d025ac999539e11/src/dbstat.c#L371 pub fn payload_overflows( payload_size: usize, payload_overflow_threshold_max: usize,