From 7a3b0830e1dfc7a8869e5fd6d11d0683e3ddaf16 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Wed, 21 Dec 2016 20:00:32 +0900 Subject: [PATCH] Make all storage use fsync Hopefully costs little and increases robustness. Closes #75 --- server/storage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/storage.py b/server/storage.py index 3c6ff6e..b7d28fc 100644 --- a/server/storage.py +++ b/server/storage.py @@ -87,7 +87,8 @@ class LevelDB(Storage): self.get = self.db.get self.put = self.db.put self.iterator = self.db.iterator - self.write_batch = partial(self.db.write_batch, transaction=True) + self.write_batch = partial(self.db.write_batch, transaction=True, + sync=True) class RocksDB(Storage): @@ -105,6 +106,7 @@ class RocksDB(Storage): compression + "_compression") options = self.module.Options(create_if_missing=create, compression=compression, + use_fsync=True, target_file_size_base=33554432, max_open_files=mof) self.db = self.module.DB(name, options)