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

Correlated random number generation across threads

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT11.2.0, 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Storage Engines - 2023-01-10

      While investigating WT-10337, I discovered unexpected correlations between the keys generated by worker threads in wtperf.

      Each thread has a separate WT_RAND_STATE initialized with __wt_random_init_seed, which gets a high-resolution time, and I verified that each thread got a distinct value. However, the time in seconds was identical, and this part of the time is used to seed (and then calculate) the lower 16 bits of the random number sequence. In other words, all threads generate sequences where the lower 16 bits are the same.

      It's arguable whether this is a bug, and changing this behavior may perturb test results (e.g., some benchmark results may change because threads are less correlated).

            Assignee:
            michael.cahill@mongodb.com Michael Cahill (Inactive)
            Reporter:
            michael.cahill@mongodb.com Michael Cahill (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: