fix: prevents Dragonfly from blocking in epoll during snapshotting (#3911)

The problem - we used file write in non-direct mode when writing snapshots in epoll mode.
As a result - lots of data was cached into OS memory. But then during the rename operation,
when we rename "xxx.dfs.tmp" into "xxx.dfs", the OS flushes the file caches and the thread
is stuck in OS system call rename for a long time.

The fix - to use DIRECT mode and to avoid caching the data into OS caches at all.
Fixes #3895

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2024-10-12 18:26:12 +03:00 committed by GitHub
parent ba57145c53
commit 4012ad1855
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 5 deletions

View file

@ -62,7 +62,6 @@ extern "C" {
#include "strings/human_readable.h"
#include "util/accept_server.h"
#include "util/aws/aws.h"
#include "util/fibers/fiber_file.h"
using namespace std;
@ -1654,6 +1653,7 @@ GenericError ServerFamily::WaitUntilSaveFinished(Transaction* trans, bool ignore
save_controller_->WaitAllSnapshots();
detail::SaveInfo save_info;
VLOG(1) << "Before WaitUntilSaveFinished::Finalize";
{
util::fb2::LockGuard lk(save_mu_);
save_info = save_controller_->Finalize();