aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2021-02-20 15:50:25 +0100
committerTor Egge <Tor.Egge@broadpark.no>2021-02-20 15:50:25 +0100
commit29fa3fc49fe3a05b111aa12200d081b1bdf01efe (patch)
tree2e1903eb3f2469720efa23bec34b5b3a3e9b3c4a
parentca844003a8e06f69847bc4c14015b176c162bb47 (diff)
Remove old swap files when setting up mmap file allocator.
-rw-r--r--vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.cpp b/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.cpp
index a575c08309d..89dc825282c 100644
--- a/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.cpp
+++ b/vespalib/src/vespa/vespalib/util/mmap_file_allocator_factory.cpp
@@ -2,6 +2,7 @@
#include "mmap_file_allocator_factory.h"
#include "mmap_file_allocator.h"
+#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/stllike/asciistream.h>
namespace vespalib::alloc {
@@ -21,6 +22,9 @@ MmapFileAllocatorFactory::setup(const vespalib::string& dir_name)
{
_dir_name = dir_name;
_generation = 0;
+ if (!_dir_name.empty()) {
+ rmdir(_dir_name, true);
+ }
}
std::unique_ptr<MemoryAllocator>