Use LIST instead of TAILQ for the data handle hash tables (conn->dhhash, session->dhhash)

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Engines - Foundations
    • 358.911
    • None
    • None

      Follow-up from WT-17788, which converted the cross-checkpoint shared disk cache's hash table from TAILQ to LIST because it never used the tail pointer TAILQ carries.

      The connection-wide dhandle hash table (conn->dhhash, src/include/connection.h) and each session's dhandle cache hash table (session->dhhash, src/include/session.h) have the same property: they are only ever walked forward (TAILQ_FOREACH) and inserted/removed at arbitrary positions (TAILQ_INSERT_HEAD / TAILQ_REMOVE), never TAILQ_INSERT_TAIL, TAILQ_LAST, TAILQ_PREV, or TAILQ_FOREACH_REVERSE.

      conn->dhhash and each session->dhhash are sized by the connection's "hash.dhandle_buckets" config (default 512, max 65536), so every open session pays for its own bucket array of that size. Switching both to LIST_HEAD/LIST_ENTRY drops one pointer (8 bytes) per bucket per array with no change in removal complexity (LIST_REMOVE, like TAILQ_REMOVE, is O(1) via the same prev-pointer-to-pointer trick) – at the default 512 buckets, a workload with many concurrently open sessions saves several hundred KB to a few MB depending on session count.

      Requires adding the LIST_* macros to src/include/queue.h if not already present from WT-17788, and relaxing dist/s_style's TAILQ-only restriction (already partially relaxed by WT-17788).

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Chenhao Qu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: