Пример #1
0
        public bool ShouldDeleteDatabase(TransactionOperationContext context, string dbName, RawDatabaseRecord rawRecord)
        {
            var deletionInProgress = DeletionInProgressStatus.No;
            var directDelete       = rawRecord.DeletionInProgress?.TryGetValue(_serverStore.NodeTag, out deletionInProgress) == true &&
                                     deletionInProgress != DeletionInProgressStatus.No;

            if (directDelete == false)
            {
                return(false);
            }

            if (rawRecord.Topology.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 = rawRecord.MaterializedRecord;

            context.CloseTransaction();

            DeleteDatabase(dbName, deletionInProgress, record);
            return(true);
        }
Пример #2
0
 public void CloseTransaction()
 {
     Documents.CloseTransaction();
     Server?.CloseTransaction();
 }