Skip to content

calculations comments outdated? #10

@tickioutlivetickeveryone

Description

can someone please explain this portion to me?
why 2476 / keys limit = ~12 and not 2478 / keys limit = ~12
also, why did we accommodate it to 10?

btree/src/page_layout.rs

Lines 35 to 46 in 055d08b

/// On a 64 bit machine the maximum space to keep all of the pointer
/// is 200 * 8 = 1600 bytes.
#[allow(dead_code)]
pub const MAX_SPACE_FOR_CHILDREN: usize = MAX_BRANCHING_FACTOR * PTR_SIZE;
/// This leaves the keys of an internal node 2478 bytes:
/// We use 1990 bytes for keys which leaves 488 bytes as junk.
/// This means each key is limited to 12 bytes. (2476 / keys limit = ~12)
/// Rounded down to 10 to accomodate the leave node.
#[allow(dead_code)]
pub const MAX_SPACE_FOR_KEYS: usize =
PAGE_SIZE - INTERNAL_NODE_HEADER_SIZE - MAX_SPACE_FOR_CHILDREN;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions