Compare 1eb8dc2 ... +2 ... 21b3ef2


@@ -56,7 +56,8 @@
Loading
56 56
        Ok(self.get_ref().len() as u64)
57 57
    }
58 58
    fn set_len(&mut self, len: u64) -> PRes<()> {
59 -
        Ok(self.get_mut().resize(len as usize, 0))
59 +
        self.get_mut().resize(len as usize, 0);
60 +
        Ok(())
60 61
    }
61 62
}
62 63

@@ -255,7 +255,7 @@
Loading
255 255
        let mut segments_id = HashMap::new();
256 256
        let mut segments_name = HashMap::new();
257 257
        for segment in segments {
258 -
            segments_id.insert(segment.id.clone(), segment.clone());
258 +
            segments_id.insert(segment.id, segment.clone());
259 259
            segments_name.insert(segment.name.clone(), segment.clone());
260 260
        }
261 261
        let mut lock = self.lock.lock()?;

@@ -584,8 +584,7 @@
Loading
584 584
    }
585 585
586 586
    fn recover(&self, _: &mut Transaction) -> PRes<RecoverStatus> {
587 -
        //TODO: add another clean status
588 -
        Ok(RecoverStatus::Commit)
587 +
        Ok(RecoverStatus::Cleanup)
589 588
    }
590 589
}
591 590

@@ -42,7 +42,7 @@
Loading
42 42
        let running;
43 43
        {
44 44
            let mut lock = ops.lock()?;
45 -
            lock = cond.wait_while(lock, |x| x.ops.len() == 0 && x.running)?;
45 +
            lock = cond.wait_while(lock, |x| x.ops.is_empty() && x.running)?;
46 46
            pending = replace(&mut lock.ops, Vec::new());
47 47
            running = lock.running;
48 48
        }

@@ -1957,7 +1957,7 @@
Loading
1957 1957
            val = String::from("aaa").into_bytes();
1958 1958
            id = tx.insert("def", &val).expect("error on insert value");
1959 1959
            let mut prepared = tx.prepare().expect("error on commit prepare");
1960 -
            std::mem::replace(&mut prepared.finalize, None);
1960 +
            let _replaced = std::mem::replace(&mut prepared.finalize, None);
1961 1961
        }
1962 1962
        {
1963 1963
            let persy = Persy::open("./target/test_recover_prepared.persy", Config::new()).unwrap();
@@ -1985,7 +1985,7 @@
Loading
1985 1985
            val = String::from("aaa").into_bytes();
1986 1986
            id = tx.insert("def", &val).expect("error on insert value");
1987 1987
            let mut prepared = tx.prepare().expect("error on commit prepare");
1988 -
            std::mem::replace(&mut prepared.finalize, None);
1988 +
            let _replaced = std::mem::replace(&mut prepared.finalize, None);
1989 1989
        }
1990 1990
        {
1991 1991
            let persy = Persy::open("./target/test_double_recover_prepared.persy", Config::new()).unwrap();
@@ -1994,7 +1994,7 @@
Loading
1994 1994
            val1 = String::from("bbbb").into_bytes();
1995 1995
            id1 = tx.insert("def", &val1).expect("error on insert value");
1996 1996
            let mut prepared = tx.prepare().expect("error on commit prepare");
1997 -
            std::mem::replace(&mut prepared.finalize, None);
1997 +
            let _replaced = std::mem::replace(&mut prepared.finalize, None);
1998 1998
        }
1999 1999
2000 2000
        {
@@ -2032,7 +2032,7 @@
Loading
2032 2032
            val_1 = String::from("bbb").into_bytes();
2033 2033
            tx.update("def", &id_pers_update, &val_1).expect("delete record works");
2034 2034
            let mut prepared = tx.prepare().expect("error on commit prepare");
2035 -
            std::mem::replace(&mut prepared.finalize, None);
2035 +
            let _replaced = std::mem::replace(&mut prepared.finalize, None);
2036 2036
        }
2037 2037
        {
2038 2038
            let persy = Persy::open_with_recover("./target/test_recover_tx_id.persy", Config::new(), |t_id| {
@@ -2077,7 +2077,7 @@
Loading
2077 2077
                .expect("error on transaction begin");
2078 2078
            id = tx.insert("def", &val).expect("error on insert value");
2079 2079
            let mut prepared = tx.prepare().expect("error on commit prepare");
2080 -
            std::mem::replace(&mut prepared.finalize, None);
2080 +
            let _replaced = std::mem::replace(&mut prepared.finalize, None);
2081 2081
2082 2082
            let mut tx = persy
2083 2083
                .begin_with(TransactionConfig::new().set_transaction_id(tx_id_1.clone()))
@@ -2087,7 +2087,7 @@
Loading
2087 2087
            val_1 = String::from("bbb").into_bytes();
2088 2088
            tx.update("def", &id_pers_update, &val_1).expect("delete record works");
2089 2089
            let mut prepared = tx.prepare().expect("error on commit prepare");
2090 -
            std::mem::replace(&mut prepared.finalize, None);
2090 +
            let _replaced = std::mem::replace(&mut prepared.finalize, None);
2091 2091
        }
2092 2092
        {
2093 2093
            let mut recover = Persy::recover("./target/test_recover_tx_choice.persy", Config::new()).unwrap();

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Learn more Showing 28 files with coverage changes found.

Changes in src/journal.rs
-23
+30
Loading file...
Changes in src/error.rs
+3
Loading file...
Changes in tests/persy.rs
-58
+9
Loading file...
Changes in src/transaction.rs
-30
+17
Loading file...
Changes in src/index/keeper.rs
-10
+4
Loading file...
Changes in src/address.rs
+3
+3
Loading file...
Changes in src/index/serialization.rs
-26
Loading file...
Changes in src/persy.rs
-10
+2
Loading file...
Changes in src/config.rs
-3
Loading file...
Changes in src/snapshot.rs
+1
Loading file...
Changes in tests/helpers.rs
-1
Loading file...
Changes in src/flush_checksum.rs
-7
Loading file...
Changes in src/locks.rs
-1
Loading file...
Changes in tests/record_operations.rs
-1
Loading file...
Changes in tests/segment_operations.rs
-1
Loading file...
Changes in tests/index_concurrent_write.rs
-1
Loading file...
Changes in tests/index.rs
-3
Loading file...
Changes in tests/snapshots.rs
+4
Loading file...
src/index/tree/tests.rs
Loading file...
src/index/tree/nodes.rs
Loading file...
src/io.rs
Loading file...
Changes in src/lib.rs
+2
Loading file...
Changes in src/index/config.rs
-21
-4
Loading file...
Changes in src/segment.rs
-1
+15
Loading file...
Changes in src/id.rs
-19
-2
Loading file...
Changes in src/discref.rs
-124
-20
Loading file...
Changes in src/allocator.rs
-15
-8
Loading file...
Changes in src/index/tree.rs
+874
+28
Loading file...
Files Coverage
src -0.45% 92.97%
tests -0.57% 98.56%
Project Totals (27 files) 94.01%
Loading