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7JTEMPLTJFYUBMYVPC43H7VOAC
X3QVVQIS7B7L3XYZAWL3OOBUXOJ6RMOKQ45YMLLGAHYPEEKZ45ZAC
6DMPXOAT5GQ3BQQOMUZN2GMBQPRA4IB7CCPHTQTIFGO3KWWAKF3QC
YWFYZNLZ5JHLIFVBRKZK4TSWVPROUPRG77ZB5M7UHT2OKPL4ZSRQC
YXKP4AIWDBIWBBUDWF66YIPG5ECMHNKEV3PX6KYXOVXY3EWG3WGQC
(u64::from_le(*(page.data.as_ptr().add(HDR + c.cur as usize * 8) as *const u64)) & 0xfff)
as usize
(u64::from_le(*(page.data.as_ptr().add(HDR + c.cur as usize * 8) as *const u64))
& 0xfff) as usize
(u64::from_le(*(page.data.as_ptr().add(HDR + c.cur as usize * 8) as *const u64)) & 0xfff)
as usize
(u64::from_le(*(page.data.as_ptr().add(HDR + c.cur as usize * 8) as *const u64))
& 0xfff) as usize
(u64::from_le(*(page.data.as_ptr().add(HDR) as *const u64).add(c.cur as usize)) & 0xfff)
as usize,
(u64::from_le(*(page.data.as_ptr().add(HDR) as *const u64).add(c.cur as usize))
& 0xfff) as usize,
debug!("single child {:?}", d);
if P::is_dirty(last_op.page.as_page()) {
txn.decr_rc_owned(last_op.page.offset)?;
//
// We don't do this if the table is empty, in order to be
// consistent with put and drop.
debug!("single child {:?} {:?}", d, is_rc);
if d > 0 {
if !is_rc {
if P::is_dirty(last_op.page.as_page()) {
txn.decr_rc_owned(last_op.page.offset)?;
} else {
txn.decr_rc(last_op.page.offset)?;
}
}
db.db = d;
txn.decr_rc(last_op.page.offset)?;
// The page becomes empty.
let page = P::del(txn, last_op.page, last_op.mutable, &last_op.c1, d)?;
if page.0.offset != last_op.page.offset && !is_rc {
if P::is_dirty(last_op.page.as_page()) {
txn.decr_rc_owned(last_op.page.offset)?;
} else {
txn.decr_rc(last_op.page.offset)?;
}
}
db.db = page.0.offset
impl<'a, T: LoadPage, K: Representable + ?Sized + 'a, V: Representable + ?Sized + 'a, P: BTreePage<K, V> + 'a> Iterator for Iter<'a, T, K, V, P> {
impl<
'a,
T: LoadPage,
K: Representable + ?Sized + 'a,
V: Representable + ?Sized + 'a,
P: BTreePage<K, V> + 'a,
> Iterator for Iter<'a, T, K, V, P>
{
impl<'a, T: LoadPage, K: Representable + ?Sized + 'a, V: Representable + ?Sized + 'a, P: BTreePage<K, V> + 'a> Iterator for RevIter<'a, T, K, V, P> {
impl<
'a,
T: LoadPage,
K: Representable + ?Sized + 'a,
V: Representable + ?Sized + 'a,
P: BTreePage<K, V> + 'a,
> Iterator for RevIter<'a, T, K, V, P>
{
for i in 1..8 {
let n = i * 1_000_000;
for i in 1..3 {
let n = i * 128; // _000_000;
let mut times = [0f64; 12];
let mut test = Vec::with_capacity(n);
let mut rng = rand::thread_rng();
for _ in 0..n {
use rand::Rng;
test.push((rng.gen(), rng.gen()))
}
/*
}
let mut it = btree::rev_iter(&txn, &db, Some((&100, None))).unwrap();
let (k, _v) = it.next().unwrap().unwrap();
assert_eq!(*k, 99);
let mut cursor = btree::cursor::Cursor::new(&txn, &db).unwrap();
for i in 0..100 {
debug!("i = {:?}", i);
let (&k, v) = cursor.set(&txn, Some((&i, None))).unwrap().unwrap();
debug!("kv = {:?} {:?}", k, v);
assert_eq!(i, k);
let (&k1, v1) = cursor.next(&txn).unwrap().unwrap();
debug!("next = {:?} {:?}", k1, v1);
assert_eq!(i, k1);
}
let mut cursor = btree::cursor::Cursor::new(&txn, &db).unwrap();
for i in 0..100 {
debug!("i = {:?}", i);
let (&k, v) = cursor.set(&txn, Some((&i, None))).unwrap().unwrap();
debug!("kv = {:?} {:?}", k, v);
assert_eq!(i, k);
let (&k1, v1) = cursor.prev(&txn).unwrap().unwrap();
debug!("prev = {:?} {:?}", k1, v1);
assert_eq!(i, k1);
}
}
#[test]
pub fn fork_del() {
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 = 6 as u64;
let mut values = Vec::with_capacity(n as usize);
let a = A([0; 100]);
for i in 0..n {
if put(&mut txn, &mut db, &i, &a).unwrap() {
values.push(i);
}
}
crate::debug::debug(&txn, &[&db], "debug0", true);
let db2 = fork_db(&mut txn, &db).unwrap();
del(&mut txn, &mut db, &1, None).unwrap();
crate::debug::debug(&txn, &[&db, &db2], "debug1", true);
/*
let mut refs = BTreeMap::new();
add_refs(&txn, &db, &mut refs).unwrap();
add_refs(&txn, &db2, &mut refs).unwrap();
// add_refs(&txn, &db3, &mut refs).unwrap();
let mut err = 0;
for (p, r) in refs.iter() {
println!("{:?} {:?}", p, r);
if *r >= 2 {
if txn.rc(*p).unwrap() != *r as u64 {
error!("{:?} {:?} {:?}", p, txn.rc(*p).unwrap(), *r);
err += 1;
}
} else {
if txn.rc(*p).unwrap() != 0 {
error!("{:?} {:?} 0", p, txn.rc(*p).unwrap());
err += 1;
}
}