• C
    Fix flaky test DecreaseNumBgThreads (#6393) · 46516778
    Cheng Chang 提交于
    Summary:
    The DecreaseNumBgThreads test keeps failing on Windows in AppVeyor.
    It fails because it depends on a timed wait for the tasks to be dequeued from the threadpool's internal queue, but within the specified time, the task might have not been scheduled onto the newly created threads.
    https://github.com/facebook/rocksdb/pull/6232 tries to fix this by waiting for longer time to let the threads scheduled.
    This PR tries to fix this by replacing the timed wait with a synchronization on the task's internal conditional variable.
    When the number of threads increases, instead of guessing the time needed for the task to be scheduled, it directly blocks on the conditional variable until the task starts running.
    But when thread number is reduced, it still does a timed wait, but this does not lead to the flakiness now, will try to remove these timed waits in a future PR.
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/6393
    
    Test Plan: Wait to see whether AppVeyor tests pass.
    
    Differential Revision: D19890928
    
    Pulled By: cheng-chang
    
    fbshipit-source-id: 4e56e4addf625c98c0876e62d9d57a6f0a156f76
    46516778
testutil.h 25.0 KB