mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 09:55:45 +02:00
chore: Refactor string span management (#3165)
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
This commit is contained in:
parent
6291c04016
commit
e45c1e92a2
23 changed files with 198 additions and 273 deletions
|
@ -257,10 +257,9 @@ void Transaction::PrepareMultiFps(CmdArgList keys) {
|
|||
auto& tag_fps = multi_->tag_fps;
|
||||
|
||||
tag_fps.reserve(keys.size());
|
||||
for (MutableSlice key : keys) {
|
||||
string_view sv = facade::ToSV(key);
|
||||
ShardId sid = Shard(sv, shard_set->size());
|
||||
tag_fps.emplace(sid, LockTag(sv).Fingerprint());
|
||||
for (string_view str : ArgS(keys)) {
|
||||
ShardId sid = Shard(str, shard_set->size());
|
||||
tag_fps.emplace(sid, LockTag(str).Fingerprint());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1213,7 +1212,8 @@ OpStatus Transaction::WaitOnWatch(const time_point& tp, WaitKeysProvider wkeys_p
|
|||
return result;
|
||||
}
|
||||
|
||||
OpStatus Transaction::WatchInShard(const ShardArgs& keys, EngineShard* shard, KeyReadyChecker krc) {
|
||||
OpStatus Transaction::WatchInShard(BlockingController::Keys keys, EngineShard* shard,
|
||||
KeyReadyChecker krc) {
|
||||
auto& sd = shard_data_[SidToId(shard->shard_id())];
|
||||
|
||||
CHECK_EQ(0, sd.local_mask & SUSPENDED_Q);
|
||||
|
@ -1221,12 +1221,12 @@ OpStatus Transaction::WatchInShard(const ShardArgs& keys, EngineShard* shard, Ke
|
|||
sd.local_mask &= ~OUT_OF_ORDER;
|
||||
|
||||
shard->EnsureBlockingController()->AddWatched(keys, std::move(krc), this);
|
||||
DVLOG(2) << "WatchInShard " << DebugId() << ", first_key:" << keys.Front();
|
||||
DVLOG(2) << "WatchInShard " << DebugId();
|
||||
|
||||
return OpStatus::OK;
|
||||
}
|
||||
|
||||
void Transaction::ExpireShardCb(const ShardArgs& wkeys, EngineShard* shard) {
|
||||
void Transaction::ExpireShardCb(BlockingController::Keys keys, EngineShard* shard) {
|
||||
// Blocking transactions don't release keys when suspending, release them now.
|
||||
auto lock_args = GetLockArgs(shard->shard_id());
|
||||
shard->db_slice().Release(LockMode(), lock_args);
|
||||
|
@ -1234,7 +1234,7 @@ void Transaction::ExpireShardCb(const ShardArgs& wkeys, EngineShard* shard) {
|
|||
auto& sd = shard_data_[SidToId(shard->shard_id())];
|
||||
sd.local_mask &= ~KEYLOCK_ACQUIRED;
|
||||
|
||||
shard->blocking_controller()->FinalizeWatched(wkeys, this);
|
||||
shard->blocking_controller()->FinalizeWatched(keys, this);
|
||||
DCHECK(!shard->blocking_controller()->awakened_transactions().contains(this));
|
||||
|
||||
// Resume processing of transaction queue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue