From 98f82105a08d7f317fd2f1f14c438d3d7e3c920f Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 19 Nov 2007 22:59:28 +0000 Subject: [PATCH] put in changes to only keep the last terrain revision. The current unbounded model causes performance and filesystem filling grief. Before enabling this again, we need a reasonable bounding model. --- .../MonoSqliteDataStore.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs index fc6f59c1ef..b00b7343dd 100644 --- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs +++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs @@ -280,6 +280,20 @@ namespace OpenSim.DataStore.MonoSqlite cmd.Parameters.Add(new SqliteParameter(":Heightfield", serializeTerrain(ter))); cmd.ExecuteNonQuery(); } + + // This is added to get rid of the infinitely growing + // terrain databases which negatively impact on SQLite + // over time. Before reenabling this feature there + // needs to be a limitter put on the number of + // revisions in the database, as this old + // implementation is a DOS attack waiting to happen. + + using(SqliteCommand cmd = new SqliteCommand("delete from terrain where RegionUUID=:RegionUUID and Revision < :Revision", conn)) + { + cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":Revision", revision)); + cmd.ExecuteNonQuery(); + } conn.Close(); } }