Fixing a double-free error introduced in 1.2.13
Dependencies
- [2]
OHG5NX6KRefactoring, drop and the Check trait - [3]
YXKP4AIWNew file locks, with multiple sets of free pages - [4]
VRAQTH26Fixing two crashes on corrupted files - [5]
2ZRCQBXPVersion bump - [6]
WTXLZDYIFixing bus errors on a full disk - [7]
G7K2WSVYFixing unsized iterators - [8]
4Z4GEJTFVersion bump - [9]
W2MIZD5BSingle file databases + CRC for the root pages (checking the other pages makes everything very slow) - [10]
M6PHQUGLfallocate only when necessary - [11]
PRDUE4YACleanup + published on crates.io - [12]
5LSYTRQ6More docs, example, and fixing the free page diagnostic function for mutable transactions - [13]
OFINGD26implementing prev() on cursors (+ some cleanup) - [14]
S4V4QZ5CDebugging reference-counting for put - [15]
OP6SVMODResetting history - [16]
OHUZ73MKVersions - [17]
DASFQGORDebugging - [18]
BPR2HVMRVersion bump - [19]
P5NWMJ2HVersion bump - [20]
TJ2R4HAZAccessing the root pages (unsafely, of course) - [21]
WS4ZQM4RDebugging, tests, etc. - [22]
YWFYZNLZCleanup + inter-process concurrency - [23]
FQ567GAXVersion bumps - [24]
E4MD6T3LProofreading and commenting of this crate (massive bug fixes included) - [25]
3QM7P3RRWriting the reference counts when committing - [26]
ACB4A27ZCode coverage - [*]
T7QB6QEPAdding debug.rs
Change contents
- add root[1.1][0.1]
- file move: sanakirja-core → sanakirja-core
- file move: sanakirja → sanakirja
- replacement in sanakirja/src/environment/muttxn.rs at line 49
/// Offsets of pages free at the start of the transaction.initial_free: (usize, Vec<u64>),/// Offsets of pages that were free at the start of the/// transaction, and are still free.initial_free: Vec<u64>,/// Offsets of pages that were free at the start of the/// transaction, but have been allocated since then.initial_allocated: Vec<u64>, - replacement in sanakirja/src/environment/muttxn.rs at line 101
parent.initial_free.0 = self.initial_free.0;parent.initial_free = std::mem::replace(&mut self.initial_free, Vec::new());parent.initial_allocated = std::mem::replace(&mut self.initial_allocated, Vec::new()); - replacement in sanakirja/src/environment/muttxn.rs at line 188
debug!("initial free_page {:x}", header.free_db); - replacement in sanakirja/src/environment/muttxn.rs at line 207
initial_free: (0, Vec::new()),initial_free: Vec::new(),initial_allocated: Vec::new(), - replacement in sanakirja/src/environment/muttxn.rs at line 216
init.push(*p)init.push(*p); - replacement in sanakirja/src/environment/muttxn.rs at line 218
txn.initial_free = (init.len(), init)txn.initial_free = init; - edit in sanakirja/src/environment/muttxn.rs at line 245
assert!(self.initial_free.is_empty());assert!(self.initial_allocated.is_empty()); - replacement in sanakirja/src/environment/muttxn.rs at line 256
{for p in btree::iter(&self, &free_db, None).unwrap() {debug!("was free: p = {:x}", p.unwrap().0);if cfg!(debug_assertions) {// Deleting the pages allocated during this// transaction from the free db. Note that the call to// `del` may add pages to `self.initial_allocated`.for p in self.initial_free.iter() {debug!("initial_free {:x}", p); - replacement in sanakirja/src/environment/muttxn.rs at line 263
for p in self.free_pages.iter().chain(self.free_owned_pages.iter()) {debug!("free_pages {:x}", p);for p in self.initial_allocated.iter() {debug!("initial_alloc {:x}", p); - replacement in sanakirja/src/environment/muttxn.rs at line 267
// Deleting the pages allocated during this transaction.let mut f = self.initial_free.1.len();while f > self.initial_free.0 {f -= 1;let p = self.initial_free.1[f];let mut n = 0;// Delete the pages allocated during this transaction// from the free db. If these pages have been freed// again, they will be reinserted below.while let Some(p) = self.initial_allocated.pop() {debug!("del initial {} {:x} {:x}", n, free_db.db, p); - edit in sanakirja/src/environment/muttxn.rs at line 274
if cfg!(debug_assertions) {crate::debug::debug(&self, &[&free_db], &format!("/tmp/free_{}", n), true);n += 1;} - edit in sanakirja/src/environment/muttxn.rs at line 287
debug!("put free {} {:x}", n, p); - edit in sanakirja/src/environment/muttxn.rs at line 289
if cfg!(debug_assertions) {crate::debug::debug(&self, &[&free_db], &format!("/tmp/free_{}", n), true);n += 1;} - edit in sanakirja/src/environment/muttxn.rs at line 296
debug!("put owned free {} {:x}", n, p); - edit in sanakirja/src/environment/muttxn.rs at line 298
if cfg!(debug_assertions) {crate::debug::debug(&self, &[&free_db], &format!("/tmp/free_{}", n), true);n += 1;} - edit in sanakirja/src/environment/muttxn.rs at line 304
// Delete the pages allocated during in the calls to// `put` just above. Note that this is the same code// as just before the `put`s. We need this duplication// because doing this only here could potentially// delete pages we just inserted, causing leaks.//// Conversely, doing it only above could result in// pages being allocated in the calls to `put` above,// and still counted as free.while let Some(p) = self.initial_allocated.pop() {debug!("del initial {} {:x} {:x}", n, free_db.db, p);btree::del(&mut self, &mut free_db, &p.to_le(), None)?;if cfg!(debug_assertions) {crate::debug::debug(&self, &[&free_db], &format!("/tmp/free_{}", n), true);n += 1;}} - replacement in sanakirja/src/environment/muttxn.rs at line 339
debug!(trace!( - replacement in sanakirja/src/environment/muttxn.rs at line 452[3.16496]→[2.9904:10044](∅→∅),[2.10044]→[3.16802:16841](∅→∅),[3.16802]→[3.16802:16841](∅→∅),[3.16841]→[2.10045:10081](∅→∅)
while self.initial_free.0 > 0 {self.initial_free.0 -= 1;let f = self.initial_free.1[self.initial_free.0];if self.free_for_all(f)? {return Ok(Some(f));while let Some(p) = self.initial_free.pop() {if self.free_for_all(p)? {self.initial_allocated.push(p);return Ok(Some(p)); - edit in sanakirja/src/debug.rs at line 170
// Test whether the elements on the page are in order. - edit in sanakirja/src/debug.rs at line 271[28.3072][28.3072]
if let Some(ref db_free) = db_free {let mut free = HashSet::new();for p in iter(txn, db_free, None).unwrap() {assert!(free.insert(*p.unwrap().0))}} - replacement in sanakirja/Cargo.toml at line 3
version = "1.2.12"version = "1.2.14" - replacement in sanakirja/Cargo.toml at line 32
sanakirja-core = { path = "../sanakirja-core", version = "1.2.14" }sanakirja-core = { path = "../sanakirja-core", version = "1.2.16" } - file move: cover → cover
- file move: Cargo.toml → Cargo.toml