mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
chore: add more logs to the op_manager code (#4527)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
ffce1cb796
commit
fc94b2c265
4 changed files with 19 additions and 1 deletions
|
@ -42,6 +42,10 @@ struct DiskSegment {
|
|||
}
|
||||
|
||||
size_t offset = 0, length = 0;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& os, const DiskSegment& ds) {
|
||||
return os << "[" << ds.offset << ", " << ds.length << "]";
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace dfly::tiering
|
||||
|
|
|
@ -28,6 +28,16 @@ OpManager::EntryId Borrowed(const OpManager::OwnedEntryId& id) {
|
|||
return std::visit([](const auto& v) -> OpManager::EntryId { return v; }, id);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const OpManager::EntryId& id) {
|
||||
if (const auto* i = std::get_if<unsigned>(&id); i) {
|
||||
return os << *i;
|
||||
} else {
|
||||
const auto& key = std::get<OpManager::KeyRef>(id);
|
||||
return os << "(" << key.first << ':' << key.second << ")";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
OpManager::OpManager(size_t max_size) : storage_{max_size} {
|
||||
|
@ -115,7 +125,10 @@ void OpManager::ProcessStashed(EntryId id, unsigned version,
|
|||
NotifyStashed(id, segment);
|
||||
} else if (segment) {
|
||||
// Throw away the value because it's no longer up-to-date even if no error occured
|
||||
VLOG(1) << "Releasing segment " << *segment << ", id: " << id;
|
||||
storage_.MarkAsFree(*segment);
|
||||
} else {
|
||||
LOG(ERROR) << "Stash failed with error " << segment.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ struct OpManagerTest : PoolTestBase, OpManager {
|
|||
}
|
||||
|
||||
void NotifyStashed(EntryId id, const io::Result<DiskSegment>& segment) override {
|
||||
VLOG(1) << std::get<0>(id) << " stashed";
|
||||
ASSERT_TRUE(segment);
|
||||
auto [it, inserted] = stashed_.emplace(id, *segment);
|
||||
ASSERT_TRUE(inserted);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue