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L7LE4GRDWWNQ65ZU2YNNTWBYLORJOABAQFEZQC
txn.commit().unwrap();
let mut txn = Env::mut_txn_begin(&env).unwrap();
let mut refs = BTreeMap::new();
add_free_refs_mut(&txn, &mut refs).unwrap();
add_refs(&txn, &db, &mut refs).unwrap();
add_refs(&txn, &db2, &mut refs).unwrap();
check_free_mut(&mut txn, &refs);
check_refs(&txn, &refs);
del(&mut txn, &mut db, &((i * i) % 1_000), None).unwrap();
}
txn.commit().unwrap();
let mut txn = Env::mut_txn_begin(&env).unwrap();
let mut refs = BTreeMap::new();
add_free_refs_mut(&txn, &mut refs).unwrap();
check_free_mut(&mut txn, &refs);
check_refs(&txn, &refs);
}
#[test]
pub fn u64_large_revdel() {
env_logger::try_init().unwrap_or(());
let env = Env::new_anon(409600000, 1).unwrap();
let mut txn = Env::mut_txn_begin(&env).unwrap();
let mut db: Db<u64, A> = create_db(&mut txn).unwrap();
let n = 40u64;
let a = A([0; 100]);
for i in 0..n {
put(&mut txn, &mut db, &i, &a).unwrap();
}
debug(&txn, &[&db], "debug0", true);
for i in (0..n).rev() {
txn.set_root(0, db.db);
txn.commit().unwrap();
let mut txn = Env::mut_txn_begin(&env).unwrap();
let mut refs = BTreeMap::new();
let db: Db<u64, u64> = txn.root_db(0).unwrap();
add_refs(&txn, &db, &mut refs).unwrap();
add_free_refs_mut(&txn, &mut refs).unwrap();
check_refs(&txn, &refs);
check_free_mut(&mut txn, &refs);
txn.set_root(0, db.db);
txn.commit().unwrap();
let mut txn = Env::mut_txn_begin(&env).unwrap();
let mut refs = BTreeMap::new();
let db: Db<u64, ()> = txn.root_db(0).unwrap();
add_refs(&txn, &db, &mut refs).unwrap();
add_free_refs_mut(&txn, &mut refs).unwrap();
check_refs(&txn, &refs);
check_free_mut(&mut txn, &refs);
txn.set_root(0, db.db);
txn.set_root(1, db2.db);
txn.commit().unwrap();
let mut txn = Env::mut_txn_begin(&env).unwrap();
let mut refs = BTreeMap::new();
let db: Db<u64, A> = txn.root_db(0).unwrap();
let db2: Db<u64, A> = txn.root_db(1).unwrap();
add_refs(&txn, &db, &mut refs).unwrap();
add_refs(&txn, &db2, &mut refs).unwrap();
add_free_refs_mut(&txn, &mut refs).unwrap();
check_refs(&txn, &refs);
check_free_mut(&mut txn, &refs);
txn.set_root(0, db.db);
txn.set_root(1, db2.db);
txn.commit().unwrap();
let mut txn = Env::mut_txn_begin(&env).unwrap();
let mut refs = BTreeMap::new();
add_refs(&txn, &db, &mut refs).unwrap();
add_refs(&txn, &db2, &mut refs).unwrap();
add_free_refs_mut(&txn, &mut refs).unwrap();
check_refs(&txn, &refs);
check_free_mut(&mut txn, &refs);