Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-9817

Column store tree open should always fetch the last page with global visibility

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • WT11.1.0, 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • 0
    • Storage Engines - 2022-09-19

      When a column-store tree is opened, we read the last page to find out what the last recno in the tree is; this value is then used for future appends. With the advent of fast-truncate support for VLCS, it's possible for the end of the tree to be truncated away (though it's difficult to arrange, because the last page of any cursor truncate is always slow-truncated) and in this case we do visibility checks to skip over the deleted pages.

      The read of the last page was setting WT_READ_VISIBLE_ALL based on whether the current transaction has a snapshot or not (doubtless cloned from one of the many other similar uses) but this is wrong; it should always use WT_READ_VISIBLE_ALL. If the last pages of the tree are deleted, we can only reuse their keyspace for appends if the deletions are globally visible. If we do it based on some random snapshot belonging to whoever opened the tree, we might create conflicts (that might or might not be detected, too) and that's definitely bad.

      Note that WT_READ_VISIBLE_ALL only applies to skipping over deleted pages, so the effect is something like read-if-visible-to-any.

      Also, since the append recno is never readjusted while the tree is open (and doing so would be problematic) if you truncate away the end of the tree and start appending, whether the truncated space gets reused or not depends on when and whether the tree has been closed and reopened in the meantime. This is not entirely optimal, but I don't think it can reasonably be called incorrect.

            Assignee:
            alexander.gorrod@mongodb.com Alexander Gorrod
            Reporter:
            dholland+wt@sauclovia.org David Holland
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: