Add configurable PRAGMA synchronous =

master
proller 2013-09-17 02:09:28 +04:00
parent d308352dbd
commit 4c704fe306
3 changed files with 13 additions and 1 deletions

View File

@ -279,6 +279,8 @@
#max_objects_per_block = 49 #max_objects_per_block = 49
# Interval of saving important changes in the world # Interval of saving important changes in the world
#server_map_save_interval = 5.3 #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. # 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. # This determines how long they are slowed down after placing or removing a node.
#full_block_send_enable_min_time_from_building = 2.0 #full_block_send_enable_min_time_from_building = 2.0

View File

@ -109,6 +109,15 @@ void Database_SQLite3::verifyDatabase() {
if(needs_create) if(needs_create)
createDatabase(); 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: "
<<sqlite3_errmsg(m_database)<<std::endl;
throw FileNotGoodException("Cannot set pragma");
}
d = sqlite3_prepare(m_database, "SELECT `data` FROM `blocks` WHERE `pos`=? LIMIT 1", -1, &m_database_read, NULL); d = sqlite3_prepare(m_database, "SELECT `data` FROM `blocks` WHERE `pos`=? LIMIT 1", -1, &m_database_read, NULL);
if(d != SQLITE_OK) { if(d != SQLITE_OK) {
infostream<<"WARNING: SQLite3 database read statment failed to prepare: "<<sqlite3_errmsg(m_database)<<std::endl; infostream<<"WARNING: SQLite3 database read statment failed to prepare: "<<sqlite3_errmsg(m_database)<<std::endl;

View File

@ -191,6 +191,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("server_unload_unused_data_timeout", "29"); settings->setDefault("server_unload_unused_data_timeout", "29");
settings->setDefault("max_objects_per_block", "49"); settings->setDefault("max_objects_per_block", "49");
settings->setDefault("server_map_save_interval", "5.3"); 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("full_block_send_enable_min_time_from_building", "2.0");
settings->setDefault("dedicated_server_step", "0.1"); settings->setDefault("dedicated_server_step", "0.1");
settings->setDefault("ignore_world_load_errors", "false"); settings->setDefault("ignore_world_load_errors", "false");