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

Add a qsort implementation to WiredTiger that supports qsort_r

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • 8
    • 2023-07-25 Absolute unit

      This work came out of WT-11060, where it was identified that we cannot sort prepared transaction modifications on trees that use collators. This is because WiredTiger's compare code requires a session pointer when using a collator which isn't available on the WT_TXN_OP structure that is being sorted. Regular qsort in the c std library cannot take a context arg, which is what qsort_r was created for. However qsort_r is implemented differently across most major platforms and is a cause for concern, we also considered implementing qsort_r using a static thread_local argument but that is outside of WiredTigers practices.

      Of course we could continue leaving collators behind or add a WT_SESSION pointer to WT_TXN_OP but both of those solutions were rejected as well. See WT-11060 for more details. The decided upon solution was to implement qsort and qsort_r in WiredTiger.

      Scope:

      • Implement qsort and qsort_r in WiredTiger.

            Assignee:
            will.korteland@mongodb.com Will Korteland
            Reporter:
            luke.pearson@mongodb.com Luke Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: