private FileGroup DiscoverLogFileGroup(smo::Database smodb, FileGroup fg) { if (fg == null) { fg = new FileGroup(this); } fg.Name = "LOG"; fg.FileGroupName = "LOG"; fg.FileGroupType = FileGroupType.Log; fg.AllocationType = FileGroupAllocationType.CrossVolume; fg.LayoutType = FileGroupLayoutType.Monolithic; fg.DiskVolumeType = DiskVolumeType.Log; fg.FileCount = 0; // TODO: check this to be one file/volume fg.DeploymentState = Registry.DeploymentState.Deployed; fg.RunningState = Registry.RunningState.Running; // Calculate log size fg.AllocatedSpace = 0; foreach (var smolf in smodb.LogFiles.Cast <smo::LogFile>()) { fg.AllocatedSpace += (long)Math.Ceiling(smolf.Size * 0x400L); // given in KB, bug in docs! } fg.AllocatedSpace = Math.Max(0x1000000L, fg.AllocatedSpace); // 16 MB minimum return(fg); }
/// <summary> /// Creates a deep copy of the passed object. /// </summary> /// <param name="old">A <b>File Group</b> object to create the deep copy from.</param> private void CopyMembers(FileGroup old) { this.fileGroupType = old.fileGroupType; this.layoutType = old.layoutType; this.allocationType = old.allocationType; this.diskVolumeType = old.diskVolumeType; this.fileGroupName = old.fileGroupName; this.allocatedSpace = old.allocatedSpace; this.fileCount = old.fileCount; }
private FileGroup DiscoverFileGroup(smo::FileGroup smofg, FileGroup fg) { if (fg == null) { fg = new FileGroup(this); } fg.Name = smofg.Name; fg.FileGroupName = smofg.Name; fg.FileGroupType = FileGroupType.Data; fg.AllocationType = FileGroupAllocationType.CrossVolume; fg.LayoutType = FileGroupLayoutType.Monolithic; fg.DiskVolumeType = DiskVolumeType.Data; fg.FileCount = 0; // TODO: check this to be one file/volume fg.DeploymentState = Registry.DeploymentState.Deployed; fg.RunningState = Registry.RunningState.Running; fg.AllocatedSpace = (long)Math.Ceiling(smofg.Size * 0x400L); // given in KB, bug in docs! fg.AllocatedSpace = Math.Max(0x1000000L, fg.AllocatedSpace); // 16 MB minimum return fg; }
private FileGroup DiscoverFileGroup(smo::FileGroup smofg, FileGroup fg) { if (fg == null) { fg = new FileGroup(this); } fg.Name = smofg.Name; fg.FileGroupName = smofg.Name; fg.FileGroupType = FileGroupType.Data; fg.AllocationType = FileGroupAllocationType.CrossVolume; fg.LayoutType = FileGroupLayoutType.Monolithic; fg.DiskVolumeType = DiskVolumeType.Data; fg.FileCount = 0; // TODO: check this to be one file/volume fg.DeploymentState = Registry.DeploymentState.Deployed; fg.RunningState = Registry.RunningState.Running; fg.AllocatedSpace = (long)Math.Ceiling(smofg.Size * 0x400L); // given in KB, bug in docs! fg.AllocatedSpace = Math.Max(0x1000000L, fg.AllocatedSpace); // 16 MB minimum return(fg); }
/// <summary> /// Initializes a database definition. /// </summary> /// <param name="serverVersion"></param> public void GenerateDefaultChildren(ServerVersion serverVersion, string databaseVersionName) { // If not sliced, then create a default slice of FULL if (databaseDefinition.LayoutType == DatabaseLayoutType.Mirrored || databaseDefinition.LayoutType == DatabaseLayoutType.Monolithic) { Slice sl = new Slice(databaseDefinition) { Name = Constants.FullSliceName, System = databaseDefinition.System, }; sl.Save(); } else { throw new InvalidOperationException(); // Use slicing wizard instead } // Add primary filegroup FileGroupLayoutType fglayout; switch (databaseDefinition.LayoutType) { case DatabaseLayoutType.Sliced: fglayout = FileGroupLayoutType.Sliced; break; case DatabaseLayoutType.Monolithic: case DatabaseLayoutType.Mirrored: fglayout = FileGroupLayoutType.Monolithic; break; default: throw new NotImplementedException(); } FileGroup fg = new FileGroup(databaseDefinition) { Name = Constants.PrimaryFileGroupName, System = databaseDefinition.System, FileGroupType = FileGroupType.Data, LayoutType = fglayout, AllocationType = FileGroupAllocationType.CrossVolume, DiskVolumeType = DiskVolumeType.Data, FileGroupName = Constants.PrimaryFileGroupName, AllocatedSpace = Constants.PrimaryFileGroupSize, FileCount = 0, }; fg.Save(); // Add "log" file group fg = new FileGroup(databaseDefinition) { Name = Constants.LogFileGroupName, System = databaseDefinition.System, FileGroupType = FileGroupType.Log, LayoutType = FileGroupLayoutType.Monolithic, AllocationType = FileGroupAllocationType.CrossVolume, DiskVolumeType = DiskVolumeType.Log, FileGroupName = Constants.LogFileGroupName, AllocatedSpace = Constants.LogFileGroupSize, FileCount = 0 }; fg.Save(); // Create default database version DatabaseVersion dv = new DatabaseVersion(databaseDefinition) { Name = databaseVersionName, System = databaseDefinition.System, ServerVersion = serverVersion, SizeMultiplier = 1.0f, }; dv.Save(); }
/// <summary> /// Copy contructor for doing deep copy of the <b>File Group</b> objects. /// </summary> /// <param name="old">The <b>File Group</b> to copy from.</param> public FileGroup(FileGroup old) : base(old) { CopyMembers(old); }
/// <summary> /// Creates a deep copy of the passed object. /// </summary> /// <param name="old">A <b>File Group</b> object to create the deep copy from.</param> private void CopyMembers(FileGroup old) { this.fileGroupType = old.fileGroupType; this.layoutType = old.layoutType; this.allocationType = old.allocationType; this.diskVolumeType = old.diskVolumeType; this.fileGroupName = old.fileGroupName; this.allocatedSpace = old.allocatedSpace; this.fileCount = old.fileCount; }
private FileGroup DiscoverLogFileGroup(smo::Database smodb, FileGroup fg) { if (fg == null) { fg = new FileGroup(this); } fg.Name = "LOG"; fg.FileGroupName = "LOG"; fg.FileGroupType = FileGroupType.Log; fg.AllocationType = FileGroupAllocationType.CrossVolume; fg.LayoutType = FileGroupLayoutType.Monolithic; fg.DiskVolumeType = DiskVolumeType.Log; fg.FileCount = 0; // TODO: check this to be one file/volume fg.DeploymentState = Registry.DeploymentState.Deployed; fg.RunningState = Registry.RunningState.Running; // Calculate log size fg.AllocatedSpace = 0; foreach (var smolf in smodb.LogFiles.Cast<smo::LogFile>()) { fg.AllocatedSpace += (long)Math.Ceiling(smolf.Size * 0x400L); // given in KB, bug in docs! } fg.AllocatedSpace = Math.Max(0x1000000L, fg.AllocatedSpace); // 16 MB minimum return fg; }
/// <summary> /// Copy contructor for doing deep copy of the <b>File Group</b> objects. /// </summary> /// <param name="old">The <b>File Group</b> to copy from.</param> public FileGroup(FileGroup old) : base(old) { CopyMembers(old); }