Skip to content

Migration engine: Copy licensing throughput history to SQL - #6063

Draft
warwickschroeder wants to merge 1 commit into
warwick/migration-engine-4from
migration-engine-5
Draft

warwickschroeder wants to merge 1 commit into
warwick/migration-engine-4from
migration-engine-5

Conversation

@warwickschroeder

Copy link
Copy Markdown
Contributor

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.

  • Endpoints: LicensingEndpointsReader and LicensingEndpointsWriter copy endpoint documents, keyed by the product's own normalised name and throughput source.
  • Daily counts: LicensingThroughputReader and LicensingThroughputWriter copy each day after its endpoint, and set the count rather than add to it, so a re-run or resume never doubles one.
  • Report masks and licence file: each is copied into the one Settings row the product reads, and a row already there is left alone.
  • Other documents: only documents in the EndpointDocuments collection are read as endpoints.
  • Date keys: MigrationInsert reads returned keys as their stored type, so a date key matches on SQL Server.
  • Visibility only: the RavenDB throughput document ids and the EF Normalize become internal for the migration to use.
  • Project reference: ServiceControl.Persistence references Particular.LicensingComponent.Contracts for 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant