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

Free up 3B in the WT_REF structure

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.0, 4.4.0-rc0, 4.7.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Storage Engines
    • 3
    • Storage Engines 2020-02-24

      Summary:

      Free up 3B in the WT_REF structure.


      The WT_REF.state field is a uint32_t, and only needs to be 1B.

      The WT_REF_READING state is confusing, leading to problems when locking code looks like this:

          for (;; __wt_yield()) {
              previous_state = ref->state;
              if (previous_state != WT_REF_LOCKED &&
                WT_REF_CAS_STATE(session, ref, previous_state, WT_REF_LOCKED))
                  break;
          }
      

      instead of like this:

          for (;; __wt_yield()) {
              previous_state = ref->state;
              if (previous_state != WT_REF_LOCKED && previous_state != WT_REF_READING &&
                WT_REF_CAS_STATE(session, ref, previous_state, WT_REF_LOCKED))
                  break;
          }
      

      We should change WT_REF.state into a uint8_t, and change WT_REF_READING into a flag in the WT_REF instead of a separate state.

      Here's the diff:

      https://github.com/wiredtiger/wiredtiger/pull/5207/commits/05cb651dda123656199dd63c21d09d0c9d76a84a

      from a declined pull request for WT-5489.

            Assignee:
            keith.bostic@mongodb.com Keith Bostic (Inactive)
            Reporter:
            keith.bostic@mongodb.com Keith Bostic (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: