public async Task InitializeMigration() { logger.LogInfo("Initialize data scrubbing"); targetClient = cosmosHelper.GetTargetDocumentDbClient(); targetCollection = await cosmosHelper.GetTargetDocumentCollection(targetClient); await cosmosBulkImporter.InitializeBulkExecutor(targetClient, targetCollection); }
public async Task InitializeMigration() { logger.LogInfo("Inside Initialize migration for SampleDBCreator. "); sampleClient = cosmosHelper.GetSampleDocumentDbClient(); sampleCollection = await cosmosHelper.CreateSampleDocumentCollection(sampleClient, this.IsFixedCollection); await cosmosBulkImporter.InitializeBulkExecutor(sampleClient, sampleCollection); }
public async Task InitializeMigration() { logger.LogInfo("Begin Document Migration."); logger.LogInfo($"Source Database: {CloneSettings.SourceSettings.DatabaseName} Source Collection: {CloneSettings.SourceSettings.CollectionName}"); logger.LogInfo($"Target Database: {CloneSettings.TargetSettings.DatabaseName} Target Collection: {CloneSettings.TargetSettings.CollectionName}"); IsInitialized = true; sourceClient = cosmosHelper.GetSourceDocumentDbClient(); sourceCollection = await cosmosHelper.GetSourceDocumentCollection(sourceClient); targetClient = cosmosHelper.GetTargetDocumentDbClient(); var indexPolicy = (CloneSettings.CopyIndexingPolicy)? sourceCollection.IndexingPolicy : new IndexingPolicy(); targetCollection = await cosmosHelper.CreateTargetDocumentCollection(targetClient, indexPolicy, sourceCollection.PartitionKey); if (CloneSettings.CopyDocuments) { TotalRecordsInSource = cosmosHelper.GetSourceRecordCount(); logger.LogInfo($"Total records in Source: {TotalRecordsInSource} "); SourceCommonDataFetchQuery = cosmosHelper.GetSourceEntityDocumentQuery <dynamic>(sourceClient, CloneSettings.ReadBatchSize); await cosmosBulkImporter.InitializeBulkExecutor(targetClient, targetCollection); } else { logger.LogInfo("Document Migration is disabled through configuration. "); } if (CloneSettings.ScrubbingRequired && scrubRules != null && scrubRules.Count > 0) { noFilterScrubRules = new List <ScrubRule>(); filteredScrubRules = new List <ScrubRule>(); foreach (var sRule in scrubRules) { if (string.IsNullOrEmpty(sRule.FilterCondition)) { sRule.RecordsByFilter = TotalRecordsInSource; noFilterScrubRules.Add(sRule); } else { filteredScrubRules.Add(sRule); //DataScrubMigrator.scrubRules.Add(sRule); } } } }