Skip to content

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

Open
warwickschroeder wants to merge 5 commits into
warwick/migration-engine-4from
migration-engine-5
Open

warwickschroeder wants to merge 5 commits 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.

@rbev
rbev added this pull request to stack #6109 November 11, 2026 13:17
@rbev
rbev force-pushed the migration-engine-5 branch from 63370e5 to 327a3d7 Compare November 11, 2026 13:37
@rbev
rbev force-pushed the migration-engine-5 branch from 327a3d7 to 2f87fc7 Compare November 11, 2026 14:00
… document-id order and cursor resumption; add tests for endpoint reading behavior.
…nts with names differing only in case and trailing spaces; update related tests and documentation.
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.

2 participants