mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
fix(rdb): Remove transaction from pre/post load search index rebuild (#2419)
This commit is contained in:
parent
de817098a7
commit
1fb3c74933
3 changed files with 3 additions and 24 deletions
|
@ -2495,10 +2495,9 @@ void RdbLoader::PerformPreLoad(Service* service) {
|
||||||
if (cmd == nullptr)
|
if (cmd == nullptr)
|
||||||
return; // MacOS
|
return; // MacOS
|
||||||
|
|
||||||
Transaction::RunOnceAsCommand(cmd, [](auto* trans, auto* es) {
|
shard_set->AwaitRunningOnShardQueue([](EngineShard* es) {
|
||||||
for (const auto& name : es->search_indices()->GetIndexNames())
|
for (const auto& name : es->search_indices()->GetIndexNames())
|
||||||
es->search_indices()->DropIndex(name);
|
es->search_indices()->DropIndex(name);
|
||||||
return OpStatus::OK;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2508,9 +2507,8 @@ void RdbLoader::PerformPostLoad(Service* service) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Rebuild all search indices as only their definitions are extracted from the snapshot
|
// Rebuild all search indices as only their definitions are extracted from the snapshot
|
||||||
Transaction::RunOnceAsCommand(cmd, [](auto* trans, auto* es) {
|
shard_set->AwaitRunningOnShardQueue([](EngineShard* es) {
|
||||||
es->search_indices()->RebuildAllIndices(trans->GetOpArgs(es));
|
es->search_indices()->RebuildAllIndices(OpArgs{es, nullptr, DbContext{0, GetCurrentTimeMs()}});
|
||||||
return OpStatus::OK;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1522,22 +1522,6 @@ void Transaction::FinishLogJournalOnShard(EngineShard* shard, uint32_t shard_cnt
|
||||||
unique_slot_checker_.GetUniqueSlotId(), {}, false);
|
unique_slot_checker_.GetUniqueSlotId(), {}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::RunOnceAsCommand(const CommandId* cid, RunnableType cb) {
|
|
||||||
if (!ProactorBase::IsProactorThread())
|
|
||||||
return shard_set->pool()->at(0)->Await([cid, cb] { return RunOnceAsCommand(cid, cb); });
|
|
||||||
|
|
||||||
DCHECK(cid);
|
|
||||||
DCHECK(cid->opt_mask() & (CO::GLOBAL_TRANS | CO::NO_KEY_TRANSACTIONAL));
|
|
||||||
DCHECK(ProactorBase::IsProactorThread());
|
|
||||||
|
|
||||||
boost::intrusive_ptr<Transaction> trans{new Transaction{cid}};
|
|
||||||
trans->InitByArgs(0, {});
|
|
||||||
trans->ScheduleSingleHop([cb](auto* trans, auto* es) {
|
|
||||||
cb(trans, es);
|
|
||||||
return OpStatus::OK;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void Transaction::CancelBlocking(std::function<OpStatus(ArgSlice)> status_cb) {
|
void Transaction::CancelBlocking(std::function<OpStatus(ArgSlice)> status_cb) {
|
||||||
if ((coordinator_state_ & COORD_BLOCKED) == 0)
|
if ((coordinator_state_ & COORD_BLOCKED) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -348,9 +348,6 @@ class Transaction {
|
||||||
bool multi_commands, bool allow_await) const;
|
bool multi_commands, bool allow_await) const;
|
||||||
void FinishLogJournalOnShard(EngineShard* shard, uint32_t shard_cnt) const;
|
void FinishLogJournalOnShard(EngineShard* shard, uint32_t shard_cnt) const;
|
||||||
|
|
||||||
// Utility to run a single hop on a no-key command
|
|
||||||
static void RunOnceAsCommand(const CommandId* cid, RunnableType cb);
|
|
||||||
|
|
||||||
void Refurbish();
|
void Refurbish();
|
||||||
|
|
||||||
void IterateMultiLocks(ShardId sid, std::function<void(const std::string&)> cb) const;
|
void IterateMultiLocks(ShardId sid, std::function<void(const std::string&)> cb) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue