aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-08-28 22:50:18 +0200
committerRiccardo Spagni <ric@spagni.net>2016-08-28 22:50:18 +0200
commitf5b802e6849c952c4a5f9585b202d2a1bfd75f71 (patch)
tree81c24710558f60b0a0e07710893e87f777a7cfbc /src/cryptonote_core
parentMerge pull request #997 (diff)
parentChange default db-sync-mode to fast, not fastest (diff)
downloadmonero-f5b802e6849c952c4a5f9585b202d2a1bfd75f71.tar.xz
Merge pull request #999
dc411ea Change default db-sync-mode to fast, not fastest (Howard Chu)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 511f50616..73edde1b7 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -289,20 +289,23 @@ namespace cryptonote
catch (...) { }
BlockchainDB* db = nullptr;
- uint64_t BDB_FAST_MODE = 0;
- uint64_t BDB_FASTEST_MODE = 0;
- uint64_t BDB_SAFE_MODE = 0;
+ uint64_t DBS_FAST_MODE = 0;
+ uint64_t DBS_FASTEST_MODE = 0;
+ uint64_t DBS_SAFE_MODE = 0;
if (db_type == "lmdb")
{
db = new BlockchainLMDB();
+ DBS_SAFE_MODE = MDB_NORDAHEAD;
+ DBS_FAST_MODE = MDB_NORDAHEAD | MDB_NOSYNC;
+ DBS_FASTEST_MODE = MDB_NORDAHEAD | MDB_NOSYNC | MDB_WRITEMAP | MDB_MAPASYNC;
}
else if (db_type == "berkeley")
{
#if defined(BERKELEY_DB)
db = new BlockchainBDB();
- BDB_FAST_MODE = DB_TXN_WRITE_NOSYNC;
- BDB_FASTEST_MODE = DB_TXN_NOSYNC;
- BDB_SAFE_MODE = DB_TXN_SYNC;
+ DBS_FAST_MODE = DB_TXN_WRITE_NOSYNC;
+ DBS_FASTEST_MODE = DB_TXN_NOSYNC;
+ DBS_SAFE_MODE = DB_TXN_SYNC;
#else
LOG_ERROR("BerkeleyDB support disabled.");
return false;
@@ -325,7 +328,6 @@ namespace cryptonote
try
{
uint64_t db_flags = 0;
- bool islmdb = db_type == "lmdb";
std::vector<std::string> options;
boost::trim(db_sync_mode);
@@ -334,9 +336,8 @@ namespace cryptonote
for(const auto &option : options)
LOG_PRINT_L0("option: " << option);
- // temporarily default to fastest:async:1000
- uint64_t DEFAULT_FLAGS = islmdb ? MDB_WRITEMAP | MDB_MAPASYNC | MDB_NORDAHEAD | MDB_NOMETASYNC | MDB_NOSYNC :
- BDB_FASTEST_MODE;
+ // default to fast:async:1000
+ uint64_t DEFAULT_FLAGS = DBS_FAST_MODE;
if(options.size() == 0)
{
@@ -350,13 +351,13 @@ namespace cryptonote
if(options[0] == "safe")
{
safemode = true;
- db_flags = islmdb ? MDB_NORDAHEAD : BDB_SAFE_MODE;
+ db_flags = DBS_SAFE_MODE;
sync_mode = db_nosync;
}
else if(options[0] == "fast")
- db_flags = islmdb ? MDB_NOMETASYNC | MDB_NOSYNC | MDB_NORDAHEAD : BDB_FAST_MODE;
+ db_flags = DBS_FAST_MODE;
else if(options[0] == "fastest")
- db_flags = islmdb ? MDB_WRITEMAP | MDB_MAPASYNC | MDB_NORDAHEAD | MDB_NOMETASYNC | MDB_NOSYNC : BDB_FASTEST_MODE;
+ db_flags = DBS_FASTEST_MODE;
else
db_flags = DEFAULT_FLAGS;
}