|
Author:
{'name': 'Matthew Russotto', 'email': 'matthew.russotto@mongodb.com', 'username': 'mtrussotto'}
Message: SERVER-61792 Extending lock in batcher hurts performance
Before SERVER-61334, we took RSTL IX, PBWM IS, Global IS, once, and released those almost
immediately. SERVER-61334 took RSTL IX, PBWM IS, and Global IS, then took the same locks
recursively, and held them a little longer (not much! It's just getting BSON objects off an
in-memory queue). Global IS is nearly always uncontended (except shutdown and storage change), as is
RSTL IX, and getting a lock we already have is very cheap. But holding PBWM IS a little longer was
enough to essentially serialize oplog application and batching a lot of the time.
This fix takes RSTL IX and Global IS, then takes those locks recursively, and holds them a bit
longer than the original, but there's no contention. The purpose of SERVER-61334 was to ensure we
did not enqueue an uninterruptible global lock while a storage change held Global X, as that results
in deadlock; this purpose is preserved by this change.
Branch: master
https://github.com/mongodb/mongo/commit/526f24e10905eb80f58dcd1ddd5db37853c91a60
|