fix: another pass on fixing namespace imports to support fb2 (#1024)

This commit is contained in:
Roman Gershman 2023-04-03 11:10:47 +03:00 committed by GitHub
parent 525eda1f85
commit c96776a0ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 59 additions and 7 deletions

View file

@ -5,6 +5,37 @@
// An import header that centralizes all the imports from helio project regarding fibers
#ifdef USE_FB2
#include "util/fibers/fiber2.h"
#include "util/fibers/fiberqueue_threadpool.h"
#include "util/fibers/future.h"
#include "util/fibers/simple_channel.h"
namespace dfly {
using util::fb2::Barrier;
using util::fb2::BlockingCounter;
using util::fb2::CondVar;
using util::fb2::Done;
using util::fb2::EventCount;
using util::fb2::Fiber;
using util::fb2::FiberQueue;
using util::fb2::FiberQueueThreadPool;
using util::fb2::Future;
using util::fb2::Launch;
using util::fb2::Mutex;
using util::fb2::Promise;
using util::fb2::SimpleChannel;
} // namespace dfly
namespace util {
using fb2::SharedMutex;
}
#else
#include "util/fiber_sched_algo.h"
#include "util/fibers/event_count.h"
#include "util/fibers/fiber.h"
@ -29,3 +60,5 @@ using util::fibers_ext::SimpleChannel;
using CondVar = ::boost::fibers::condition_variable;
} // namespace dfly
#endif

View file

@ -4,6 +4,20 @@
#pragma once
#ifdef USE_FB2
#include "util/fibers/uring_proactor.h"
#include "util/uring/uring_file.h"
namespace dfly {
using util::fb2::FiberCall;
using util::fb2::LinuxFile;
using util::fb2::OpenLinux;
using util::fb2::OpenRead;
} // namespace dfly
#else
#include "util/uring/proactor.h"
#include "util/uring/uring_file.h"
@ -15,3 +29,4 @@ using util::uring::OpenLinux;
using util::uring::OpenRead;
} // namespace dfly
#endif

View file

@ -89,7 +89,7 @@ struct ConnectionState {
// If this server is master, and this connection is from a secondary replica,
// then it holds positive sync session id.
uint32_t repl_session_id = 0;
uint32_t repl_flow_id = kuint32max;
uint32_t repl_flow_id = UINT32_MAX;
uint32_t repl_listening_port = 0;
};

View file

@ -20,6 +20,10 @@ using namespace util;
using namespace facade;
#ifdef USE_FB2
using Proactor = fb2::UringProactor;
using fb2::ProactorBase;
using fb2::SubmitEntry;
#else
using uring::Proactor;
using uring::SubmitEntry;

View file

@ -11,7 +11,6 @@
#include <filesystem>
#include "base/logging.h"
#include "util/uring/uring_file.h"
namespace dfly {
namespace journal {

View file

@ -769,7 +769,7 @@ error_code Replica::StartFullSyncFlow(BlockingCounter sb, Context* cntx) {
// We can not discard io_buf because it may contain data
// besides the response we parsed. Therefore we pass it further to ReplicateDFFb.
sync_fb_ = Fiber(&Replica::FullSyncDflyFb, this, move(eof_token), sb, cntx);
sync_fb_ = MakeFiber(&Replica::FullSyncDflyFb, this, move(eof_token), sb, cntx);
return error_code{};
}
@ -782,9 +782,9 @@ error_code Replica::StartStableSyncFlow(Context* cntx) {
CHECK(sock_->IsOpen());
// sock_.reset(mythread->CreateSocket());
// RETURN_ON_ERR(sock_->Connect(master_context_.master_ep));
sync_fb_ = Fiber(&Replica::StableSyncDflyReadFb, this, cntx);
sync_fb_ = MakeFiber(&Replica::StableSyncDflyReadFb, this, cntx);
if (use_multi_shard_exe_sync_) {
execution_fb_ = Fiber(&Replica::StableSyncDflyExecFb, this, cntx);
execution_fb_ = MakeFiber(&Replica::StableSyncDflyExecFb, this, cntx);
}
return std::error_code{};

View file

@ -1,4 +1,4 @@
// Copyright 2022, DragonflyDB authors. All rights reserved.
// Copyright 2023, DragonflyDB authors. All rights reserved.
// See LICENSE for licensing terms.
//
#pragma once
@ -6,6 +6,7 @@
#include <absl/container/flat_hash_map.h>
#include "core/external_alloc.h"
#include "core/fibers.h"
#include "server/common.h"
#include "server/io_mgr.h"
#include "server/table.h"

View file

@ -486,7 +486,7 @@ class Transaction {
DbIndex db_index_{0};
uint64_t time_now_ms_{0};
std::atomic<TxId> notify_txid_{kuint64max};
std::atomic<TxId> notify_txid_{UINT64_MAX};
std::atomic_uint32_t use_count_{0}, run_count_{0}, seqlock_{0};
// unique_shard_cnt_ and unique_shard_id_ are accessed only by coordinator thread.