Repository navigation
Migration engine: Copy licensing throughput history to SQL - #6063
Draft
warwickschroeder wants to merge 1 commit into
Draft
warwickschroeder wants to merge 1 commit into
warwickschroeder wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
The migration now copies the licensing data in RavenDB's second database,
throughput, to SQL Server or PostgreSQL while ServiceControl is closed: the endpoint list, up to fourteen months of daily message counts, the report masks and the uploaded licence file. A copied day counts as already collected, so the throughput collectors never add to it.LicensingEndpointsReaderandLicensingEndpointsWritercopy endpoint documents, keyed by the product's own normalised name and throughput source.LicensingThroughputReaderandLicensingThroughputWritercopy each day after its endpoint, and set the count rather than add to it, so a re-run or resume never doubles one.Settingsrow the product reads, and a row already there is left alone.EndpointDocumentscollection are read as endpoints.MigrationInsertreads returned keys as their stored type, so adatekey matches on SQL Server.Normalizebecomeinternalfor the migration to use.ServiceControl.PersistencereferencesParticular.LicensingComponent.Contractsfor the shared day row.Tests
ServiceControl.Persistence.Tests/EFCore/Migration: the four writers, the mappers, set-not-add across batches, a day batch bigger than one SQL statement, value length skips and the date key read back.ServiceControl.Persistence.Tests.RavenDB/DataMigration: reading endpoints, counts and both settings documents from the throughput database, skipping other collections, and resuming.ServiceControl.Migration.AcceptanceTests: an end-to-end copy on both providers, an unchanged re-run, trailing-space endpoint pairs, counts blocked behind a skipped endpoint, and the broker collector not counting a copied day twice.