Skip to content

Commit

Permalink
Archiver::flushMutex_ as recursive_mutex to protect catalogue evictio…
Browse files Browse the repository at this point in the history
…n from cache
  • Loading branch information
danovaro committed Jan 1, 2025
1 parent 92e37c7 commit 8b3afcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/fdb5/database/Archiver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void Archiver::archive(const Key& key, const void* data, size_t len) {

void Archiver::archive(const Key& key, BaseArchiveVisitor& visitor) {

std::lock_guard<std::mutex> lock(flushMutex_);
std::lock_guard<std::recursive_mutex> lock(flushMutex_);
visitor.rule(nullptr);

dbConfig_.schema().expand(key, visitor);
Expand All @@ -58,7 +58,7 @@ void Archiver::archive(const Key& key, BaseArchiveVisitor& visitor) {
}

void Archiver::flush() {
std::lock_guard<std::mutex> lock(flushMutex_);
std::lock_guard<std::recursive_mutex> lock(flushMutex_);
for (auto i = databases_.begin(); i != databases_.end(); ++i) {
// flush the store, pass the number of flushed fields to the catalogue
i->second.catalogue_->flush(i->second.store_->flush());
Expand Down Expand Up @@ -92,7 +92,7 @@ void Archiver::selectDatabase(const Key& dbKey) {
}
if (found) {
// flushing before evicting from cache
std::lock_guard<std::mutex> lock(flushMutex_);
std::lock_guard<std::recursive_mutex> lock(flushMutex_);

databases_[oldK].catalogue_->flush(databases_[oldK].store_->flush());

Expand Down
2 changes: 1 addition & 1 deletion src/fdb5/database/Archiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Archiver : public eckit::NonCopyable {

Database* db_;

std::mutex flushMutex_;
std::recursive_mutex flushMutex_;
std::mutex cacheMutex_;
const ArchiveCallback& callback_;
};
Expand Down

0 comments on commit 8b3afcb

Please sign in to comment.