Added tests for theoretical bound on tree height and recovery from delete-all

- Unless there is a bug, rbyd trees should be strictly <= (2*log2(n)+1)
  in height. The extra +1 from traditional red-black trees is due to the
  introduced to-be-pruned alt, but since we clean those up as soon as we
  can, only one will ever exist in any search path.

  This also holds true with range deletion, however the definition of n
  changes to the number of tree operations. This is the same for tombstoning.

- Delete-all recovery is a bit tricky because we have no tree at that
  point, which is weird for an append-only data-structure.
This commit is contained in:
Christopher Haster
2023-01-04 12:01:12 -06:00
parent 9a1ce1be47
commit 92ce5df949
2 changed files with 258 additions and 5 deletions
+6
View File
@@ -139,6 +139,12 @@ static inline uint32_t lfs_npw2(uint32_t a) {
#endif
}
// TODO we should eventually adopt this as the new name for npw2
// Find the ceiling of log base 2 of the given number
static inline uint32_t lfs_nlog2(uint32_t a) {
return lfs_npw2(a);
}
// Count the number of trailing binary zeros in a
// lfs_ctz(0) may be undefined
static inline uint32_t lfs_ctz(uint32_t a) {