From 520a05ac41b69263b5fa3ac3a43ac77a9d759bbc Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Thu, 2 Feb 2006 21:15:16 +0000 Subject: [PATCH] continue on EOVERFLOW, use fdatasync every now and then --- lib/base/filepush.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/base/filepush.cpp b/lib/base/filepush.cpp index a955e10b..705dbb5e 100644 --- a/lib/base/filepush.cpp +++ b/lib/base/filepush.cpp @@ -27,6 +27,8 @@ void eFilePushThread::thread() off_t current_span_offset = 0; size_t current_span_remaining = 0; + size_t written_since_last_sync = 0; + int already_empty = 0; eDebug("FILEPUSH THREAD START"); // this is a race. FIXME. @@ -59,8 +61,16 @@ void eFilePushThread::thread() /* this should flush all written pages to disk. */ posix_fadvise(m_fd_dest, dest_pos, w, POSIX_FADV_DONTNEED); - + dest_pos += w; + written_since_last_sync += w; + + if (written_since_last_sync >= 512*1024) + { + fdatasync(m_fd_dest); + written_since_last_sync = 0; + } + // printf("FILEPUSH: wrote %d bytes\n", w); m_buf_start += w; continue; @@ -94,7 +104,12 @@ void eFilePushThread::thread() m_buf_end = 0; if (errno == EINTR) continue; - eDebug("eFilePushThread *read error* - not yet handled"); + if (errno == EOVERFLOW) + { + eWarning("OVERFLOW while recording"); + continue; + } + eDebug("eFilePushThread *read error* (%m) - not yet handled"); } if (m_buf_end == 0) { -- 2.30.2