Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Not handling recovery of empty leaves #10

Closed
RobDickinson opened this issue Jan 20, 2017 · 1 comment
Closed

Not handling recovery of empty leaves #10

RobDickinson opened this issue Jan 20, 2017 · 1 comment

Comments

@RobDickinson
Copy link
Member

Leaves without any keys present aren't added to the recovery list, so these leaves are leaked.

@RobDickinson
Copy link
Member Author

Added a leaves_prealloc private field to KVTree to track the empty leaves found at recovery time that can't be added to the search tree. This is populated by the Recover method, which previously was detecting but ignoring empty leaves.

class KVTree {
  private:
    vector<persistent_ptr<KVLeaf>> leaves_prealloc;   // persisted but unused leaves
};

Added a corresponding field to KVTreeAnalysis, which is populated by reading the current size of the leaves_prealloc vector.

struct KVTreeAnalysis {
    size_t leaf_prealloc;   // count of persisted but unused leaves
};

Obviously this is not thread-safe (as there is no locking protection for leaves_prealloc) but this will be addressed as part of #26.

Multiple tests were changed to validate that leaf_prealloc counts were as expected. Several new tests were introduced to validate that preallocated leaves are properly detected and used in subsequent Put operations.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant