From 7ddf183da4854a4c9f56906b0cdc64badf97660f Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 28 May 2008 15:02:04 +0000 Subject: [PATCH] remove terrain bloat, only keep last terrain revision for mysql. For active terraformers this should return a lot of database space. --- OpenSim/Data/MySQL/MySQLDataStore.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/MySQLDataStore.cs b/OpenSim/Data/MySQL/MySQLDataStore.cs index 7ee625da42..9a44fbd3ac 100644 --- a/OpenSim/Data/MySQL/MySQLDataStore.cs +++ b/OpenSim/Data/MySQL/MySQLDataStore.cs @@ -442,15 +442,19 @@ namespace OpenSim.Data.MySQL public void StoreTerrain(double[,] ter, LLUUID regionID) { - int revision = Util.UnixTimeSinceEpoch(); + int revision = 1; m_log.Info("[REGION DB]: Storing terrain revision r" + revision.ToString()); lock (m_dataSet) { + MySqlCommand delete = new MySqlCommand("delete from terrain where RegionUUID=?RegionUUID", m_connection); MySqlCommand cmd = new MySqlCommand("insert into terrain(RegionUUID, Revision, Heightfield)" + " values(?RegionUUID, ?Revision, ?Heightfield)", m_connection); using (cmd) { + delete.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); + delete.ExecuteNonQuery(); + cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); cmd.Parameters.Add(new MySqlParameter("?Revision", revision)); cmd.Parameters.Add(new MySqlParameter("?Heightfield", serializeTerrain(ter)));