diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2021-05-31 16:42:11 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-02 22:32:50 +0000 |
commit | 9748e291b6a10e12b85c978d459fb6f6bf2d9ea3 (patch) | |
tree | 33405c1ac82fcf0d127748a6774122fe50164932 /src/mongo/db/s/dist_lock_catalog_mock.h | |
parent | 9f6598c1e321b88d7467547a2d0a80a92ae5a944 (diff) | |
download | mongo-9748e291b6a10e12b85c978d459fb6f6bf2d9ea3.tar.gz |
SERVER-57018 Make shards release their dist locks on step-up
Diffstat (limited to 'src/mongo/db/s/dist_lock_catalog_mock.h')
-rw-r--r-- | src/mongo/db/s/dist_lock_catalog_mock.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/mongo/db/s/dist_lock_catalog_mock.h b/src/mongo/db/s/dist_lock_catalog_mock.h index 2d71657a62a..0166a62ec1c 100644 --- a/src/mongo/db/s/dist_lock_catalog_mock.h +++ b/src/mongo/db/s/dist_lock_catalog_mock.h @@ -89,6 +89,8 @@ public: using GetLockByTSFunc = std::function<void(const OID& ts)>; using GetLockByNameFunc = std::function<void(StringData name)>; using GetServerInfoFunc = std::function<void()>; + using UnlockAllFunc = + std::function<void(StringData processID, boost::optional<long long> term)>; virtual StatusWith<LockpingsType> getPing(OperationContext* opCtx, StringData processID) override; @@ -98,6 +100,7 @@ public: virtual StatusWith<LocksType> grabLock(OperationContext* opCtx, StringData lockID, const OID& lockSessionID, + long long term, StringData who, StringData processId, Date_t time, @@ -107,6 +110,7 @@ public: virtual StatusWith<LocksType> overtakeLock(OperationContext* opCtx, StringData lockID, const OID& lockSessionID, + long long term, const OID& currentHolderTS, StringData who, StringData processId, @@ -117,13 +121,12 @@ public: const OID& lockSessionID, StringData name) override; - virtual Status unlockAll(OperationContext* opCtx, const std::string& processID) override; + virtual Status unlockAll(OperationContext* opCtx, + const std::string& processID, + boost::optional<long long> term) override; virtual StatusWith<ServerInfo> getServerInfo(OperationContext* opCtx) override; - virtual StatusWith<LocksType> getLockByTS(OperationContext* opCtx, - const OID& lockSessionID) override; - virtual StatusWith<LocksType> getLockByName(OperationContext* opCtx, StringData name) override; virtual Status stopPing(OperationContext* opCtx, StringData processId) override; @@ -157,12 +160,6 @@ public: /** * Sets the checker method to use and its return value the every time - * getLockByTS is called. - */ - void expectGetLockByTS(GetLockByTSFunc checkerFunc, StatusWith<LocksType> returnThis); - - /** - * Sets the checker method to use and its return value the every time * getLockByName is called. */ void expectGetLockByName(GetLockByNameFunc checkerFunc, StatusWith<LocksType> returnThis); @@ -186,6 +183,8 @@ public: void expectGetServerInfo(GetServerInfoFunc checkerFunc, StatusWith<DistLockCatalog::ServerInfo> returnThis); + void expectUnlockAll(UnlockAllFunc checkerFunc); + private: // Protects all the member variables. Mutex _mutex = MONGO_MAKE_LATCH("DistLockCatalogMock::_mutex"); @@ -216,6 +215,8 @@ private: GetServerInfoFunc _getServerInfoChecker; StatusWith<DistLockCatalog::ServerInfo> _getServerInfoReturnValue; + + UnlockAllFunc _unlockAllChecker; }; } // namespace mongo |