chore: add more logs to the op_manager code (#4527)

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2025-01-29 19:08:41 +02:00 committed by GitHub
parent ffce1cb796
commit fc94b2c265
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 1 deletions

View file

@ -171,7 +171,7 @@ jobs:
run: |
cd ${GITHUB_WORKSPACE}/build
echo Run ctest -V -L DFLY
GLOG_alsologtostderr=1 GLOG_vmodule=rdb_load=1,rdb_save=1,snapshot=1 \
GLOG_alsologtostderr=1 GLOG_vmodule=rdb_load=1,rdb_save=1,snapshot=1,op_manager=1,op_manager_test=1 \
FLAGS_fiber_safety_margin=4096 FLAGS_list_experimental_v2=true timeout 20m ctest -V -L DFLY
echo "Running tests with --force_epoll"

View file

@ -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

View file

@ -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();
}
}

View file

@ -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);