summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-02-20 22:10:39 +0100
committerGitHub <noreply@github.com>2021-02-20 22:10:39 +0100
commit90ac17a86fbdc132a1db7ff32204a66666e1f98e (patch)
tree3292a82a6c6e634143a7106bec54355209be5af2 /vespalib
parent1779c14a8733fabc22c51f0b281b6e5519db9d28 (diff)
parent29fa3fc49fe3a05b111aa12200d081b1bdf01efe (diff)
Merge pull request #16604 from vespa-engine/toregge/remove-old-swap-files
Remove old swap files when setting up mmap file allocator.
Diffstat (limited to 'vespalib')
-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>