From 4c704fe30673eecad0903683fae627b7226c92d6 Mon Sep 17 00:00:00 2001 From: proller Date: Tue, 17 Sep 2013 02:09:28 +0400 Subject: [PATCH] Add configurable PRAGMA synchronous = --- minetest.conf.example | 2 ++ src/database-sqlite3.cpp | 11 ++++++++++- src/defaultsettings.cpp | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/minetest.conf.example b/minetest.conf.example index b876ecab..8094100e 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -279,6 +279,8 @@ #max_objects_per_block = 49 # Interval of saving important changes in the world #server_map_save_interval = 5.3 +# http://www.sqlite.org/pragma.html#pragma_synchronous only numeric values: 0 1 2 +#sqlite_synchronous = 2 # To reduce lag, block transfers are slowed down when a player is building something. # This determines how long they are slowed down after placing or removing a node. #full_block_send_enable_min_time_from_building = 2.0 diff --git a/src/database-sqlite3.cpp b/src/database-sqlite3.cpp index 17484d48..9714d103 100644 --- a/src/database-sqlite3.cpp +++ b/src/database-sqlite3.cpp @@ -108,7 +108,16 @@ void Database_SQLite3::verifyDatabase() { if(needs_create) createDatabase(); - + + std::string querystr = std::string("PRAGMA synchronous = ") + + itos(g_settings->getU16("sqlite_synchronous")); + d = sqlite3_exec(m_database, querystr.c_str(), NULL, NULL, NULL); + if(d != SQLITE_OK) { + infostream<<"WARNING: Database pragma set failed: " + <setDefault("server_unload_unused_data_timeout", "29"); settings->setDefault("max_objects_per_block", "49"); settings->setDefault("server_map_save_interval", "5.3"); + settings->setDefault("sqlite_synchronous", "2"); settings->setDefault("full_block_send_enable_min_time_from_building", "2.0"); settings->setDefault("dedicated_server_step", "0.1"); settings->setDefault("ignore_world_load_errors", "false");