public bool ShouldDeleteDatabase(TransactionOperationContext context, string dbName, RawDatabaseRecord rawRecord) { var deletionInProgress = DeletionInProgressStatus.No; var directDelete = rawRecord.GetDeletionInProgressStatus()?.TryGetValue(_serverStore.NodeTag, out deletionInProgress) == true && deletionInProgress != DeletionInProgressStatus.No; if (directDelete == false) { return(false); } if (rawRecord.GetTopology().Rehabs.Contains(_serverStore.NodeTag)) { // If the deletion was issued form the cluster observer to maintain the replication factor we need to make sure // that all the documents were replicated from this node, therefor the deletion will be called from the replication code. return(false); } var record = JsonDeserializationCluster.DatabaseRecord(rawRecord.GetRecord()); context.CloseTransaction(); DeleteDatabase(dbName, deletionInProgress, record); return(true); }
private static bool IsDatabaseBeingDeleted(string tag, RawDatabaseRecord databaseRecord) { if (databaseRecord == null) { return(false); } var deletionInProgress = databaseRecord.GetDeletionInProgressStatus(); return(deletionInProgress != null && deletionInProgress.TryGetValue(tag, out var delInProgress) && delInProgress != DeletionInProgressStatus.No); }