private static void CheckDatabase(string database, string url) { Console.WriteLine(); Console.WriteLine($"********************Checking database {database} for problems.********************************"); using (RavenHelper.CreateAndInitializeStore(url, database)) { var collectionNamesInIndex = RavenHelper.GetIndexTerms("Raven/DocumentsByEntityName", url, database); var timeoutProblem = CheckForDuplicateTimeoutCollections(collectionNamesInIndex); var sagaProblem = CheckForDuplicateSagaCollections(collectionNamesInIndex); Console.WriteLine(timeoutProblem || sagaProblem ? $"Problems found in database {database}. There are duplicated timeout and/or saga collections in this database. This is caused by switching between using a connection string and providing a full document store to NSB endpoint using this database. You need to inspect the collections listed above and decided if you can discard the ones currently not in use." : $"No problems found in database {database}."); } Console.WriteLine($"***************Finished checking database {database} for problems.****************************"); }
public static void CreatDummyData(string url) { using (var store = RavenHelper.CreateAndInitializeStore(url)) { store.Conventions.FindTypeTagName = t => t.Name; store.DatabaseCommands.GlobalAdmin.EnsureDatabaseExists("BothProblems"); using (var session = store.OpenSession("BothProblems")) { session.Store(new TimeoutData()); session.Store(new TimeoutDatas()); session.Store(new TestSaga()); session.Store(new TestSagaDatas()); session.SaveChanges(); } store.DatabaseCommands.GlobalAdmin.EnsureDatabaseExists("OnlyTimeoutProblem"); using (var session = store.OpenSession("OnlyTimeoutProblem")) { session.Store(new TimeoutData()); session.Store(new TimeoutDatas()); session.Store(new TestSaga()); session.SaveChanges(); } store.DatabaseCommands.GlobalAdmin.EnsureDatabaseExists("OnlySagaProblem"); using (var session = store.OpenSession("OnlySagaProblem")) { session.Store(new TestSaga()); session.Store(new TestSagaDatas()); session.Store(new TimeoutData()); session.SaveChanges(); } store.DatabaseCommands.GlobalAdmin.EnsureDatabaseExists("NoProblemStandardConvention"); using (var session = store.OpenSession("NoProblemStandardConvention")) { session.Store(new TimeoutDatas()); session.Store(new TestSagaDatas()); session.SaveChanges(); } store.DatabaseCommands.GlobalAdmin.EnsureDatabaseExists("NoProblemNSBConvention"); using (var session = store.OpenSession("NoProblemNSBConvention")) { session.Store(new TimeoutData()); session.Store(new TestSaga()); session.SaveChanges(); } store.DatabaseCommands.GlobalAdmin.EnsureDatabaseExists("EverythingIsCrazy"); using (var session = store.OpenSession("EverythingIsCrazy")) { session.Store(new TimeoutData()); session.Store(new TimeoutDatas()); session.Store(new TestSaga()); session.Store(new TestSagaDatas()); session.Store(new OutboxRecords()); session.Store(new OutboxRecord()); session.Store(new SagaUniqueIdentities()); session.Store(new SagaUniqueIdentity()); session.Store(new Subscriptions()); session.Store(new Subscription()); session.Store(new GatewayMessages()); session.Store(new GatewayMessage()); session.Store(new OrderSaga()); session.Store(new OrderSagaDatas()); session.Store(new OrderSagas()); session.Store(new DataOrderSagaDatas()); session.Store(new BlueBerry()); session.Store(new BlueBerries()); session.Store(new Car()); session.Store(new Cars()); session.Store(new OrderIdentity()); session.Store(new OrderDataIdentities()); session.Store(new OrderPolicy()); session.Store(new OrderDataPolicyDatas()); session.Store(new ofsPolicys()); session.Store(new DataofDatasPolicyDataDatasDatas()); session.SaveChanges(); } } }