Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5292315ed4 |
+1
-1
@@ -34,7 +34,7 @@ std::vector<IoRingJob> IoRing::jobsToProc(int maxJobs) {
|
||||
if (toProc > iod) {
|
||||
toProc = iod;
|
||||
} else if (toProc < iod && timeout.count()) {
|
||||
auto now = SteadyClock::now();
|
||||
auto now = lastCheck_ = SteadyClock::now();
|
||||
if (!lastCheck_) { // first time to find the (not enough) ios, wait till timeout
|
||||
lastCheck_ = now;
|
||||
break;
|
||||
|
||||
@@ -53,12 +53,13 @@ CoTryTask<SetChainTableRsp> SetChainTableOperation::handle(MgmtdState &state) {
|
||||
const auto &m = ctit->second;
|
||||
XLOGF_IF(FATAL, m.empty(), "{} has no versions", tableId);
|
||||
const auto ¤t = m.rbegin()->second;
|
||||
if (newChainTable.chains != current.chains) {
|
||||
newChainTable.chainTableVersion = nextVersion(current.chainTableVersion);
|
||||
}
|
||||
if (newChainTable.desc.empty()) {
|
||||
newChainTable.desc = current.desc;
|
||||
}
|
||||
if (newChainTable.chains != current.chains || newChainTable.desc != current.desc) {
|
||||
newChainTable.chainTableVersion = nextVersion(current.chainTableVersion);
|
||||
} else {
|
||||
if (newChainTable == current) {
|
||||
// same as the latest version, do not add new version
|
||||
co_return SetChainTableRsp::create(current.chainTableVersion);
|
||||
}
|
||||
|
||||
@@ -155,9 +155,8 @@ CoTask<IOResult> ReliableForwarding::doForward(const UpdateReq &req,
|
||||
updateReq.options.commitChainVer = target.vChainId.chainVer;
|
||||
}
|
||||
|
||||
bool readForSyncing = isSyncing && !req.payload.isRemove() &&
|
||||
(req.options.isSyncing || req.payload.isTruncate() || req.payload.isExtend() ||
|
||||
(req.payload.isWrite() && req.payload.length != req.payload.chunkSize));
|
||||
bool readForSyncing = req.payload.isWriteTruncateExtend() && isSyncing &&
|
||||
(req.options.isSyncing || req.payload.length != req.payload.chunkSize);
|
||||
if (readForSyncing) {
|
||||
auto recordGuard = syncingReadRecorder.record();
|
||||
|
||||
|
||||
@@ -349,11 +349,6 @@ CoTask<IOResult> StorageOperator::handleUpdate(ServiceRequestContext &requestCtx
|
||||
XLOG(ERR, msg);
|
||||
co_return makeError(StatusCode::kInvalidArg, std::move(msg));
|
||||
}
|
||||
if (req.options.isSyncing && (req.payload.isTruncate() || req.payload.isExtend())) {
|
||||
auto msg = fmt::format("reject truncate/extend request from syncing client: {}", req);
|
||||
XLOG(ERR, msg);
|
||||
co_return makeError(StatusCode::kInvalidArg, std::move(msg));
|
||||
}
|
||||
|
||||
XLOGF(DBG1, "Start the replication process, target: {}, tag: {}, req: {}", target->targetId, req.tag, req);
|
||||
|
||||
|
||||
@@ -626,61 +626,4 @@ TEST_F(MgmtdOperatorTest, testSetNodeTags) {
|
||||
};
|
||||
folly::coro::blockingWait(f());
|
||||
}
|
||||
|
||||
TEST_F(MgmtdOperatorTest, testSetChainTableVersionMonotonicity) {
|
||||
folly::coro::blockingWait([&]() -> CoTask<void> {
|
||||
MgmtdOperator mgmtd(env_, defaultConfig_);
|
||||
co_await MgmtdTestHelper(mgmtd).extendLease();
|
||||
|
||||
// Prepare two Chains
|
||||
co_await MgmtdTestHelper(mgmtd).setRoutingInfo([](flat::RoutingInfo &ri) {
|
||||
for (auto cid : {flat::ChainId(1), flat::ChainId(2)}) {
|
||||
flat::ChainInfo chain;
|
||||
chain.chainId = cid;
|
||||
chain.chainVersion = flat::ChainVersion(1);
|
||||
flat::ChainTargetInfo cti;
|
||||
cti.targetId = flat::TargetId(100 + (uint32_t)cid);
|
||||
cti.publicState = flat::PublicTargetState::SERVING;
|
||||
chain.targets.push_back(cti);
|
||||
ri.chains[cid] = chain;
|
||||
}
|
||||
});
|
||||
|
||||
// Step 1: upload ChainTable, with version 1
|
||||
{
|
||||
mgmtd::SetChainTableReq req;
|
||||
req.clusterId = "clusterId";
|
||||
req.chainTableId = flat::ChainTableId(1);
|
||||
req.chains = {flat::ChainId(1)};
|
||||
req.desc = "old_desc";
|
||||
auto ret = co_await mgmtd.setChainTable(req, {});
|
||||
CO_ASSERT_OK(ret);
|
||||
CO_ASSERT_EQ(ret->chainTableVersion, flat::ChainTableVersion(1));
|
||||
}
|
||||
|
||||
// Step 2: update chains of ChainTable, increase version to 2
|
||||
{
|
||||
mgmtd::SetChainTableReq req;
|
||||
req.clusterId = "clusterId";
|
||||
req.chainTableId = flat::ChainTableId(1);
|
||||
req.chains = {flat::ChainId(1), flat::ChainId(2)};
|
||||
req.desc = "old_desc";
|
||||
auto ret = co_await mgmtd.setChainTable(req, {});
|
||||
CO_ASSERT_OK(ret);
|
||||
CO_ASSERT_EQ(ret->chainTableVersion, flat::ChainTableVersion(2));
|
||||
}
|
||||
|
||||
// Step 3: update desc of ChainTable, the version should be 3
|
||||
{
|
||||
mgmtd::SetChainTableReq req;
|
||||
req.clusterId = "clusterId";
|
||||
req.chainTableId = flat::ChainTableId(1);
|
||||
req.chains = {flat::ChainId(1), flat::ChainId(2)}; // keep same
|
||||
req.desc = "new_desc"; // only desc changed
|
||||
auto ret = co_await mgmtd.setChainTable(req, {});
|
||||
CO_ASSERT_OK(ret);
|
||||
CO_ASSERT_EQ(ret->chainTableVersion, flat::ChainTableVersion(3));
|
||||
}
|
||||
}());
|
||||
}
|
||||
} // namespace hf3fs::mgmtd::testing
|
||||
|
||||
Reference in New Issue
Block a user