From e039a8c8c23a6a3b2b9a5019de09f758a84c74ec Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 15 Oct 2010 15:43:06 -0700 Subject: UPdated the MySql driver to 6.2.4. Also established a much larger MySqlCommand timeout on fetching prims. --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'OpenSim') diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 3450e2f..e2b6953 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -424,6 +424,7 @@ namespace OpenSim.Data.MySQL cmd.CommandText = "SELECT * FROM prims LEFT JOIN primshapes ON prims.UUID = primshapes.UUID WHERE RegionUUID = ?RegionUUID"; cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); + cmd.CommandTimeout = 3600; using (IDataReader reader = ExecuteReader(cmd)) { -- cgit v1.1 From 1499607215aab4994f933a8ed2a54ed037a1f9ba Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 15 Oct 2010 17:27:19 -0700 Subject: Made OARs use the new serialization procedure. (TPs/crossings still on the old one) Added an options argument down the pipeline. For the time being it takes --old-guids as an option to produce instead of . --- .../RemoteController/RemoteAdminPlugin.cs | 2 +- OpenSim/Region/Application/OpenSim.cs | 5 +- .../World/Archiver/ArchiveWriteRequestExecution.cs | 7 +- .../Archiver/ArchiveWriteRequestPreparation.cs | 5 +- .../CoreModules/World/Archiver/ArchiverModule.cs | 27 ++- .../World/Serialiser/SerialiserModule.cs | 4 +- .../World/Serialiser/Tests/SerialiserTests.cs | 2 +- .../Framework/Interfaces/IRegionArchiverModule.cs | 5 +- .../Interfaces/IRegionSerialiserModule.cs | 2 +- .../Scenes/Serialization/SceneObjectSerializer.cs | 61 +++--- .../Scenes/Serialization/SceneXmlLoader.cs | 212 ++++++++++++--------- 11 files changed, 189 insertions(+), 143 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index bb0a5b5..aeed467 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -2284,7 +2284,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController if (archiver != null) { scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted; - archiver.ArchiveRegion(filename); + archiver.ArchiveRegion(filename, new Dictionary()); lock (m_saveOarLock) Monitor.Wait(m_saveOarLock,5000); scene.EventManager.OnOarFileSaved -= RemoteAdminOarSaveCompleted; } diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 7a0142f..0c6f476 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -264,10 +264,11 @@ namespace OpenSim LoadOar); m_console.Commands.AddCommand("region", false, "save oar", - "save oar []", + "save oar [--old-guids] []", "Save a region's data to an OAR archive.", "The OAR path must be a filesystem path." - + " If this is not given then the oar is saved to region.oar in the current directory.", + + " If this is not given then the oar is saved to region.oar in the current directory." + Environment.NewLine + + "--old-guids produces OARs compatible with older (pre 0.7.1) OpenSim versions.", SaveOar); m_console.Commands.AddCommand("region", false, "edit scale", diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index 586d98e..eb9688d 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -60,6 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver protected Scene m_scene; protected TarArchiveWriter m_archiveWriter; protected Guid m_requestId; + protected Dictionary m_options; public ArchiveWriteRequestExecution( List sceneObjects, @@ -67,7 +68,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver IRegionSerialiserModule serialiser, Scene scene, TarArchiveWriter archiveWriter, - Guid requestId) + Guid requestId, + Dictionary options) { m_sceneObjects = sceneObjects; m_terrainModule = terrainModule; @@ -75,6 +77,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_scene = scene; m_archiveWriter = archiveWriter; m_requestId = requestId; + m_options = options; } protected internal void ReceivedAllAssets( @@ -145,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver { //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); - string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject); + string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 283b33b..e9a476c 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -98,7 +98,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// Archive the region requested. /// /// if there was an io problem with creating the file - public void ArchiveRegion() + public void ArchiveRegion(Dictionary options) { Dictionary assetUuids = new Dictionary(); @@ -165,7 +165,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_scene.RequestModuleInterface(), m_scene, archiveWriter, - m_requestId); + m_requestId, + options); new AssetsRequest( new AssetsArchiver(archiveWriter), assetUuids, diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 82ede01..98bdcd0 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -122,37 +122,44 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// public void HandleSaveOarConsoleCommand(string module, string[] cmdparams) { + Dictionary options = new Dictionary(); + + OptionSet ops = new OptionSet(); + ops.Add("old|old-guids", delegate(string v) { options["old-guids"] = (v != null); }); + + List mainParams = ops.Parse(cmdparams); + if (cmdparams.Length > 2) { - ArchiveRegion(cmdparams[2]); + ArchiveRegion(mainParams[2], options); } else { - ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME); + ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, options); } } - public void ArchiveRegion(string savePath) + public void ArchiveRegion(string savePath, Dictionary options) { - ArchiveRegion(savePath, Guid.Empty); + ArchiveRegion(savePath, Guid.Empty, options); } - - public void ArchiveRegion(string savePath, Guid requestId) + + public void ArchiveRegion(string savePath, Guid requestId, Dictionary options) { m_log.InfoFormat( "[ARCHIVER]: Writing archive for region {0} to {1}", m_scene.RegionInfo.RegionName, savePath); - new ArchiveWriteRequestPreparation(m_scene, savePath, requestId).ArchiveRegion(); + new ArchiveWriteRequestPreparation(m_scene, savePath, requestId).ArchiveRegion(options); } - + public void ArchiveRegion(Stream saveStream) { ArchiveRegion(saveStream, Guid.Empty); } - + public void ArchiveRegion(Stream saveStream, Guid requestId) { - new ArchiveWriteRequestPreparation(m_scene, saveStream, requestId).ArchiveRegion(); + new ArchiveWriteRequestPreparation(m_scene, saveStream, requestId).ArchiveRegion(new Dictionary()); } public void DearchiveRegion(string loadPath) diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index 04062b0..ec97acd 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs @@ -160,9 +160,9 @@ namespace OpenSim.Region.CoreModules.World.Serialiser return SceneXmlLoader.DeserializeGroupFromXml2(xmlString); } - public string SerializeGroupToXml2(SceneObjectGroup grp) + public string SerializeGroupToXml2(SceneObjectGroup grp, Dictionary options) { - return SceneXmlLoader.SaveGroupToXml2(grp); + return SceneXmlLoader.SaveGroupToXml2(grp, options); } public void SavePrimListToXml2(EntityBase[] entityList, string fileName) diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index 799a448..49bd466 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -369,7 +369,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests // Need to add the object to the scene so that the request to get script state succeeds m_scene.AddSceneObject(so); - string xml2 = m_serialiserModule.SerializeGroupToXml2(so); + string xml2 = m_serialiserModule.SerializeGroupToXml2(so, new System.Collections.Generic.Dictionary()); XmlTextReader xtr = new XmlTextReader(new StringReader(xml2)); xtr.ReadStartElement("SceneObjectGroup"); diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs index 89e59d0..d8229de 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections.Generic; using System.IO; namespace OpenSim.Region.Framework.Interfaces @@ -46,7 +47,7 @@ namespace OpenSim.Region.Framework.Interfaces /// the EventManager.OnOarFileSaved event. /// /// - void ArchiveRegion(string savePath); + void ArchiveRegion(string savePath, Dictionary options); /// /// Archive the region to the given path @@ -57,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// If supplied, this request Id is later returned in the saved event - void ArchiveRegion(string savePath, Guid requestId); + void ArchiveRegion(string savePath, Guid requestId, Dictionary options); /// /// Archive the region to a stream. diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs index 18758c8..c5b21a8 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs @@ -117,6 +117,6 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - string SerializeGroupToXml2(SceneObjectGroup grp); + string SerializeGroupToXml2(SceneObjectGroup grp, Dictionary options); } } diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 6e3b15a..9a00bea 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1075,36 +1075,36 @@ namespace OpenSim.Region.Framework.Scenes.Serialization ////////// Write ///////// - public static void SOGToXml2(XmlTextWriter writer, SceneObjectGroup sog) + public static void SOGToXml2(XmlTextWriter writer, SceneObjectGroup sog, Dictionaryoptions) { writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty); - SOPToXml2(writer, sog.RootPart, null); + SOPToXml2(writer, sog.RootPart, null, options); writer.WriteStartElement(String.Empty, "OtherParts", String.Empty); sog.ForEachPart(delegate(SceneObjectPart sop) { if (sop.UUID != sog.RootPart.UUID) - SOPToXml2(writer, sop, sog.RootPart); + SOPToXml2(writer, sop, sog.RootPart, options); }); writer.WriteEndElement(); writer.WriteEndElement(); } - static void SOPToXml2(XmlTextWriter writer, SceneObjectPart sop, SceneObjectPart parent) + static void SOPToXml2(XmlTextWriter writer, SceneObjectPart sop, SceneObjectPart parent, Dictionary options) { writer.WriteStartElement("SceneObjectPart"); writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower()); - WriteUUID(writer, "CreatorID", sop.CreatorID); - WriteUUID(writer, "FolderID", sop.FolderID); + WriteUUID(writer, "CreatorID", sop.CreatorID, options); + WriteUUID(writer, "FolderID", sop.FolderID, options); writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); - WriteTaskInventory(writer, sop.TaskInventory); + WriteTaskInventory(writer, sop.TaskInventory, options); - WriteUUID(writer, "UUID", sop.UUID); + WriteUUID(writer, "UUID", sop.UUID, options); writer.WriteElementString("LocalId", sop.LocalId.ToString()); writer.WriteElementString("Name", sop.Name); writer.WriteElementString("Material", sop.Material.ToString()); @@ -1137,7 +1137,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("LinkNum", sop.LinkNum.ToString()); writer.WriteElementString("ClickAction", sop.ClickAction.ToString()); - WriteShape(writer, sop.Shape); + WriteShape(writer, sop.Shape, options); WriteVector(writer, "Scale", sop.Scale); writer.WriteElementString("UpdateFlag", sop.UpdateFlag.ToString()); @@ -1151,16 +1151,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("SalePrice", sop.SalePrice.ToString()); writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString()); writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString()); - WriteUUID(writer, "GroupID", sop.GroupID); - WriteUUID(writer, "OwnerID", sop.OwnerID); - WriteUUID(writer, "LastOwnerID", sop.LastOwnerID); + WriteUUID(writer, "GroupID", sop.GroupID, options); + WriteUUID(writer, "OwnerID", sop.OwnerID, options); + WriteUUID(writer, "LastOwnerID", sop.LastOwnerID, options); writer.WriteElementString("BaseMask", sop.BaseMask.ToString()); writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString()); writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString()); writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); writer.WriteElementString("Flags", sop.Flags.ToString()); - WriteUUID(writer, "CollisionSound", sop.CollisionSound); + WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); if (sop.MediaUrl != null) writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); @@ -1168,10 +1168,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteEndElement(); } - static void WriteUUID(XmlTextWriter writer, string name, UUID id) + static void WriteUUID(XmlTextWriter writer, string name, UUID id, Dictionary options) { writer.WriteStartElement(name); - writer.WriteElementString("UUID", id.ToString()); + if (options.ContainsKey("old-guids")) + writer.WriteElementString("Guid", id.ToString()); + else + writer.WriteElementString("UUID", id.ToString()); writer.WriteEndElement(); } @@ -1194,7 +1197,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteEndElement(); } - static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv) + static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options) { if (tinv.Count > 0) // otherwise skip this { @@ -1203,27 +1206,27 @@ namespace OpenSim.Region.Framework.Scenes.Serialization foreach (TaskInventoryItem item in tinv.Values) { writer.WriteStartElement("TaskInventoryItem"); - - WriteUUID(writer, "AssetID", item.AssetID); + + WriteUUID(writer, "AssetID", item.AssetID, options); writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); writer.WriteElementString("CreationDate", item.CreationDate.ToString()); - WriteUUID(writer, "CreatorID", item.CreatorID); + WriteUUID(writer, "CreatorID", item.CreatorID, options); writer.WriteElementString("Description", item.Description); writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); writer.WriteElementString("Flags", item.Flags.ToString()); - WriteUUID(writer, "GroupID", item.GroupID); + WriteUUID(writer, "GroupID", item.GroupID, options); writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString()); writer.WriteElementString("InvType", item.InvType.ToString()); - WriteUUID(writer, "ItemID", item.ItemID); - WriteUUID(writer, "OldItemID", item.OldItemID); - WriteUUID(writer, "LastOwnerID", item.LastOwnerID); + WriteUUID(writer, "ItemID", item.ItemID, options); + WriteUUID(writer, "OldItemID", item.OldItemID, options); + WriteUUID(writer, "LastOwnerID", item.LastOwnerID, options); writer.WriteElementString("Name", item.Name); writer.WriteElementString("NextPermissions", item.NextPermissions.ToString()); - WriteUUID(writer, "OwnerID", item.OwnerID); + WriteUUID(writer, "OwnerID", item.OwnerID, options); writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString()); - WriteUUID(writer, "ParentID", item.ParentID); - WriteUUID(writer, "ParentPartID", item.ParentPartID); - WriteUUID(writer, "PermsGranter", item.PermsGranter); + WriteUUID(writer, "ParentID", item.ParentID, options); + WriteUUID(writer, "ParentPartID", item.ParentPartID, options); + WriteUUID(writer, "PermsGranter", item.PermsGranter, options); writer.WriteElementString("PermsMask", item.PermsMask.ToString()); writer.WriteElementString("Type", item.Type.ToString()); @@ -1234,7 +1237,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp) + static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp, Dictionary options) { if (shp != null) { @@ -1283,7 +1286,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("ProfileShape", shp.ProfileShape.ToString()); writer.WriteElementString("HollowShape", shp.HollowShape.ToString()); - WriteUUID(writer, "SculptTexture", shp.SculptTexture); + WriteUUID(writer, "SculptTexture", shp.SculptTexture, options); writer.WriteElementString("SculptType", shp.SculptType.ToString()); writer.WriteStartElement("SculptData"); byte[] sd; diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index c6d4e55..d214eba 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -45,6 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + #region old xml format public static void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) { XmlDocument doc = new XmlDocument(); @@ -98,11 +99,128 @@ namespace OpenSim.Region.Framework.Scenes.Serialization file.Close(); } - public static string SaveGroupToXml2(SceneObjectGroup grp) + #endregion + + #region XML2 serialization + + // Called by archives (save oar) + public static string SaveGroupToXml2(SceneObjectGroup grp, Dictionary options) + { + //return SceneObjectSerializer.ToXml2Format(grp); + using (MemoryStream mem = new MemoryStream()) + { + using (XmlTextWriter writer = new XmlTextWriter(mem, System.Text.Encoding.UTF8)) + { + SceneObjectSerializer.SOGToXml2(writer, grp, options); + writer.Flush(); + + using (StreamReader reader = new StreamReader(mem)) + { + mem.Seek(0, SeekOrigin.Begin); + return reader.ReadToEnd(); + } + } + } + } + + // Called by scene serializer (save xml2) + public static void SavePrimsToXml2(Scene scene, string fileName) + { + EntityBase[] entityList = scene.GetEntities(); + SavePrimListToXml2(entityList, fileName); + } + + // Called by scene serializer (save xml2) + public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) + { + m_log.InfoFormat( + "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", + primName, scene.RegionInfo.RegionName, fileName); + + EntityBase[] entityList = scene.GetEntities(); + List primList = new List(); + + foreach (EntityBase ent in entityList) + { + if (ent is SceneObjectGroup) + { + if (ent.Name == primName) + { + primList.Add(ent); + } + } + } + + SavePrimListToXml2(primList.ToArray(), fileName); + } + + // Called by REST Application plugin + public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) + { + EntityBase[] entityList = scene.GetEntities(); + SavePrimListToXml2(entityList, stream, min, max); + } + + // Called here only. Should be private? + public static void SavePrimListToXml2(EntityBase[] entityList, string fileName) { - return SceneObjectSerializer.ToXml2Format(grp); + FileStream file = new FileStream(fileName, FileMode.Create); + try + { + StreamWriter stream = new StreamWriter(file); + try + { + SavePrimListToXml2(entityList, stream, Vector3.Zero, Vector3.Zero); + } + finally + { + stream.Close(); + } + } + finally + { + file.Close(); + } + } + + // Called here only. Should be private? + public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) + { + XmlTextWriter writer = new XmlTextWriter(stream); + + int primCount = 0; + stream.WriteLine("\n"); + + foreach (EntityBase ent in entityList) + { + if (ent is SceneObjectGroup) + { + SceneObjectGroup g = (SceneObjectGroup)ent; + if (!min.Equals(Vector3.Zero) || !max.Equals(Vector3.Zero)) + { + Vector3 pos = g.RootPart.GetWorldPosition(); + if (min.X > pos.X || min.Y > pos.Y || min.Z > pos.Z) + continue; + if (max.X < pos.X || max.Y < pos.Y || max.Z < pos.Z) + continue; + } + + //stream.WriteLine(SceneObjectSerializer.ToXml2Format(g)); + SceneObjectSerializer.SOGToXml2(writer, (SceneObjectGroup)ent, new Dictionary()); + stream.WriteLine(); + + primCount++; + } + } + + stream.WriteLine("\n"); + stream.Flush(); } + #endregion + + #region XML2 deserialization + public static SceneObjectGroup DeserializeGroupFromXml2(string xmlString) { XmlDocument doc = new XmlDocument(); @@ -222,94 +340,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - public static void SavePrimsToXml2(Scene scene, string fileName) - { - EntityBase[] entityList = scene.GetEntities(); - SavePrimListToXml2(entityList, fileName); - } - - public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) - { - EntityBase[] entityList = scene.GetEntities(); - SavePrimListToXml2(entityList, stream, min, max); - } - - public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) - { - m_log.InfoFormat( - "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", - primName, scene.RegionInfo.RegionName, fileName); - - EntityBase[] entityList = scene.GetEntities(); - List primList = new List(); - - foreach (EntityBase ent in entityList) - { - if (ent is SceneObjectGroup) - { - if (ent.Name == primName) - { - primList.Add(ent); - } - } - } - - SavePrimListToXml2(primList.ToArray(), fileName); - } - - public static void SavePrimListToXml2(EntityBase[] entityList, string fileName) - { - FileStream file = new FileStream(fileName, FileMode.Create); - try - { - StreamWriter stream = new StreamWriter(file); - try - { - SavePrimListToXml2(entityList, stream, Vector3.Zero, Vector3.Zero); - } - finally - { - stream.Close(); - } - } - finally - { - file.Close(); - } - } - - public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max) - { - XmlTextWriter writer = new XmlTextWriter(stream); - - int primCount = 0; - stream.WriteLine("\n"); - - foreach (EntityBase ent in entityList) - { - if (ent is SceneObjectGroup) - { - SceneObjectGroup g = (SceneObjectGroup)ent; - if (!min.Equals(Vector3.Zero) || !max.Equals(Vector3.Zero)) - { - Vector3 pos = g.RootPart.GetWorldPosition(); - if (min.X > pos.X || min.Y > pos.Y || min.Z > pos.Z) - continue; - if (max.X < pos.X || max.Y < pos.Y || max.Z < pos.Z) - continue; - } - - //stream.WriteLine(SceneObjectSerializer.ToXml2Format(g)); - SceneObjectSerializer.SOGToXml2(writer, (SceneObjectGroup)ent); - stream.WriteLine(); - - primCount++; - } - } - - stream.WriteLine("\n"); - stream.Flush(); - } - + #endregion } } -- cgit v1.1 From fe4e6ff81121bd3c5041fc3cdc6545548b192568 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Oct 2010 02:38:46 +0100 Subject: Fix test break - TestSerializeXml2() still requires old-guids option --- .../Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index 49bd466..bac7827 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -25,6 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System.Collections.Generic; +using System.IO; +using System.Xml; using log4net.Config; using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; @@ -34,8 +37,6 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Tests.Common; using OpenSim.Tests.Common.Setup; -using System.IO; -using System.Xml; namespace OpenSim.Region.CoreModules.World.Serialiser.Tests { @@ -369,7 +370,9 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests // Need to add the object to the scene so that the request to get script state succeeds m_scene.AddSceneObject(so); - string xml2 = m_serialiserModule.SerializeGroupToXml2(so, new System.Collections.Generic.Dictionary()); + Dictionary options = new Dictionary(); + options["old-guids"] = true; + string xml2 = m_serialiserModule.SerializeGroupToXml2(so, options); XmlTextReader xtr = new XmlTextReader(new StringReader(xml2)); xtr.ReadStartElement("SceneObjectGroup"); -- cgit v1.1 From 1bd4219078b48e0e69aca65908a127bc19ca5610 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Oct 2010 03:52:11 +0100 Subject: save oar control file first rather than in the middle so that it's the first thing we come accross on load this exposes a weekness with using tar where we don't control the order in which files are loaded. can't be helped for now --- .../World/Archiver/ArchiveWriteRequestExecution.cs | 37 +-------------------- .../Archiver/ArchiveWriteRequestPreparation.cs | 38 ++++++++++++++++++++++ .../World/Archiver/Tests/ArchiverTests.cs | 4 +-- 3 files changed, 41 insertions(+), 38 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index eb9688d..d1fe1f5 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -108,12 +108,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver // "[ARCHIVER]: Received {0} of {1} assets requested", // assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count); - m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); - - // Write out control file - m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile()); - m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); - // Write out region settings string settingsPath = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName); @@ -155,35 +149,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); } - /// - /// Create the control file for a 0.2 version archive - /// - /// - public static string Create0p2ControlFile() - { - StringWriter sw = new StringWriter(); - XmlTextWriter xtw = new XmlTextWriter(sw); - xtw.Formatting = Formatting.Indented; - xtw.WriteStartDocument(); - xtw.WriteStartElement("archive"); - xtw.WriteAttributeString("major_version", "0"); - xtw.WriteAttributeString("minor_version", "3"); - - xtw.WriteStartElement("creation_info"); - DateTime now = DateTime.UtcNow; - TimeSpan t = now - new DateTime(1970, 1, 1); - xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString()); - xtw.WriteElementString("id", UUID.Random().ToString()); - xtw.WriteEndElement(); - xtw.WriteEndElement(); - - xtw.Flush(); - xtw.Close(); - - String s = sw.ToString(); - sw.Close(); - - return s; - } + } } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index e9a476c..f867e50 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -32,6 +32,7 @@ using System.IO.Compression; using System.Reflection; using System.Text.RegularExpressions; using System.Threading; +using System.Xml; using log4net; using OpenMetaverse; using OpenSim.Framework; @@ -167,10 +168,47 @@ namespace OpenSim.Region.CoreModules.World.Archiver archiveWriter, m_requestId, options); + + m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); + + // Write out control file + archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile()); + m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); new AssetsRequest( new AssetsArchiver(archiveWriter), assetUuids, m_scene.AssetService, awre.ReceivedAllAssets).Execute(); } + + /// + /// Create the control file for a 0.2 version archive + /// + /// + public static string Create0p2ControlFile() + { + StringWriter sw = new StringWriter(); + XmlTextWriter xtw = new XmlTextWriter(sw); + xtw.Formatting = Formatting.Indented; + xtw.WriteStartDocument(); + xtw.WriteStartElement("archive"); + xtw.WriteAttributeString("major_version", "0"); + xtw.WriteAttributeString("minor_version", "3"); + + xtw.WriteStartElement("creation_info"); + DateTime now = DateTime.UtcNow; + TimeSpan t = now - new DateTime(1970, 1, 1); + xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString()); + xtw.WriteElementString("id", UUID.Random().ToString()); + xtw.WriteEndElement(); + xtw.WriteEndElement(); + + xtw.Flush(); + xtw.Close(); + + String s = sw.ToString(); + sw.Close(); + + return s; + } } } diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 3342164..b72cd02 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests // upset load tar.WriteDir(ArchiveConstants.TERRAINS_PATH); - tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); + tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile()); SceneObjectPart part1 = CreateSceneObjectPart1(); SceneObjectGroup object1 = new SceneObjectGroup(part1); @@ -329,7 +329,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); tar.WriteDir(ArchiveConstants.TERRAINS_PATH); - tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); + tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile()); RegionSettings rs = new RegionSettings(); rs.AgentLimit = 17; -- cgit v1.1 From 3df8d8ff7601f8dd1bc818ed2a13946fd0d9a91e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Oct 2010 04:59:51 +0100 Subject: Have OpenSim throw a strop if it tries to load an OAR with a major version that is too high for it to handle --- .../World/Archiver/ArchiveReadRequest.cs | 22 ++++++++++++++++++++++ .../Archiver/ArchiveWriteRequestPreparation.cs | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 6b538f6..f1f5258 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -51,6 +51,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver public class ArchiveReadRequest { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + /// + /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version + /// bumps here should be compatible. + /// + public static int MAX_MAJOR_VERSION = 0; protected Scene m_scene; protected Stream m_loadStream; @@ -497,6 +503,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver { if (xtr.NodeType == XmlNodeType.Element) { + if (xtr.Name.ToString() == "archive") + { + int majorVersion = int.Parse(xtr["major_version"]); + int minorVersion = int.Parse(xtr["minor_version"]); + string version = string.Format("{0}.{1}", majorVersion, minorVersion); + + if (majorVersion > MAX_MAJOR_VERSION) + { + throw new Exception( + string.Format( + "The OAR you are trying to load has major version number of {0} but this version of OpenSim can only load OARs with major version number {1} and below", + majorVersion, MAX_MAJOR_VERSION)); + } + + m_log.InfoFormat("[ARCHIVER]: Loading OAR with version {0}", version); + } if (xtr.Name.ToString() == "datetime") { int value; diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index f867e50..bae1bdd 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver } /// - /// Create the control file for a 0.2 version archive + /// Create the control file for the most up to date archive /// /// public static string Create0p2ControlFile() -- cgit v1.1 From e41b23a1a4bef55d31f75e1227834da84cbd971a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Oct 2010 05:38:44 +0100 Subject: change --old-guids switch on the save oar command line to --version= if x is 0, then an old version 0.3 archive is saved. If it is anything else or missing, then a version 1.0 archive is saved version 1.0 archives cannot be loaded on OpenSim 0.7.0.2 and earlier also add various informational notices about what version we've saving/loading --- OpenSim/Region/Application/OpenSim.cs | 4 ++-- .../World/Archiver/ArchiveReadRequest.cs | 2 +- .../World/Archiver/ArchiveWriteRequestExecution.cs | 6 ++++- .../Archiver/ArchiveWriteRequestPreparation.cs | 26 ++++++++++++++++++---- .../CoreModules/World/Archiver/ArchiverModule.cs | 2 +- .../World/Archiver/Tests/ArchiverTests.cs | 4 ++-- 6 files changed, 33 insertions(+), 11 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 0c6f476..66ffd76 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -264,11 +264,11 @@ namespace OpenSim LoadOar); m_console.Commands.AddCommand("region", false, "save oar", - "save oar [--old-guids] []", + "save oar [--version=] []", "Save a region's data to an OAR archive.", "The OAR path must be a filesystem path." + " If this is not given then the oar is saved to region.oar in the current directory." + Environment.NewLine - + "--old-guids produces OARs compatible with older (pre 0.7.1) OpenSim versions.", + + "--version=0 produces old version 0.3 OARs that are compatible with OpenSim 0.7.0.2 and earlier. Current OAR version is 1.0. This version of OpenSim can load any OAR later than version 0.3", SaveOar); m_console.Commands.AddCommand("region", false, "edit scale", diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index f1f5258..ae6e596 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version /// bumps here should be compatible. /// - public static int MAX_MAJOR_VERSION = 0; + public static int MAX_MAJOR_VERSION = 1; protected Scene m_scene; protected Stream m_loadStream; diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index d1fe1f5..79bec56 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -137,12 +137,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); + Dictionary serializationOptions = new Dictionary(); + if (m_options.ContainsKey("version") && (string)m_options["version"] == "0") + serializationOptions["old-guids"] = true; + // Write out scene object metadata foreach (SceneObjectGroup sceneObject in m_sceneObjects) { //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); - string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); + string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, serializationOptions); m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index bae1bdd..d21efed 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); // Write out control file - archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile()); + archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options)); m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); new AssetsRequest( @@ -184,15 +184,33 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// Create the control file for the most up to date archive /// /// - public static string Create0p2ControlFile() + public static string Create0p2ControlFile(Dictionary options) { + int majorVersion, minorVersion; + if (options.ContainsKey("version") && (string)options["version"] == "0") + { + majorVersion = 0; + minorVersion = 3; + } + else + { + majorVersion = 1; + minorVersion = 0; + } + + m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); + if (majorVersion == 1) + { + m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); + } + StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.Formatting = Formatting.Indented; xtw.WriteStartDocument(); xtw.WriteStartElement("archive"); - xtw.WriteAttributeString("major_version", "0"); - xtw.WriteAttributeString("minor_version", "3"); + xtw.WriteAttributeString("major_version", majorVersion.ToString()); + xtw.WriteAttributeString("minor_version", minorVersion.ToString()); xtw.WriteStartElement("creation_info"); DateTime now = DateTime.UtcNow; diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 98bdcd0..e0ad71e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver Dictionary options = new Dictionary(); OptionSet ops = new OptionSet(); - ops.Add("old|old-guids", delegate(string v) { options["old-guids"] = (v != null); }); + ops.Add("v|version=", delegate(string v) { options["version"] = v; }); List mainParams = ops.Parse(cmdparams); diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index b72cd02..04bdc4f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests // upset load tar.WriteDir(ArchiveConstants.TERRAINS_PATH); - tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile()); + tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile(new Dictionary())); SceneObjectPart part1 = CreateSceneObjectPart1(); SceneObjectGroup object1 = new SceneObjectGroup(part1); @@ -329,7 +329,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); tar.WriteDir(ArchiveConstants.TERRAINS_PATH); - tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile()); + tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile(new Dictionary())); RegionSettings rs = new RegionSettings(); rs.AgentLimit = 17; -- cgit v1.1 From edc31adf954276f00e272d1de9d162c3940ec62b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Oct 2010 07:09:13 +0100 Subject: Rip out version option since it turns out that the changed object serialization format can actually be loaded by older OpenSims after all This bumps the OAR version to 0.4 instead, signalling some change but with backwards compatability... for now. --- OpenSim/Region/Application/OpenSim.cs | 5 ++--- .../World/Archiver/ArchiveWriteRequestExecution.cs | 4 ++-- .../World/Archiver/ArchiveWriteRequestPreparation.cs | 14 +++++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 66ffd76..7a0142f 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -264,11 +264,10 @@ namespace OpenSim LoadOar); m_console.Commands.AddCommand("region", false, "save oar", - "save oar [--version=] []", + "save oar []", "Save a region's data to an OAR archive.", "The OAR path must be a filesystem path." - + " If this is not given then the oar is saved to region.oar in the current directory." + Environment.NewLine - + "--version=0 produces old version 0.3 OARs that are compatible with OpenSim 0.7.0.2 and earlier. Current OAR version is 1.0. This version of OpenSim can load any OAR later than version 0.3", + + " If this is not given then the oar is saved to region.oar in the current directory.", SaveOar); m_console.Commands.AddCommand("region", false, "edit scale", diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index 79bec56..c062833 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -138,8 +138,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); Dictionary serializationOptions = new Dictionary(); - if (m_options.ContainsKey("version") && (string)m_options["version"] == "0") - serializationOptions["old-guids"] = true; +// if (m_options.ContainsKey("version") && (string)m_options["version"] == "0") +// serializationOptions["old-guids"] = true; // Write out scene object metadata foreach (SceneObjectGroup sceneObject in m_sceneObjects) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index d21efed..43789af 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -186,7 +186,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// public static string Create0p2ControlFile(Dictionary options) { - int majorVersion, minorVersion; + int majorVersion = 0, minorVersion = 4; + + /* if (options.ContainsKey("version") && (string)options["version"] == "0") { majorVersion = 0; @@ -197,12 +199,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver majorVersion = 1; minorVersion = 0; } + */ m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); - if (majorVersion == 1) - { - m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); - } +// if (majorVersion == 1) +// { +// m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); +// } + StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); -- cgit v1.1 From 06d37d06e6aa6eae313fb7bf186f3e0c7e66b115 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 16 Oct 2010 07:25:55 +0100 Subject: Drop max oar loading version back to 0 from 1 --- OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index ae6e596..f1f5258 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version /// bumps here should be compatible. /// - public static int MAX_MAJOR_VERSION = 1; + public static int MAX_MAJOR_VERSION = 0; protected Scene m_scene; protected Stream m_loadStream; -- cgit v1.1