private bool CleanupDatabases(IADToplogyConfigurationSession adSession, IClusterDB clusdb, HashSet <Guid> dbGuidsToDelete, HashSet <Guid> validDatabaseGuids)
        {
            if (validDatabaseGuids.Count == 0)
            {
                ReplayCrimsonEvents.ClusdbPeriodicCleanupSkipped.Log <string, string>("Database", "Could not find a single valid database in cached list");
                return(false);
            }
            if (adSession.FindDatabaseByGuid(validDatabaseGuids.First <Guid>()) == null)
            {
                ReplayCrimsonEvents.ClusdbPeriodicCleanupSkipped.Log <string, string>("Database", "Could not find a single valid database in AD");
                return(false);
            }
            bool result = false;

            try
            {
                this.RemoveStaleDatabaseGuids(clusdb, dbGuidsToDelete);
                dbGuidsToDelete.ExceptWith(this.staleDatabases);
                result = true;
            }
            catch (Exception ex)
            {
                ReplayCrimsonEvents.ClusdbPeriodicCleanupFailed.Log <string, string>("Database", ex.ToString());
            }
            this.staleDatabases = dbGuidsToDelete;
            return(result);
        }
Esempio n. 2
0
        public void DoDumpsterRedeliveryIfRequired(Guid dbGuid)
        {
            IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true);
            IADDatabase db     = iadtoplogyConfigurationSession.FindDatabaseByGuid(dbGuid);
            IADServer   server = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName);
            IADDatabaseAvailabilityGroup dag          = iadtoplogyConfigurationSession.FindDagByServer(server);
            ReplayConfiguration          replayConfig = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server);

            DumpsterRedeliveryWrapper.DoRedeliveryIfRequired(replayConfig);
        }
Esempio n. 3
0
        public void TriggerDumpsterEx(Guid dbGuid, bool fTriggerSafetyNet, DateTime failoverTimeUtc, DateTime startTimeUtc, DateTime endTimeUtc, long lastLogGenBeforeActivation, long numLogsLost)
        {
            IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true);
            IADDatabase db     = iadtoplogyConfigurationSession.FindDatabaseByGuid(dbGuid);
            IADServer   server = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName);
            IADDatabaseAvailabilityGroup dag           = iadtoplogyConfigurationSession.FindDagByServer(server);
            ReplayConfiguration          configuration = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server);

            DumpsterRedeliveryWrapper.MarkRedeliveryRequired(configuration, failoverTimeUtc, startTimeUtc, endTimeUtc, lastLogGenBeforeActivation, numLogsLost);
        }
Esempio n. 4
0
        public void TriggerDumpster(Guid dbGuid, DateTime inspectorTime)
        {
            IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreatePartiallyConsistentRootOrgSession(true);
            IADDatabase db     = iadtoplogyConfigurationSession.FindDatabaseByGuid(dbGuid);
            IADServer   server = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName);
            IADDatabaseAvailabilityGroup dag           = iadtoplogyConfigurationSession.FindDagByServer(server);
            ReplayConfiguration          configuration = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server);

            DumpsterRedeliveryWrapper.MarkRedeliveryRequired(configuration, inspectorTime, 0L, 0L);
        }
Esempio n. 5
0
        internal static void GetDatabaseNameAndPath(Guid databaseGuid, out string databaseName, out string databaseFilePath)
        {
            IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateFullyConsistentRootOrgSession(true);
            IADDatabase iaddatabase = iadtoplogyConfigurationSession.FindDatabaseByGuid(databaseGuid);

            databaseName = iaddatabase.Name;
            if (iaddatabase.EdbFilePath != null)
            {
                databaseFilePath = iaddatabase.EdbFilePath.ToString();
                return;
            }
            databaseFilePath = null;
        }
        // Token: 0x0600241D RID: 9245 RVA: 0x000A8E60 File Offset: 0x000A7060
        private IADDatabase LookupDatabase(Guid databaseId)
        {
            IADDatabase db = null;
            Exception   ex = this.DoADAction(delegate(object param0, EventArgs param1)
            {
                IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true);
                db = iadtoplogyConfigurationSession.FindDatabaseByGuid(databaseId);
            });

            if (db != null)
            {
                return(db);
            }
            ExTraceGlobals.ThirdPartyManagerTracer.TraceDebug <Guid, Exception>(0L, "LookupDatabase({0}) failed. Ex={1}", databaseId, ex);
            if (ex == null)
            {
                throw new NoSuchDatabaseException(databaseId);
            }
            throw ex;
        }