private static ByteQuantifiedSize GetMaxLogDirectorySizeOrDefault() { ulong value = RegistryReader.Instance.GetValue <ulong>(Registry.LocalMachine, "SOFTWARE\\Microsoft\\ExchangeServer\\v15\\Inference\\ActivityLogging", "MaxLogDirectorySizeInMB", ActivityLoggingConfig.MaxLogDirectorySizeDefault.ToMB()); return(ByteQuantifiedSize.FromMB(value)); }
public LocalDatabaseSoftDeletedCleanupRequest(DirectoryIdentity databaseIdentity, ByteQuantifiedSize targetSize, LoadBalanceAnchorContext context) { this.databaseIdentity = databaseIdentity; this.targetSize = targetSize; this.context = context; }
protected override void ValidateWrite(List <ValidationError> errors) { base.ValidateWrite(errors); if (this.CalendarItemRetrievalOption == CalendarItemRetrievalOptions.Custom && this.OwaServerUrl == null) { errors.Add(new PropertyValidationError(DirectoryStrings.ExArgumentNullException(PopImapAdConfigurationSchema.OwaServerUrl.Name), PopImapAdConfigurationSchema.OwaServerUrl, this.OwaServerUrl)); } if (!string.IsNullOrEmpty(this.X509CertificateName) && !PopImapAdConfiguration.IsValidProtocolCertificate(this.X509CertificateName)) { errors.Add(new PropertyValidationError(DirectoryStrings.InvalidCertificateName(this.X509CertificateName), PopImapAdConfigurationSchema.X509CertificateName, this.X509CertificateName)); } if (!this.LogPerFileSizeQuota.IsUnlimited && this.LogPerFileSizeQuota.Value > ByteQuantifiedSize.Zero && this.LogPerFileSizeQuota.Value < ByteQuantifiedSize.FromMB(1UL)) { errors.Add(new PropertyValidationError(DirectoryStrings.ExArgumentOutOfRangeException(PopImapAdConfigurationSchema.LogPerFileSizeQuota.Name, this.LogPerFileSizeQuota), PopImapAdConfigurationSchema.LogPerFileSizeQuota, this.LogPerFileSizeQuota)); } }
protected virtual IBatchSizeReducer GetFactorBasedBatchSizeReducer(ByteQuantifiedSize maximumSize, ByteQuantifiedSize totalSize, ILogger logger) { double weightReductionFactor = maximumSize.ToMB() / totalSize.ToMB(); return(this.CreateFactorBasedReducer(logger, weightReductionFactor)); }
public SearchMailboxesResults Search(ISearchPolicy policy, SearchMailboxesInputs input) { long num = 0L; long num2 = 0L; long num3 = 0L; long num4 = 0L; long num5 = 0L; long num6 = 0L; ulong num7 = 0UL; SortedResultPage resultPage = null; MultiMailboxSearchClient multiMailboxSearchClient = null; ResultAggregator resultAggregator = new ResultAggregator(); ByteQuantifiedSize byteQuantifiedSize = new ByteQuantifiedSize(0UL); List <MailboxStatistics> list = new List <MailboxStatistics>(); Dictionary <Guid, List <KeyValuePair <int, long> > > dictionary = new Dictionary <Guid, List <KeyValuePair <int, long> > >(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Recorder.Record record = policy.Recorder.Start("SearchResultProvider", TraceType.InfoTrace, true); Recorder.Trace(5L, TraceType.InfoTrace, new object[] { "FastLocalSearchResultsProvider.Search Input:", input, "Type:", input.SearchType }); SearchMailboxesResults result; try { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search Initializing"); num3 = stopwatch.ElapsedMilliseconds; string str = (input.PagingInfo != null && input.PagingInfo.SortBy != null && input.PagingInfo.SortBy.SortOrder == SortOrder.Ascending) ? "+" : "-"; string str2 = (input.PagingInfo != null && input.PagingInfo.SortValue != null && input.PagingInfo.SortValue.SortColumn == ItemSchema.DocumentId) ? "[docid]" : FastIndexSystemSchema.Received.Name; AdditionalParameters additionalParameters = new AdditionalParameters { Sort = str + str2, Refiners = new string[] { FastIndexSystemSchema.Size.Name } }; long referenceDocId = 0L; PaginationQueryFilter pagingFilter = null; QueryFilter queryFilter = input.Criteria.Query; if (input.PagingInfo != null && input.PagingInfo.SortValue != null) { referenceDocId = input.PagingInfo.SortValue.SecondarySortValue; if (input.PagingInfo.SortValue.SortColumnValue != null && input.PagingInfo.SortValue.SortColumn != ItemSchema.DocumentId) { pagingFilter = new PaginationQueryFilter(input.PagingInfo); } } SearchSource searchSource = input.Sources.FirstOrDefault <SearchSource>(); if (searchSource != null) { Guid guid = searchSource.MailboxInfo.IsArchive ? searchSource.MailboxInfo.ArchiveDatabase : searchSource.MailboxInfo.MdbGuid; string displayName = FlowDescriptor.GetImsFlowDescriptor(FastLocalSearchResultsProvider.SearchConfig, FastIndexVersion.GetIndexSystemName(guid)).DisplayName; num4 += stopwatch.ElapsedMilliseconds - num3; num3 = stopwatch.ElapsedMilliseconds; Recorder.Trace(5L, TraceType.InfoTrace, new object[] { "FastLocalSearchResultsProvider.Search Initialized DB:", guid, "Flow:", displayName }); List <SearchSource> list2 = new List <SearchSource>(input.Sources); while (list2.Count > 0) { HashSet <Guid> hashSet = new HashSet <Guid>(); List <SearchSource> list3 = new List <SearchSource>(); int i = 0; while (i < list2.Count) { SearchSource searchSource2 = list2[i]; Guid item = searchSource2.MailboxInfo.IsArchive ? searchSource2.MailboxInfo.ArchiveGuid : searchSource2.MailboxInfo.MailboxGuid; if (!hashSet.Contains(item)) { list3.Add(searchSource2); list2.RemoveAt(i); hashSet.Add(item); } else { i++; } } multiMailboxSearchClient = new MultiMailboxSearchClient(guid, (from s in list3 select s.MailboxInfo).ToArray <MailboxInfo>(), input.Criteria, input.CallerInfo, input.PagingInfo); foreach (SearchSource searchSource3 in list3) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search Searching Source", searchSource3); ulong num8 = 0UL; bool flag = false; MailboxStatistics mailboxStatistics = null; ByteQuantifiedSize byteQuantifiedSize2 = new ByteQuantifiedSize(0UL); List <KeyValuePair <int, long> > list4 = new List <KeyValuePair <int, long> >(); Guid guid2 = searchSource3.MailboxInfo.IsArchive ? searchSource3.MailboxInfo.ArchiveGuid : searchSource3.MailboxInfo.MailboxGuid; queryFilter = this.ApplyFolderFilter(queryFilter, searchSource3.MailboxInfo, multiMailboxSearchClient); string text = FqlQueryBuilder.ToFqlString(queryFilter, input.Criteria.QueryCulture); text = this.ApplyPagingFilter(text, referenceDocId, pagingFilter, input.PagingInfo, input.Criteria.QueryCulture); Recorder.Trace(5L, TraceType.InfoTrace, new object[] { "FastLocalSearchResultsProvider.Search Searching Source Guid:", guid2, "Filter:", queryFilter, "Query:", text }); num6 += stopwatch.ElapsedMilliseconds - num3; num3 = stopwatch.ElapsedMilliseconds; IEnumerable <KeyValuePair <PagingImsFlowExecutor.QueryExecutionContext, SearchResultItem[]> > enumerable = FastLocalSearchResultsProvider.FlowExecutor.Execute(displayName, guid2, policy.CallerInfo.QueryCorrelationId, text, 0L, input.Criteria.QueryCulture, additionalParameters, Math.Min(FastLocalSearchResultsProvider.SearchConfig.FastQueryResultTrimHits, input.PagingInfo.PageSize), null); foreach (KeyValuePair <PagingImsFlowExecutor.QueryExecutionContext, SearchResultItem[]> keyValuePair in enumerable) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search found pages"); PagingImsFlowExecutor.QueryExecutionContext key = keyValuePair.Key; ISearchResultItem[] value = keyValuePair.Value; if (!flag) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search found statistics"); num8 += (ulong)FastLocalSearchResultsProvider.FlowExecutor.ReadHitCount(key); IEnumerable <RefinerResult> source = FastLocalSearchResultsProvider.FlowExecutor.ReadRefiners(key); RefinerResult refinerResult = source.FirstOrDefault((RefinerResult t) => t.Name == FastIndexSystemSchema.Size.Name); if (refinerResult != null) { byteQuantifiedSize2 += new ByteQuantifiedSize((ulong)refinerResult.Sum); } mailboxStatistics = new MailboxStatistics(searchSource3.MailboxInfo, num8, byteQuantifiedSize2); flag = true; } foreach (ISearchResultItem searchResultItem in value) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search found items"); IFieldHolder fieldHolder = searchResultItem.Fields.FirstOrDefault((IFieldHolder f) => string.Equals(f.Name, "DocId", StringComparison.InvariantCultureIgnoreCase)); if (fieldHolder != null) { long num9 = (long)fieldHolder.Value; int documentId = IndexId.GetDocumentId(num9); IndexId.GetMailboxNumber(num9); list4.Add(new KeyValuePair <int, long>(documentId, num9)); } } if (list4.Count >= input.PagingInfo.PageSize) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search completed FAST"); break; } } num7 += num8; byteQuantifiedSize += byteQuantifiedSize2; if (list4.Count > 0) { dictionary[guid2] = list4; } if (mailboxStatistics != null) { list.Add(mailboxStatistics); } num += stopwatch.ElapsedMilliseconds - num3; num3 = stopwatch.ElapsedMilliseconds; } if (dictionary.Count > 0) { Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search loading preview items"); resultPage = multiMailboxSearchClient.FetchPreviewProperties(dictionary); num2 += stopwatch.ElapsedMilliseconds - num3; num3 = stopwatch.ElapsedMilliseconds; } Recorder.Trace(5L, TraceType.InfoTrace, "FastLocalSearchResultsProvider.Search aggregating"); ISearchResult aggregator = new AggregatedSearchTaskResult(new MailboxInfoList(multiMailboxSearchClient.Mailboxes), resultPage, null, num7, byteQuantifiedSize, null, list, null); resultAggregator.MergeSearchResult(aggregator); num5 += stopwatch.ElapsedMilliseconds - num3; num3 = stopwatch.ElapsedMilliseconds; } } result = new SearchMailboxesResults(input.Sources) { SearchResult = resultAggregator }; } finally { record.Attributes["FAST"] = num; record.Attributes["STORE"] = num2; record.Attributes["REST"] = num6; record.Attributes["INIT"] = num4; record.Attributes["AGGR"] = num5; record.Attributes["TOTALSIZE"] = byteQuantifiedSize; record.Attributes["TOTALCNT"] = num7; policy.Recorder.End(record); } return(result); }
internal override ExchangeMailboxStatistics GetMailboxStatisticsInternal(string id) { ExchangeLog.LogStart("GetMailboxStatisticsInternal"); ExchangeLog.DebugInfo("Account: {0}", id); ExchangeMailboxStatistics info = new ExchangeMailboxStatistics(); Runspace runSpace = null; try { runSpace = OpenRunspace(); Collection <PSObject> result = GetMailboxObject(runSpace, id); PSObject mailbox = result[0]; string dn = GetResultObjectDN(result); string path = AddADPrefix(dn); DirectoryEntry entry = GetADObject(path); info.Enabled = !(bool)entry.InvokeGet("AccountDisabled"); info.LitigationHoldEnabled = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled"); info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName"); SmtpAddress smtpAddress = (SmtpAddress)GetPSObjectProperty(mailbox, "PrimarySmtpAddress"); if (smtpAddress != null) { info.PrimaryEmailAddress = smtpAddress.ToString(); } info.MaxSize = ConvertUnlimitedToBytes((Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "ProhibitSendReceiveQuota")); info.LitigationHoldMaxSize = ConvertUnlimitedToBytes((Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "RecoverableItemsQuota")); DateTime?whenCreated = (DateTime?)GetPSObjectProperty(mailbox, "WhenCreated"); info.AccountCreated = ConvertNullableToDateTime(whenCreated); //Client Access Command cmd = new Command("Get-CASMailbox"); cmd.Parameters.Add("Identity", id); result = ExecuteShellCommand(runSpace, cmd); mailbox = result[0]; info.ActiveSyncEnabled = (bool)GetPSObjectProperty(mailbox, "ActiveSyncEnabled"); info.OWAEnabled = (bool)GetPSObjectProperty(mailbox, "OWAEnabled"); info.MAPIEnabled = (bool)GetPSObjectProperty(mailbox, "MAPIEnabled"); info.POPEnabled = (bool)GetPSObjectProperty(mailbox, "PopEnabled"); info.IMAPEnabled = (bool)GetPSObjectProperty(mailbox, "ImapEnabled"); //Statistics cmd = new Command("Get-MailboxStatistics"); cmd.Parameters.Add("Identity", id); result = ExecuteShellCommand(runSpace, cmd); if (result.Count > 0) { PSObject statistics = result[0]; Unlimited <ByteQuantifiedSize> totalItemSize = (Unlimited <ByteQuantifiedSize>)GetPSObjectProperty(statistics, "TotalItemSize"); info.TotalSize = ConvertUnlimitedToBytes(totalItemSize); uint?itemCount = (uint?)GetPSObjectProperty(statistics, "ItemCount"); info.TotalItems = ConvertNullableToInt32(itemCount); DateTime?lastLogoffTime = (DateTime?)GetPSObjectProperty(statistics, "LastLogoffTime"); DateTime?lastLogonTime = (DateTime?)GetPSObjectProperty(statistics, "LastLogonTime"); info.LastLogoff = ConvertNullableToDateTime(lastLogoffTime); info.LastLogon = ConvertNullableToDateTime(lastLogonTime); } else { info.TotalSize = 0; info.TotalItems = 0; info.LastLogoff = DateTime.MinValue; info.LastLogon = DateTime.MinValue; } if (info.LitigationHoldEnabled) { cmd = new Command("Get-MailboxFolderStatistics"); cmd.Parameters.Add("FolderScope", "RecoverableItems"); cmd.Parameters.Add("Identity", id); result = ExecuteShellCommand(runSpace, cmd); if (result.Count > 0) { PSObject statistics = result[0]; ByteQuantifiedSize totalItemSize = (ByteQuantifiedSize)GetPSObjectProperty(statistics, "FolderAndSubfolderSize"); info.LitigationHoldTotalSize = (totalItemSize == null) ? 0 : ConvertUnlimitedToBytes(totalItemSize); Int32 itemCount = (Int32)GetPSObjectProperty(statistics, "ItemsInFolder"); info.LitigationHoldTotalItems = (itemCount == 0) ? 0 : itemCount; } } else { info.LitigationHoldTotalSize = 0; info.LitigationHoldTotalItems = 0; } } finally { CloseRunspace(runSpace); } ExchangeLog.LogEnd("GetMailboxStatisticsInternal"); return(info); }
public virtual IBatchSizeReducer GetBatchSizeReducer(ByteQuantifiedSize maximumSize, ByteQuantifiedSize totalSize, ILogger logger) { switch (LoadBalanceADSettings.Instance.Value.BatchBatchSizeReducer) { case BatchSizeReducerType.DropLargest: return(this.CreateDropLargestBatchSizeReducer(maximumSize, logger)); case BatchSizeReducerType.DropSmallest: return(this.CreateDropSmallestBatchSizeReducer(maximumSize, logger)); default: return(this.GetFactorBasedBatchSizeReducer(maximumSize, totalSize, logger)); } }
private PropertyBagBasedMessageInfo(PropertyStreamReader reader, Version sourceVersion) : base(new MessageInfoPropertyBag()) { KeyValuePair <string, object> keyValuePair; reader.Read(out keyValuePair); if (!string.Equals("NumProperties", keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { throw new SerializationException(string.Format("Cannot deserialize PropertyBagBasedMessageInfo. Expected property NumProperties, but found property '{0}'", keyValuePair.Key)); } int value = PropertyStreamReader.GetValue <int>(keyValuePair); for (int i = 0; i < value; i++) { reader.Read(out keyValuePair); if (string.Equals(ExtensibleMessageInfoSchema.Identity.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { MessageIdentity value2 = MessageIdentity.Create(sourceVersion, keyValuePair, reader); this.propertyBag[ExtensibleMessageInfoSchema.Identity] = value2; } else if (string.Equals(ExtensibleMessageInfoSchema.Status.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { MessageStatus value3 = (MessageStatus)PropertyStreamReader.GetValue <int>(keyValuePair); this.propertyBag[ExtensibleMessageInfoSchema.Status] = value3; } else if (string.Equals(ExtensibleMessageInfoSchema.Size.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { ByteQuantifiedSize byteQuantifiedSize = new ByteQuantifiedSize(PropertyStreamReader.GetValue <ulong>(keyValuePair)); this.propertyBag[ExtensibleMessageInfoSchema.Size] = byteQuantifiedSize; } else if (string.Equals(ExtensibleMessageInfoSchema.MessageLatency.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { EnhancedTimeSpan enhancedTimeSpan = EnhancedTimeSpan.Parse(PropertyStreamReader.GetValue <string>(keyValuePair)); this.propertyBag[ExtensibleMessageInfoSchema.MessageLatency] = enhancedTimeSpan; } else if (string.Equals(ExtensibleMessageInfoSchema.ExternalDirectoryOrganizationId.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { Guid value4 = PropertyStreamReader.GetValue <Guid>(keyValuePair); this.propertyBag[ExtensibleMessageInfoSchema.ExternalDirectoryOrganizationId] = value4; } else if (string.Equals(ExtensibleMessageInfoSchema.Directionality.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { MailDirectionality value5 = (MailDirectionality)PropertyStreamReader.GetValue <int>(keyValuePair); this.propertyBag[ExtensibleMessageInfoSchema.Directionality] = value5; } else if (string.Equals(ExtensibleMessageInfoSchema.Recipients.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { int value6 = PropertyStreamReader.GetValue <int>(keyValuePair); RecipientInfo[] array = new RecipientInfo[value6]; for (int j = 0; j < value6; j++) { RecipientInfo recipientInfo = RecipientInfo.Create(reader); array[j] = recipientInfo; } this.propertyBag[ExtensibleMessageInfoSchema.Recipients] = array; } else if (string.Equals(ExtensibleMessageInfoSchema.ComponentLatency.Name, keyValuePair.Key, StringComparison.OrdinalIgnoreCase)) { int value7 = PropertyStreamReader.GetValue <int>(keyValuePair); ComponentLatencyInfo[] array2 = new ComponentLatencyInfo[value7]; for (int k = 0; k < value7; k++) { ComponentLatencyInfo componentLatencyInfo = ComponentLatencyInfo.Create(reader); array2[k] = componentLatencyInfo; } this.propertyBag[ExtensibleMessageInfoSchema.ComponentLatency] = array2; } else { PropertyDefinition fieldByName = PropertyBagBasedMessageInfo.schema.GetFieldByName(keyValuePair.Key); if (fieldByName != null) { this.propertyBag.SetField((QueueViewerPropertyDefinition <ExtensibleMessageInfo>)fieldByName, keyValuePair.Value); } else { ExTraceGlobals.SerializationTracer.TraceWarning <string>(0L, "Cannot convert key index '{0}' into a property in the ExtensibleMessageInfo schema", keyValuePair.Key); } } } }
public static object ExtractNullableUnlimitedByteQuantifiedSizeFromKilobytes(PropValue value, MapiPropertyDefinition propertyDefinition) { if (typeof(Unlimited <ByteQuantifiedSize>?) == propertyDefinition.Type) { object obj = null; if (MapiPropValueConvertor.TryCastValueToExtract(value, typeof(long), out obj)) { long num = (long)obj; if (0L > num) { return(new Unlimited <ByteQuantifiedSize>?(Unlimited <ByteQuantifiedSize> .UnlimitedValue)); } return(new Unlimited <ByteQuantifiedSize>?(new Unlimited <ByteQuantifiedSize>(ByteQuantifiedSize.FromKB(checked ((ulong)num))))); } } throw MapiPropValueConvertor.ConstructExtractingException(value, propertyDefinition, Strings.ConstantNa); }
public ConsumerSizeProjection(HeatMapCapacityData heatMapData, CapacityProjectionData capacityProjectionData, ByteQuantifiedSize averageMailboxSize, int queryBufferPeriod, double maxConsumerSizePercentage, ILogger logger) { this.heatMapData = heatMapData; this.capacityProjectionData = capacityProjectionData; this.averageMailboxSize = averageMailboxSize; this.queryBufferPeriod = queryBufferPeriod; this.maxConsumerSizePercentage = maxConsumerSizePercentage; this.logger = logger; }
private static ByteQuantifiedSize GetConfigByteQuantifiedSizeValue(string configName, ByteQuantifiedSize defaultValue) { string expression = null; ByteQuantifiedSize result; if (AppConfigLoader.TryGetConfigRawValue(configName, out expression) && ByteQuantifiedSize.TryParse(expression, out result)) { return(result); } return(defaultValue); }
public BatchCapacityDatum GetConsumerBatchCapacity(int numberOfMailboxes, ByteQuantifiedSize expectedBatchSize) { return(this.client.GetConsumerBatchCapacity(numberOfMailboxes, expectedBatchSize)); }
public void CleanupSoftDeletedMailboxesOnDatabase(DirectoryIdentity identity, ByteQuantifiedSize targetSize) { this.client.CleanupSoftDeletedMailboxesOnDatabase(identity, targetSize); }
public static ByteQuantifiedSize ReadByteQuantifiedSizeValue(string configName, ByteQuantifiedSize defaultValue) { string expression = null; if (!AppConfigLoader.TryGetConfigRawValue(configName, out expression)) { return(defaultValue); } ByteQuantifiedSize result; if (!ByteQuantifiedSize.TryParse(expression, out result)) { return(defaultValue); } return(result); }
public static string ToAppropriateUnitFormatString(this ByteQuantifiedSize size) { return(size.ToAppropriateUnitFormatString("{0:0}")); }
internal static object IssueWarningQuotaGetter(IPropertyBag propertyBag) { int?num = propertyBag[PublicFolderSchema.PfStorageQuota] as int?; if (num != null) { int value = num.Value; return((value < 0) ? Unlimited <ByteQuantifiedSize> .UnlimitedValue : new Unlimited <ByteQuantifiedSize>(ByteQuantifiedSize.FromKB(checked ((ulong)value)))); } return(Unlimited <ByteQuantifiedSize> .UnlimitedValue); }
private void Initialize(ExDateTime serviceStartTime, string logFilePath, TimeSpan maxRetentionPeriod, ByteQuantifiedSize directorySizeQuota, ByteQuantifiedSize perFileSizeQuota, bool applyHourPrecision) { int registryInt; using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess\\Parameters")) { this.enabled = ServiceTopologyLog.GetRegistryBool(registryKey, "ServiceTopologyLoggingEnabled", false); registryInt = ServiceTopologyLog.GetRegistryInt(registryKey, "LogBufferSize", 524288); int registryInt2 = ServiceTopologyLog.GetRegistryInt(registryKey, "FlushIntervalInMinutes", 15); if (registryInt2 > 0) { ServiceTopologyLog.FlushInterval = TimeSpan.FromMinutes((double)registryInt2); } } if (this.registryWatcher == null) { this.registryWatcher = new RegistryWatcher("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess\\Parameters", false); } if (this.timer == null) { this.timer = new Timer(new TimerCallback(this.UpdateConfigIfChanged), null, 0, 300000); } this.log = new Log(ServiceTopologyLog.LogFilePrefix, new LogHeaderFormatter(ServiceTopologyLog.Schema, LogHeaderCsvOption.CsvCompatible), "ServiceTopologyLogs"); this.log.Configure(logFilePath, maxRetentionPeriod, (long)directorySizeQuota.ToBytes(), (long)perFileSizeQuota.ToBytes(), applyHourPrecision, registryInt, ServiceTopologyLog.FlushInterval, LogFileRollOver.Hourly); AppDomain.CurrentDomain.ProcessExit += this.CurrentDomain_ProcessExit; this.initialized = true; }
internal static object MaxItemSizeGetter(IPropertyBag propertyBag) { int?num = propertyBag[PublicFolderSchema.PfMsgSizeLimit] as int?; if (num != null) { int value = num.Value; return((value < 0) ? Unlimited <ByteQuantifiedSize> .UnlimitedValue : new Unlimited <ByteQuantifiedSize>(ByteQuantifiedSize.FromKB(checked ((ulong)value)))); } return(Unlimited <ByteQuantifiedSize> .UnlimitedValue); }
internal static ByteQuantifiedSize GetByteQuantifiedValueFromMultivaluedProperty(string name, IEnumerable <string> property, ByteQuantifiedSize defaultValue) { string stringValueFromMultivaluedProperty = MultivaluedPropertyAccessors.GetStringValueFromMultivaluedProperty(name, property, null); if (string.IsNullOrEmpty(stringValueFromMultivaluedProperty)) { return(defaultValue); } ByteQuantifiedSize result; if (ByteQuantifiedSize.TryParse(stringValueFromMultivaluedProperty, out result)) { return(result); } return(defaultValue); }
// Token: 0x0600144F RID: 5199 RVA: 0x00075368 File Offset: 0x00073568 public Configuration() { bool configBoolValue = AppConfigLoader.GetConfigBoolValue("InferenceDataCollectionIsLoggingEnabled", true); LoggingLevel configEnumValue = AppConfigLoader.GetConfigEnumValue <LoggingLevel>("InferenceDataCollectionLoggingLevel", LoggingLevel.Debug); string configStringValue = AppConfigLoader.GetConfigStringValue("InferenceDataCollectionLogPath", Configuration.DefaultLogPath); TimeSpan configTimeSpanValue = AppConfigLoader.GetConfigTimeSpanValue("InferenceDataCollectionMaxLogAge", TimeSpan.Zero, TimeSpan.MaxValue, TimeSpan.FromDays(30.0)); ByteQuantifiedSize byteQuantifiedSize = ConfigurationUtils.ReadByteQuantifiedSizeValue("InferenceDataCollectionMaxLogDirectorySize", ByteQuantifiedSize.FromGB(1UL)); ByteQuantifiedSize byteQuantifiedSize2 = ConfigurationUtils.ReadByteQuantifiedSizeValue("InferenceDataCollectionMaxLogFileSize", ByteQuantifiedSize.FromMB(10UL)); base.MetadataLogConfig = new LogConfig(configBoolValue, "InferenceMetadata", "InferenceMetadata", Path.Combine(configStringValue, "Metadata"), new ulong?(byteQuantifiedSize.ToBytes()), new ulong?(byteQuantifiedSize2.ToBytes()), new TimeSpan?(configTimeSpanValue), 4096); base.DiagnosticLogConfig = new DiagnosticLogConfig(configBoolValue, "InferenceDataCollection", "InferenceDataCollection", configStringValue, new ulong?(byteQuantifiedSize.ToBytes()), new ulong?(byteQuantifiedSize2.ToBytes()), new TimeSpan?(configTimeSpanValue), configEnumValue); base.MailboxReprocessAge = AppConfigLoader.GetConfigTimeSpanValue("InferenceDataCollectionMailboxReprocessAge", TimeSpan.Zero, TimeSpan.MaxValue, TimeSpan.FromDays(30.0)); base.ModuloNumberToRandomize = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionModuloNumberToRandomize", 1, int.MaxValue, 500); this.ModuloNumberToRandomizeForGroups = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionModuloNumberToRandomizeForGroups", 1, int.MaxValue, 10); base.BlackListedFolders = ConfigurationUtils.ReadCommaSeperatedStringValue("InferenceDataCollectionBlackListedFolders", null); base.WhiteListedFolders = ConfigurationUtils.ReadCommaSeperatedStringValue("InferenceDataCollectionWhiteListedFolders", null); base.MinimumItemCountInMailbox = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionMinimumItemCountInMailbox", 0, int.MaxValue, 0); base.MinimumSentItemsCount = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionMinimumSentItemsCount", 0, int.MaxValue, 0); base.NumberOfItemsPerFolderToProcess = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionNumberOfItemsPerFolderToProcess", 0, int.MaxValue, int.MaxValue); base.MinimumSentItemsPercentage = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionMinimumSentItemsPercentage", 0, 100, 0); base.IsOutputSanitized = AppConfigLoader.GetConfigBoolValue("InferenceDataCollectionIsOutputSanitized", true); base.QueryPageSize = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionQueryPageSize", 0, 32767, 100); base.CollectMessageBodyProps = AppConfigLoader.GetConfigBoolValue("InferenceDataCollectionCollectMessageBodyProps", false); base.ChunkSize = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionChunkSize", 1, int.MaxValue, 1000); base.ItemMaxAttemptCount = AppConfigLoader.GetConfigIntValue("InferenceDataCollectionItemMaxAttemptCount", 1, 10, 3); }
protected virtual IBatchSizeReducer CreateDropSmallestBatchSizeReducer(ByteQuantifiedSize targetSize, ILogger logger) { return(new DropSmallestEntriesBatchSizeReducer(targetSize, logger)); }
public SearchResult PerformSearch(ComplianceMessage target, SearchWorkDefinition definition) { string query = definition.Query; SearchResult result = new SearchResult(); CultureInfo culture; FaultDefinition faultDefinition; ExceptionHandler.Parser.TryRun(delegate { if (string.IsNullOrEmpty(target.Culture)) { culture = CultureInfo.InvariantCulture; } else { culture = CultureInfo.GetCultureInfo(target.Culture); } AdditionalParameters additionalParameters = new AdditionalParameters { Refiners = new string[] { FastIndexSystemSchema.Size.Name } }; if (query != null) { Guid mailboxGuid = target.MessageTarget.Mailbox; Guid database = target.MessageTarget.Database; IEnumerable <KeyValuePair <PagingImsFlowExecutor.QueryExecutionContext, SearchResultItem[]> > pages = null; string flowName = FlowDescriptor.GetImsFlowDescriptor(FastLocalSearchResultsProvider.SearchConfig, FastIndexVersion.GetIndexSystemName(database)).DisplayName; if (ExceptionHandler.Proxy.TryRun(delegate { pages = FastLocalSearchResultsProvider.FlowExecutor.Execute(flowName, mailboxGuid, Guid.NewGuid(), query, 0L, culture, additionalParameters, Math.Min(FastLocalSearchResultsProvider.SearchConfig.FastQueryResultTrimHits, 1), null); }, TimeSpan.FromMinutes(1.0), out faultDefinition, target, new Action <ExceptionHandler.ExceptionData>(this.ProxyExceptionHandler), default(CancellationToken), null, "PerformSearch", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\ApplicationPlugins\\EDiscovery\\FastLocalSearchResultsProvider.cs", 213)) { foreach (KeyValuePair <PagingImsFlowExecutor.QueryExecutionContext, SearchResultItem[]> keyValuePair in pages) { PagingImsFlowExecutor.QueryExecutionContext key = keyValuePair.Key; SearchResultItem[] value = keyValuePair.Value; ByteQuantifiedSize byteQuantifiedSize = default(ByteQuantifiedSize); long count = FastLocalSearchResultsProvider.FlowExecutor.ReadHitCount(key); IEnumerable <RefinerResult> source = FastLocalSearchResultsProvider.FlowExecutor.ReadRefiners(key); RefinerResult refinerResult = source.FirstOrDefault((RefinerResult t) => t.Name == FastIndexSystemSchema.Size.Name); if (refinerResult != null) { byteQuantifiedSize = new ByteQuantifiedSize((ulong)refinerResult.Sum); } result = new SearchResult(); result.UpdateTotalSize((long)byteQuantifiedSize.ToMB()); result.UpdateTotalCount(count); result.Results.Add(new SearchResult.TargetSearchResult { Target = target.MessageTarget, Size = result.TotalSize, Count = result.TotalCount }); } } } }, TimeSpan.FromMinutes(1.0), out faultDefinition, target, null, default(CancellationToken), null, "PerformSearch", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\ApplicationPlugins\\EDiscovery\\FastLocalSearchResultsProvider.cs", 188); if (faultDefinition != null) { ExceptionHandler.FaultMessage(target, faultDefinition, true); } return(result); }
public OwaServerLogConfiguration() { this.IsLoggingEnabled = AppConfigLoader.GetConfigBoolValue("OWAIsLoggingEnabled", true); this.LogPath = AppConfigLoader.GetConfigStringValue("OWALogPath", OwaServerLogConfiguration.DefaultLogPath); this.MaxLogAge = AppConfigLoader.GetConfigTimeSpanValue("OWAMaxLogAge", TimeSpan.Zero, TimeSpan.MaxValue, TimeSpan.FromDays(30.0)); this.MaxLogDirectorySizeInBytes = (long)OwaAppConfigLoader.GetConfigByteQuantifiedSizeValue("OWAMaxLogDirectorySize", ByteQuantifiedSize.FromGB(1UL)).ToBytes(); this.MaxLogFileSizeInBytes = (long)OwaAppConfigLoader.GetConfigByteQuantifiedSizeValue("OWAMaxLogFileSize", ByteQuantifiedSize.FromMB(10UL)).ToBytes(); }
public SoftDeletedDatabaseCleanupRequest(IClientFactory clientFactory, DirectoryDatabase directoryObject, ByteQuantifiedSize targetSize) { this.clientFactory = clientFactory; this.directoryObject = directoryObject; this.targetSize = targetSize; }
public DirectorySize(string dirName, ulong size) { this.Name = dirName; this.Size = ByteQuantifiedSize.FromBytes(size); }
public override void CleanupSoftDeletedMailboxesOnDatabase(DirectoryIdentity identity, ByteQuantifiedSize targetSize) { }
private static void Initialize(ExDateTime serviceStartTime, string logFilePath, TimeSpan maxRetentionPeriond, ByteQuantifiedSize directorySizeQuota, ByteQuantifiedSize perFileSizeQuota, bool applyHourPrecision) { int registryInt; using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess\\Parameters")) { GLSLogger.Enabled = GLSLogger.GetRegistryBool(registryKey, "ProtocolLoggingEnabled", true); registryInt = GLSLogger.GetRegistryInt(registryKey, "LogBufferSize", 65536); } if (GLSLogger.registryWatcher == null) { GLSLogger.registryWatcher = new RegistryWatcher("SYSTEM\\CurrentControlSet\\Services\\MSExchange ADAccess\\Parameters", false); } if (GLSLogger.timer == null) { GLSLogger.timer = new Timer(new TimerCallback(GLSLogger.UpdateConfigIfChanged), null, 0, 300000); } if (GLSLogger.Enabled) { GLSLogger.log = new Log(GLSLogger.logFilePrefix, new LogHeaderFormatter(GLSLogger.schema, LogHeaderCsvOption.CsvCompatible), "GLSLogs"); GLSLogger.log.Configure(logFilePath, maxRetentionPeriond, (long)directorySizeQuota.ToBytes(), (long)perFileSizeQuota.ToBytes(), applyHourPrecision, registryInt, GLSLogger.defaultFlushInterval); AppDomain.CurrentDomain.ProcessExit += GLSLogger.CurrentDomain_ProcessExit; } GLSLogger.Initialized = true; }
private static string RunComponentCommand(string componentName, DiagnosableParameters componentParameters) { XDocument xdocument = new XDocument(); XElement xelement = new XElement("Diagnostics"); xdocument.Add(xelement); if (string.Equals(componentName, "ProcessLocator", StringComparison.OrdinalIgnoreCase)) { XElement xelement2 = new XElement("ProcessLocator"); xelement.Add(xelement2); List <KeyValuePair <Guid, string> > registeredProcessGuids = ProcessAccessRpcServer.GetRegisteredProcessGuids(); int num = 0; if (string.Equals(componentParameters.Argument, "debug", StringComparison.OrdinalIgnoreCase)) { using (List <KeyValuePair <Guid, string> > .Enumerator enumerator = registeredProcessGuids.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <Guid, string> pair = enumerator.Current; ProcessAccessManager.AddAsXmlElement(xelement2, pair); num++; } goto IL_117; } } HashSet <string> hashSet = new HashSet <string>(registeredProcessGuids.Count); foreach (KeyValuePair <Guid, string> pair2 in registeredProcessGuids) { if (pair2.Key != ProcessAccessRpcServer.ProcessLocatorGuid && !hashSet.Contains(pair2.Value)) { ProcessAccessManager.AddAsXmlElement(xelement2, pair2); num++; hashSet.Add(pair2.Value); } } IL_117: xelement2.AddFirst(new XElement("count", num)); } else { using (Process currentProcess = Process.GetCurrentProcess()) { DateTime dateTime = currentProcess.StartTime.ToUniversalTime(); DateTime utcNow = DateTime.UtcNow; XElement content = new XElement("ProcessInfo", new object[] { new XElement("id", currentProcess.Id), new XElement("serverName", Environment.MachineName), new XElement("startTime", dateTime), new XElement("currentTime", utcNow), new XElement("lifetime", (utcNow - dateTime).ToString()), new XElement("threadCount", currentProcess.Threads.Count), new XElement("handleCount", currentProcess.HandleCount), new XElement("workingSet", ByteQuantifiedSize.FromBytes((ulong)currentProcess.WorkingSet64)) }); xelement.Add(content); } bool flag = string.IsNullOrEmpty(componentName); bool flag2 = componentName == "?"; if (!flag2 && !flag && !ProcessAccessManager.diagnosableComponents.ContainsKey(componentName)) { XElement content2 = new XElement(componentName, new XElement("message", string.Format("Component \"{0}\" is not supported by this process.", componentName))); xelement.Add(content2); flag2 = true; } XElement xelement3 = new XElement("Components"); xelement.Add(xelement3); lock (ProcessAccessManager.RpcServerLockObject) { if (flag) { using (IEnumerator <KeyValuePair <string, IDiagnosable> > enumerator3 = ProcessAccessManager.diagnosableComponents.GetEnumerator()) { while (enumerator3.MoveNext()) { KeyValuePair <string, IDiagnosable> keyValuePair = enumerator3.Current; xelement3.Add(keyValuePair.Value.GetDiagnosticInfo(componentParameters)); } goto IL_3C2; } } if (flag2) { using (IEnumerator <KeyValuePair <string, IDiagnosable> > enumerator4 = ProcessAccessManager.diagnosableComponents.GetEnumerator()) { while (enumerator4.MoveNext()) { KeyValuePair <string, IDiagnosable> keyValuePair2 = enumerator4.Current; xelement3.Add(new XElement("Component", keyValuePair2.Key)); } goto IL_3C2; } } IDiagnosable diagnosable = ProcessAccessManager.diagnosableComponents[componentName]; XElement diagnosticInfo = diagnosable.GetDiagnosticInfo(componentParameters); xelement3.Add(diagnosticInfo); IL_3C2 :; } } string result; try { using (StringWriter stringWriter = new StringWriter()) { using (XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter)) { xmlTextWriter.Formatting = Formatting.None; xdocument.Save(xmlTextWriter); } result = stringWriter.ToString(); } } catch (XmlException ex) { foreach (XElement xelement4 in xdocument.Descendants()) { ex.Data[xelement4.Name] = xelement4.Value; } throw; } return(result); }
public void CleanupSoftDeletedMailboxesOnDatabase(DirectoryIdentity databaseIdentity, ByteQuantifiedSize targetSize) { base.ForwardExceptions(delegate() { this.serviceContext.CreateSoftDeletedDatabaseCleanupRequests(databaseIdentity, targetSize); }); }
// Token: 0x060009A3 RID: 2467 RVA: 0x0002B450 File Offset: 0x00029650 protected void Initialize(ExDateTime serviceStartTime, string logFilePath, TimeSpan maxRetentionPeriond, ByteQuantifiedSize directorySizeQuota, ByteQuantifiedSize perFileSizeQuota, bool applyHourPrecision, string logComponent) { if (this.Initialized) { throw new NotSupportedException("Protocol Log is already initialized"); } BaseDirectoryProtocolLog.InitializeGlobalConfigIfRequired(); if (this.log == null) { this.log = new Log(BaseDirectoryProtocolLog.logFilePrefix, new LogHeaderFormatter(this.Schema, LogHeaderCsvOption.CsvCompatible), logComponent); AppDomain.CurrentDomain.ProcessExit += this.CurrentDomainProcessExit; } if (BaseDirectoryProtocolLog.loggingEnabled.Value) { this.log.Configure(logFilePath, maxRetentionPeriond, (long)directorySizeQuota.ToBytes(), (long)perFileSizeQuota.ToBytes(), applyHourPrecision, BaseDirectoryProtocolLog.bufferSize, BaseDirectoryProtocolLog.DefaultFlushInterval, LogFileRollOver.Hourly); } BaseDirectoryProtocolLog.callsBacks = (TimerCallback)Delegate.Combine(BaseDirectoryProtocolLog.callsBacks, new TimerCallback(this.UpdateConfigIfChanged)); this.Initialized = true; }