public DocumentDatabase(string name, RavenConfiguration configuration, ServerStore serverStore) { Scripts = new ScriptRunnerCache(this); _logger = LoggingSource.Instance.GetLogger <DocumentDatabase>(Name); _serverStore = serverStore; StartTime = SystemTime.UtcNow; Name = name; Configuration = configuration; try { using (_serverStore.ContextPool.AllocateOperationContext(out TransactionOperationContext ctx)) using (ctx.OpenReadTransaction()) { MasterKey = serverStore.GetSecretKey(ctx, Name); var databaseRecord = _serverStore.Cluster.ReadDatabase(ctx, Name); if (databaseRecord != null) { // can happen when we are in the process of restoring a database if (databaseRecord.Encrypted && MasterKey == null) { throw new InvalidOperationException($"Attempt to create encrypted db {Name} without supplying the secret key"); } if (databaseRecord.Encrypted == false && MasterKey != null) { throw new InvalidOperationException($"Attempt to create a non-encrypted db {Name}, but a secret key exists for this db."); } } } QueryMetadataCache = new QueryMetadataCache(); IoChanges = new IoChangesNotifications(); Changes = new DocumentsChanges(); DocumentTombstoneCleaner = new DocumentTombstoneCleaner(this); DocumentsStorage = new DocumentsStorage(this); IndexStore = new IndexStore(this, serverStore, _indexAndTransformerLocker); EtlLoader = new EtlLoader(this, serverStore); ReplicationLoader = new ReplicationLoader(this, serverStore); SubscriptionStorage = new SubscriptionStorage(this, serverStore); Metrics = new MetricsCountersManager(); TxMerger = new TransactionOperationsMerger(this, DatabaseShutdown); HugeDocuments = new HugeDocuments(configuration.PerformanceHints.HugeDocumentsCollectionSize, configuration.PerformanceHints.HugeDocumentSize.GetValue(SizeUnit.Bytes)); ConfigurationStorage = new ConfigurationStorage(this); NotificationCenter = new NotificationCenter.NotificationCenter(ConfigurationStorage.NotificationsStorage, Name, _databaseShutdown.Token); Operations = new Operations.Operations(Name, ConfigurationStorage.OperationsStorage, NotificationCenter, Changes); DatabaseInfoCache = serverStore.DatabaseInfoCache; RachisLogIndexNotifications = new RachisLogIndexNotifications(DatabaseShutdown); CatastrophicFailureNotification = new CatastrophicFailureNotification(e => { serverStore.DatabasesLandlord.UnloadResourceOnCatastrophicFailure(name, e); }); } catch (Exception) { Dispose(); throw; } }
public EtlProcessStatistics(string processType, string name, NotificationCenter.NotificationCenter notificationCenter, string databaseName) { _processType = processType; _name = name; _notificationCenter = notificationCenter; _databaseName = databaseName; }
public HugeDocuments(NotificationCenter.NotificationCenter notificationCenter, NotificationsStorage notificationsStorage, string database, int maxCollectionSize, long maxWarnSize) { _notificationCenter = notificationCenter; _notificationsStorage = notificationsStorage; _database = database; _maxWarnSize = maxWarnSize; _hugeDocs = new SizeLimitedConcurrentDictionary <Tuple <string, DateTime>, long>(maxCollectionSize); }
public HugeDocuments(NotificationCenter.NotificationCenter notificationCenter, NotificationsStorage notificationsStorage, string database, int maxCollectionSize, long maxWarnSize) { _notificationCenter = notificationCenter; _notificationsStorage = notificationsStorage; _database = database; _maxWarnSize = maxWarnSize; _hugeDocs = new SizeLimitedConcurrentDictionary <Tuple <string, DateTime>, long>(maxCollectionSize); _logger = LoggingSource.Instance.GetLogger(database, GetType().FullName); }
public EtlProcessStatistics(string processTag, string processName, NotificationCenter.NotificationCenter notificationCenter) { _processTag = processTag; _processName = processName; _notificationCenter = notificationCenter; TransformationErrorsInCurrentBatch = new EtlErrorsDetails(); LastLoadErrorsInCurrentBatch = new EtlErrorsDetails(); LastSlowSqlWarningsInCurrentBatch = new SlowSqlDetails(); _alertsGuard = new EnsureAlerts(this); }
public Operations(string name, OperationsStorage operationsStorage, NotificationCenter.NotificationCenter notificationCenter, DocumentsChanges changes) { _operationsStorage = operationsStorage; _notificationCenter = notificationCenter; _changes = changes; _logger = LoggingSource.Instance.GetLogger <Operations>(name); }
public Operations(string name, OperationsStorage operationsStorage, NotificationCenter.NotificationCenter notificationCenter, DocumentsChanges changes, TimeSpan maxCompletedTaskLifeTime) { _name = name; _operationsStorage = operationsStorage; _notificationCenter = notificationCenter; _changes = changes; _maxCompletedTaskLifeTime = maxCompletedTaskLifeTime; LowMemoryNotification.Instance.RegisterLowMemoryHandler(this); }
internal static ExtensionPointCpuUsageCalculator GetExtensionPointCpuUsageCalculator( JsonContextPool contextPool, MonitoringConfiguration configuration, NotificationCenter.NotificationCenter notificationCenter) { var extensionPoint = new ExtensionPointCpuUsageCalculator( contextPool, configuration.CpuUsageMonitorExec, configuration.CpuUsageMonitorExecArguments, notificationCenter); return(extensionPoint); }
public CpuUsageExtensionPoint( JsonContextPool contextPool, string exec, string args, NotificationCenter.NotificationCenter notificationCenter) { _contextPool = contextPool; _notificationCenter = notificationCenter; _startInfo = new ProcessStartInfo { FileName = exec, Arguments = args, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true }; }
public EtlProcessStatistics(string processType, string name, NotificationCenter.NotificationCenter notificationCenter) { _processType = processType; _name = name; _notificationCenter = notificationCenter; }
public StorageSpaceMonitor(NotificationCenter.NotificationCenter notificationCenter) { _notificationCenter = notificationCenter; _timer = new Timer(Run, null, CheckFrequency, CheckFrequency); }