From e8f6b0006c945154673aa71c3a9b9fcbec9634e5 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 23 Apr 2024 13:20:31 -0500 Subject: [PATCH] Added a comment after mistakenly trying to use altas during rbyd compaction Spent an embarrassingly long time debugging rbyd over this. It's tempting to terminate inner binary nodes with altas during compaction, since the last alt should always be taken. But it's easy to miss that our compaction algorithm actually relies on copying the tag forward each layer to avoid recursively finding the largest tag. Adding a comment will hopefully prevent the headache for someone else in the future. --- lfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lfs.c b/lfs.c index 79b111a7..fbf214ab 100644 --- a/lfs.c +++ b/lfs.c @@ -3768,6 +3768,10 @@ static int lfsr_rbyd_appendcompaction(lfs_t *lfs, lfsr_rbyd_t *rbyd, } // connect with an altle + // + // note we can't use an altas here, we need to encode the + // exact tag so we know the largest tag when building the + // next layer err = lfsr_rbyd_appendtag(lfs, rbyd, LFSR_TAG_ALT( (i == 0 && off < layer_)