Skip to content

Commit

Permalink
Compat with synchronous executor. (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
starrysky9959 committed Oct 8, 2023
1 parent b2ba69d commit c88f927
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/mongo/db/concurrency/monograph_locker_noop.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
#pragma once


#include "mongo/db/concurrency/lock_manager_defs.h"
#include "mongo/db/concurrency/locker.h"
#include <map>
#include <utility>

namespace mongo {
Expand Down Expand Up @@ -228,7 +230,7 @@ class MonographLockerNoop : public Locker {
}

void dump() const override {
// MONGO_UNREACHABLE;
MONGO_UNREACHABLE;
}

bool isW() const override {
Expand Down Expand Up @@ -260,13 +262,14 @@ class MonographLockerNoop : public Locker {
}

bool isGlobalLockedRecursively() override {
return false;
return true;
}

LockMode _lockMode{LockMode::MODE_NONE};
// Delays release of exclusive/intent-exclusive locked resources until the write unit of
// work completes. Value of 0 means we are not inside a write unit of work.
int _wuowNestingLevel{0};
std::map<ResourceId, LockMode> _lockMap;
};

} // namespace mongo
2 changes: 1 addition & 1 deletion src/mongo/transport/service_entry_point_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void ServiceEntryPointImpl::startSession(transport::SessionHandle session) {
}
}

if (serverGlobalParams.enableCoroutine) {
if (_coroutineExecutor) {
MONGO_LOG(0) << "use coroutine service executor";
ssm->setServiceExecutor(_coroutineExecutor.get());

Expand Down
2 changes: 1 addition & 1 deletion src/mongo/transport/service_entry_point_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class ServiceEntryPointImpl : public ServiceEntryPoint {
AtomicWord<size_t> _currentConnections{0};
AtomicWord<size_t> _createdConnections{0};

std::unique_ptr<transport::ServiceExecutorCoroutine> _coroutineExecutor;
std::unique_ptr<transport::ServiceExecutorCoroutine> _coroutineExecutor{nullptr};
};

} // namespace mongo
3 changes: 2 additions & 1 deletion src/mongo/transport/service_state_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kNetwork

#include "mongo/transport/service_state_machine.h"
#include "mongo/base/status.h"
#include "mongo/config.h"
#include "mongo/db/client.h"
Expand All @@ -39,7 +40,6 @@
#include "mongo/transport/message_compressor_manager.h"
#include "mongo/transport/service_entry_point.h"
#include "mongo/transport/service_executor_task_names.h"
#include "mongo/transport/service_state_machine.h"
#include "mongo/transport/session.h"
#include "mongo/transport/transport_layer.h"
#include "mongo/util/assert_util.h"
Expand Down Expand Up @@ -268,6 +268,7 @@ void ServiceStateMachine::Reset(ServiceContext* svcContext,
_dbClient = svcContext->makeClient(_threadName, std::move(session));
_dbClientPtr = _dbClient.get();
_threadGroupId = group_id;
_owned.store(Ownership::kUnowned);
}

const transport::SessionHandle& ServiceStateMachine::_session() const {
Expand Down

0 comments on commit c88f927

Please sign in to comment.