From c1bdd22274511d255faf670fb001bc604c8a986f Mon Sep 17 00:00:00 2001 From: AliciaRaven Date: Wed, 4 Jun 2014 15:15:09 +0100 Subject: Fix AutoBackupModule and include option to skip saving assets. Signed-off-by: Michael Cerquoni --- .../World/AutoBackup/AutoBackupModule.cs | 35 ++++++++++++++++++++-- .../World/AutoBackup/AutoBackupModuleState.cs | 7 +++++ 2 files changed, 39 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World/AutoBackup') diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs index 1d35c54..bbb77ad 100644 --- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs +++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs @@ -76,6 +76,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup /// AutoBackupBusyCheck: True/False. Default: True. /// If True, we will only take an auto-backup if a set of conditions are met. /// These conditions are heuristics to try and avoid taking a backup when the sim is busy. + /// AutoBackupSkipAssets + /// If true, assets are not saved to the oar file. Considerably reduces impact on simulator when backing up. Intended for when assets db is backed up separately /// AutoBackupScript: String. Default: not specified (disabled). /// File path to an executable script or binary to run when an automatic backup is taken. /// The file should really be (Windows) an .exe or .bat, or (Linux/Mac) a shell script or binary. @@ -258,6 +260,8 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup AutoBackupModuleState abms = this.ParseConfig(scene, false); m_log.Debug("[AUTO BACKUP]: Config for " + scene.RegionInfo.RegionName); m_log.Debug((abms == null ? "DEFAULT" : abms.ToString())); + + m_states.Add(scene, abms); } /// @@ -334,7 +338,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup double interval = this.ResolveDouble("AutoBackupInterval", this.m_defaultState.IntervalMinutes, config, regionConfig) * 60000.0; - if (state == null && interval != this.m_defaultState.IntervalMinutes*60000.0) + if (state == null && interval != this.m_defaultState.IntervalMinutes * 60000.0) { state = new AutoBackupModuleState(); } @@ -412,6 +416,19 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup state.BusyCheck = tmpBusyCheck; } + // Included Option To Skip Assets + bool tmpSkipAssets = ResolveBoolean("AutoBackupSkipAssets", + this.m_defaultState.SkipAssets, config, regionConfig); + if (state == null && tmpSkipAssets != this.m_defaultState.SkipAssets) + { + state = new AutoBackupModuleState(); + } + + if (state != null) + { + state.SkipAssets = tmpSkipAssets; + } + // Set file naming algorithm string stmpNamingType = ResolveString("AutoBackupNaming", this.m_defaultState.NamingType.ToString(), config, regionConfig); @@ -488,6 +505,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup } } + if(state == null) + return m_defaultState; + return state; } @@ -640,7 +660,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup /// private void DoRegionBackup(IScene scene) { - if (scene.RegionStatus != RegionStatus.Up) + if (!scene.Ready) { // We won't backup a region that isn't operating normally. m_log.Warn("[AUTO BACKUP]: Not backing up region " + scene.RegionInfo.RegionName + @@ -662,7 +682,16 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup m_pendingSaves.Add(guid, scene); state.LiveRequests.Add(guid, savePath); ((Scene) scene).EventManager.OnOarFileSaved += new EventManager.OarFileSaved(EventManager_OnOarFileSaved); - iram.ArchiveRegion(savePath, guid, null); + + m_log.Info("[AUTO BACKUP]: Backing up region " + scene.RegionInfo.RegionName); + + // Must pass options, even if dictionary is empty! + Dictionary options = new Dictionary(); + + if (state.SkipAssets) + options["noassets"] = true; + + iram.ArchiveRegion(savePath, guid, options); } /// diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs index f9e118b..ade25a5 100644 --- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs +++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModuleState.cs @@ -45,6 +45,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup this.Enabled = false; this.BackupDir = "."; this.BusyCheck = true; + this.SkipAssets = false; this.Timer = null; this.NamingType = NamingType.Time; this.Script = null; @@ -91,6 +92,12 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup set; } + public bool SkipAssets + { + get; + set; + } + public string Script { get; -- cgit v1.1