pijul nest
guest [sign in]

Fixing some comments and reformatting

pmeunier
Jul 30, 2021, 6:02 PM
HCDD6FX7YL5MDK757ZE6MYHB2YHCUAO2Y3Y347JBTG4DNCIJJBIQC

Dependencies

  • [2] 5JOD7M26 Modifying cursor lengths when appending
  • [3] XEU2QVLC Debugging after plugging this into Pijul
  • [4] CCNPHVQC Cleanup, comments, renaming
  • [5] TSMS6W4D Fully commented implementation of Sized nodes + massive cleanup
  • [6] W2MIZD5B Single file databases + CRC for the root pages (checking the other pages makes everything very slow)
  • [7] H3FVSQIQ Unsized pages
  • [8] SYURNHHL Adding the `put_mut` and `set_left_child` methods
  • [9] HN6Z5DU4 Cleanup
  • [10] OTWDDJE7 Trait/type cleanup
  • [11] QYDGYIZR Split trait Representable into its mandatory part and an optional part
  • [12] NXMFNPZ7 Comments + debugging drop
  • [13] RV2L6CZW A few comments
  • [14] KMT3MF5N Drop a database
  • [15] 52X5P7ND Cleaning up the unsized part
  • [16] APPY2E7M Unsized deletions + custom sizes back
  • [17] DASFQGOR Debugging
  • [18] OFINGD26 implementing prev() on cursors (+ some cleanup)
  • [19] OP6SVMOD Resetting history
  • [20] 6UVFCERM Formatting, debugging, etc.
  • [21] LPKM23EU Nailing this leak
  • [22] WS4ZQM4R Debugging, tests, etc.
  • [23] QEUTVAZ4 Splitting btree::page
  • [24] G4JEQLLX Debugging synchronisation
  • [25] 73Z2UB3J Cleanup + comments
  • [26] LSQ6V7M6 Cleanup + docs
  • [27] DV4A2LR7 Double-inserts (rebalancing near an internal deletion)
  • [28] UUUVNC4D Debugging/cleanup around cursors
  • [29] Q7DRIBBR Debugging replace (which cannot be del+put)

Change contents

  • replacement in sanakirja-core/src/lib.rs at line 68
    [3.1440][3.1440:1477]()
    /// references to out-of-tree pages.
    [3.1440]
    [3.0]
    /// references.
  • edit in sanakirja-core/src/lib.rs at line 203
    [3.2077]
    [3.1663]
    assert_eq!(k.align_offset(K::ALIGN), 0);
  • replacement in sanakirja-core/src/lib.rs at line 206
    [3.2159][3.2159:2225]()
    let va = V::ALIGN;
    let v_off = (ks + va - 1) & !(va - 1);
    [3.2159]
    [3.2225]
    let v_off = (ks + V::ALIGN - 1) & !(V::ALIGN - 1);
  • replacement in sanakirja-core/src/lib.rs at line 259
    [3.401][3.401:438]()
    self.data.offset(8),
    [3.401]
    [3.438]
    self.data.add(8),
  • replacement in sanakirja-core/src/lib.rs at line 274
    [3.1928][3.1928:1993]()
    /// `CowPage` to avoid checking the "dirty" bit at running time.
    [3.1928]
    [3.504]
    /// `CowPage` to avoid checking the "dirty" bit at runtime.
  • replacement in sanakirja-core/src/lib.rs at line 288
    [3.907][3.907:966]()
    let crc = (self.0.data as *mut u32).offset(1);
    [3.907]
    [3.966]
    let crc = (self.0.data as *mut u32).add(1);
  • replacement in sanakirja-core/src/btree/page.rs at line 110
    [3.5381][3.5381:5475]()
    // position `-1` has a right child (which is the left child of the
    // first element).
    [3.5381]
    [3.5475]
    // position `-1` has a right child (which is the first element's
    // left child).
  • replacement in sanakirja-core/src/btree/page.rs at line 143
    [3.4501][3.4501:4615]()
    if c.cur < c.total as isize {
    c.cur += 1;
    true
    } else {
    false
    [3.4501]
    [3.4615]
    if c.cur >= c.total as isize {
    return false;
  • edit in sanakirja-core/src/btree/page.rs at line 146
    [3.4625]
    [3.4625]
    c.cur += 1;
    true
  • replacement in sanakirja-core/src/btree/page.rs at line 151
    [3.4680][3.4680:4803]()
    if c.cur > 0 {
    c.cur -= 1;
    true
    } else {
    c.cur = -1;
    false
    [3.4680]
    [3.5729]
    if c.cur < 0 {
    return false;
  • edit in sanakirja-core/src/btree/page.rs at line 154
    [3.5739]
    [3.5739]
    c.cur -= 1;
    true
  • edit in sanakirja-core/src/btree/page.rs at line 158
    [3.5746][3.5746:5809]()
    // This is the first non-trivial method, let's explain it.
  • replacement in sanakirja-core/src/btree/page.rs at line 171
    [3.6282][3.6282:6506]()
    // This means that the header may be followed by
    // padding. These are constants known at compile-time, by
    // the way, so `al` and `hdr` are optimised away by the
    // compiler.
    [3.6282]
    [3.6506]
    // This means that the header may be followed by padding
    // (in order to align the entries). These are constants
    // known at compile-time, so `al` and `hdr` are optimised
    // away by the compiler.
  • replacement in sanakirja-core/src/btree/page.rs at line 183
    [3.6896][3.6896:6952]()
    // `f * cur` bytes after the padded header:
    [3.6896]
    [3.6952]
    // `f * cur` bytes after the padded header (because
    // `size_of` includes alignment padding).
  • replacement in sanakirja-core/src/btree/page.rs at line 225
    [3.4988][3.4988:5088]()
    unsafe { *(page.data.as_ptr().add((HDR + c.cur as usize * 8) - 8) as *const u64) };
    [3.4988]
    [3.5088]
    unsafe { *(page.data.as_ptr().offset((HDR as isize + c.cur * 8) - 8) as *const u64) };
  • replacement in sanakirja-core/src/btree/page.rs at line 233
    [3.5305][3.8676:8763]()
    assert!(c.cur < c.total as isize && HDR as isize + c.cur * 8 - 8 <= 4088);
    [3.5305]
    [3.5305]
    assert!(c.cur < c.total as isize && HDR as isize + c.cur * 8 <= 4088);
  • replacement in sanakirja-core/src/btree/page.rs at line 256
    [3.9175][3.9175:9275]()
    // Just read the tuple, as we did multiple times
    // before.
    [3.9175]
    [3.9275]
    // Just read the tuple and return it.
  • replacement in sanakirja-core/src/btree/page.rs at line 317
    [3.10774][3.10774:10826]()
    // leaf). This is implemented the `put` module.
    [3.10774]
    [3.1522]
    // leaf). This is implemented in the `put` module.
  • replacement in sanakirja-core/src/btree/page.rs at line 341
    [3.11472][3.582:633](),[3.633][2.54:84](),[2.84][3.659:715](),[3.659][3.659:715]()
    unsafe fn put_mut(
    page: &mut MutPage,
    c: &mut Self::Cursor,
    k0: &K,
    v0: &V,
    r: u64,
    ) {
    [3.11472]
    [3.715]
    unsafe fn put_mut(page: &mut MutPage, c: &mut Self::Cursor, k0: &K, v0: &V, r: u64) {
  • replacement in sanakirja-core/src/btree/page.rs at line 352
    [3.963][3.963:1070]()
    unsafe fn set_left_child(
    page: &mut MutPage,
    c: &Self::Cursor,
    l: u64
    ) {
    [3.963]
    [3.1070]
    unsafe fn set_left_child(page: &mut MutPage, c: &Self::Cursor, l: u64) {
  • replacement in sanakirja-core/src/btree/page.rs at line 366
    [3.11050][3.11050:11127]()
    assert!(!c.is_leaf && c.cur >= 0 && (c.cur as usize) < c.total + 1);
    [3.11050]
    [3.11672]
    assert!(!c.is_leaf && c.cur >= 0 && (c.cur as usize) <= c.total);
  • replacement in sanakirja-core/src/btree/page.rs at line 680
    [3.5313][3.5313:5398]()
    panic!("off = {:?}, size = {:?}", off, core::mem::size_of::<Tuple<K, V>>());
    [3.5313]
    [3.5398]
    panic!(
    "off = {:?}, size = {:?}",
    off,
    core::mem::size_of::<Tuple<K, V>>()
    );
  • replacement in sanakirja-core/src/btree/mod.rs at line 77
    [3.9813][3.9813:9882]()
    /// element. In that sense, this is not the symmetric of `next`.
    [3.9813]
    [3.8193]
    /// element. Note that this is not the symmetric of `next`.
  • replacement in sanakirja-core/src/btree/mod.rs at line 114
    [3.10740][3.10740:10804]()
    /// if `v0.is_none()`, and to `(k0, v0)` if `v0.is_some()`.
    [3.10740]
    [3.13803]
    /// if `v0.is_none()`, and to `(k0, v0)` if `v0.is_some()`. If a
    /// match is found (on `k0` only if `v0.is_none()`, on `(k0, v0)`
    /// else), return the match along with the right child.
    ///
    /// Else (in the `Err` case of the `Result`), return the position
    /// at which `(k0, v0)` can be inserted.
  • edit in sanakirja-core/src/btree/mod.rs at line 127
    [3.8722]
    [3.10805]
    /// Splits the cursor into two cursors: the elements strictly
    /// before the current position, and the elements greater than or
    /// equal the current element.
  • replacement in sanakirja-core/src/btree/mod.rs at line 157
    [3.44884][3.44884:45122]()
    /// `replace`. The "double insertion" is only ever used when
    /// deleting, and when the right child of a deleted entry (in an
    /// internal node) has split while we were looking for a
    /// replacement for the deleted entry.
    [3.44884]
    [3.45122]
    /// `replace`. When `k1v1.is_some()`, we insert both `(k0, v0)`
    /// (as a replacement), followed by `(k1, v1)`. This is only ever
    /// used when deleting, and when the right child of a deleted
    /// entry (in an internal node) has split while we were looking
    /// for a replacement for the deleted entry.
  • replacement in sanakirja-core/src/btree/mod.rs at line 190
    [3.1533][3.1533:1572]()
    ) {
    unimplemented!()
    }
    [3.1533]
    [3.1572]
    );
  • replacement in sanakirja-core/src/btree/mod.rs at line 197
    [3.1703][3.1703:1742]()
    ) {
    unimplemented!()
    }
    [3.1703]
    [3.1742]
    );
  • replacement in sanakirja-core/src/btree/mod.rs at line 424
    [3.1286][3.5515:5650]()
    // Here, either rc > 1, or else `P::move_next` returned
    // `false`, meaning that the cursor is after the last element.
    [3.1286]
    [3.7394]
    // Here, either rc > 1 (in which case the only thing we need
    // to do in this iteration is to decrement the RC), or else
    // `P::move_next` returned `false`, meaning that the cursor is
    // after the last element (in which case we are done with this
    // page, and also need to decrement its RC, in order to free
    // it).
  • edit in sanakirja-core/src/btree/cursor.rs at line 121
    [3.34044]
    [3.39134]
    /// Push the leftmost path starting at page `left_page` onto the
    /// stack.
  • replacement in sanakirja-core/src/btree/cursor.rs at line 147
    [3.39945][3.39945:40187]()
    // An invariant of cursors, fundamental to understand the `next`
    // and `prev` functions below, is that the lower levels (in the
    // tree, upper levels on the stack) are the left children of the
    // cursor's position on a page.
    [3.39945]
    [3.40187]
    // An invariant of cursors, fundamental to understanding the
    // `next` and `prev` functions below, is that the lower levels (in
    // the tree, upper levels on the stack) are the left children of
    // the cursor's position on a page.
  • replacement in sanakirja-core/src/btree/cursor.rs at line 160
    [3.34117][3.66035:66162](),[3.66035][3.66035:66162]()
    // Set the "cursor stack" by setting a skip list cursor in
    // each page from the root to the appropriate leaf.
    [3.34117]
    [3.7698]
    // Set the "cursor stack" by setting a cursor in each page
    // on a path from the root to the appropriate leaf.
  • replacement in sanakirja-core/src/btree/cursor.rs at line 163
    [3.7699][3.7699:7738]()
    // Start back from the bottom.
    [3.7699]
    [3.18925]
    // Start from the bottom of the stack, which is also the root
    // of the tree.