Skip to content

Ship RavenDB 6.2 and 7.2 persisters side by side - #6105

Closed
danielmarbach wants to merge 11 commits into
ravendb-7.2-upgradefrom
ravendb-6-7-coexistence
Closed

danielmarbach wants to merge 11 commits into
ravendb-7.2-upgradefrom
ravendb-6-7-coexistence

Conversation

@danielmarbach

@danielmarbach danielmarbach commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #6049. Work in progress; see the status list at the end.

Problem

#6049 moves ServiceControl to RavenDB 7.2. Opening a RavenDB 6.2 database with a 7.2 server converts it one-way. On a large audit database that takes more than a day (measured in #6049: 101 million stored messages in 39.6 hours), and the instance is unavailable until it finishes.

That forces the conversion on everyone who upgrades, including the people for whom it is wasted work:

  • An error instance that will migrate to SQL Server or PostgreSQL would first have to convert the RavenDB data it is about to leave behind.
  • An audit instance has no SQL migration. It is replaced by a new audit instance and removed when its retention period has passed, so converting it buys nothing.

Change

ServiceControl ships two RavenDB persisters, and an instance stays on the one it has until its operator chooses otherwise.

Persistence type RavenDB Role
RavenDB (alias RavenDB6) 6.2 Existing instances. Legacy, to be removed in the next major version.
RavenDB7 7.2 Default for new instances.
  • The existing RavenDB projects stay the 7.2 persisters, with the manifest name RavenDB7.
  • ServiceControl.RavenDB6, ServiceControl.Persistence.RavenDB6 and ServiceControl.Audit.Persistence.RavenDB6 have no source of their own. They link the same source, define RAVENDB6 through src/RavenDB6.props and build against RavenDB.Embedded 6.2.18.
  • The differences between the two clients sit behind RavenClientCompatibility and RavenServerLogLevel. Feature code has no conditional compilation. With RAVENDB6 the behavior is the one on master.
  • TestHelper no longer references RavenDB, so a test project can bind either version.

Constraints that must hold

  • Both flavours keep the same assembly names. Stored documents carry assembly-qualified type names (RavenPersistedTypes.Verify.approved.txt), so a renamed assembly could not read existing data. The flavours never share a folder: each persister loads from its own directory in its own PluginAssemblyLoadContext.
  • RavenDB must never resolve to the 7.2 persister. A wrong match starts a 7.2 server on 6.2 data and converts it. Because the two manifests share a type name, the lookup matches names and aliases across all manifests before it considers type names, and the 6.2 manifest lists its own type name as an alias. Unit tests cover both manifest orders.
  • Legacy is marked, current code is the default. Everything that belongs to RavenDB 6.2 has RavenDB6 in its name or sits behind RAVENDB6, so removing it is a deletion.

Alternatives considered

  • Bundle the RavenDB 7.2 upgrade as Update RavenDB to 7.2.7 #6049 has it. Rejected for the reason above: it forces the conversion before a SQL migration and on audit instances that are about to be replaced.
  • Drop the RavenDB 7.2 upgrade from this major version. RavenDB 6.2 is supported until December 31, 2027 (https://ravendb.net/support). Dropping the upgrade defers the same forced conversion to that deadline, and every instance created on 6.2 until then adds to it.
  • One persister on the 6.2 client with two server versions. RavenDB clients work against a server of the same or a higher version (https://docs.ravendb.net/7.2/client-api/faq/backward-compatibility), but a 6.2 embedded launcher starting a 7.2 server is not a combination RavenDB documents. Not tried.
  • A frozen copy of the 6.2 persister code. The version-specific differences are a handful of call sites, so sharing the source keeps fixes in one place.

Verification

Run on macOS; nothing here has run on Windows yet.

  • The solution builds in Debug and Release without warnings.
  • The 6.2 outputs and deploy/.../Persisters/RavenDB carry Raven.Client 6.2.18 with a 6.2.18 server; the 7.2 outputs and Persisters/RavenDB7 carry 7.2.7 with a 7.2.7 server.
  • Manifest lookup tests pass: 10 in ServiceControl.UnitTests, 15 in ServiceControl.Audit.UnitTests.
Suite RavenDB 6.2 (Raven6) RavenDB 7.2 (Raven)
Persistence tests, error instance 440 passed 441 passed
Persistence tests, audit instance 118 passed 118 passed
Acceptance tests, error instance 229 passed, 2 skipped 229 passed, 2 skipped
Acceptance tests, audit instance 75 passed 75 passed
Multi-instance acceptance tests not run on 6.2 23 passed

The one test of difference in the persistence tests is EmbeddedServerLoggingTests, which reads a setting that only the 7.2 server reports and is excluded from the 6.2 run. The two skipped acceptance tests are the same on both versions and apply to the SQL persisters. Index definitions and persisted types are identical on both versions: the 6.2 test projects approve against byte-identical copies of the approved files.

The packaging and installer changes compile on macOS only. Their tests ran in CI: Windows-DefaultCore, Linux-DefaultCore and the Windows installer build pass.

The database image was built locally for arm64 in both variants and run against real data: the RavenDB 7 image refused a volume holding a RavenDB 6 database and left it readable by RavenDB 6, converted it once RAVENDB7_ACCEPT_STORAGE_CONVERSION=true was set, and the RavenDB 6 image refused the converted volume.

Not verified yet: the app images were not built locally, and the image and publishing workflows have only been linted. CI cannot build the app images at the moment because NuGet audit fails on System.Formats.Cbor 10.0.14 (advisory published 2026-11-10, fixed in 10.0.15), which is unrelated to this change and also skips the container integration test.

Status

  • Persister flavours, manifests and manifest lookup
  • Test projects for the 6.2 persisters and a Raven6 CI category
  • Packaging and installer: two server archives, the server that matches the persister, RavenDB7 for new instances (compiled on macOS only; the Windows CI run is the verification)
  • An explicit action to move an instance from RavenDB 6 to RavenDB 7, in the PowerShell module and ServiceControl Management
  • Containers: RavenDB7 as the image default, a -ravendb6 tag line for the database image, and a guard against converting by accident (workflows unverified until CI can build the images)
  • docs/packaging.md and docs/testing.md
  • Decision record in docs/decisions/, if wanted

On the commits before the packaging and installer work, CI passed everything except the eight packaging and installer tests that work updates, including Raven and Raven6 on Windows and Linux.

Internal engineering context was checked for this decision area. The records for it are not available to agents, so nothing from them is used here.

TestHelper is referenced by about 38 test projects and brought RavenDB.Embedded
and ServiceControl.RavenDB into every one of them. A test project for the
RavenDB 6.2 persisters would therefore get the 7.2 client next to a persister
compiled against 6.2.

The two RavenDB helpers move to the RavenDB persistence test project and are
linked as source by the test projects that use them. The two test projects
that used RavenDB types only through TestHelper reference RavenDB.Embedded
directly, at the same version as before.
Opening a RavenDB 6.2 database with a 7.2 server converts it one-way, which
takes more than a day on a large audit database. An instance that will move
to SQL Server or PostgreSQL, or an audit instance that is about to be
replaced, should not have to convert first. ServiceControl therefore needs to
run on either RavenDB version.

The existing RavenDB projects stay the RavenDB 7.2 persisters, now with the
manifest name RavenDB7. Three projects without source of their own,
ServiceControl.RavenDB6, ServiceControl.Persistence.RavenDB6 and
ServiceControl.Audit.Persistence.RavenDB6, link the same source, define
RAVENDB6 and build against RavenDB.Embedded 6.2.18. They keep the manifest
name RavenDB, with the alias RavenDB6, so existing instances stay on the
storage they have.

Both flavours keep the same assembly names because stored documents carry
assembly-qualified type names. The manifests therefore share a type name, so
the lookup matches names and aliases before type names. RavenDB, RavenDB6 and
the old type names resolve to the 6.2 persister, and only RavenDB7 resolves to
the 7.2 persister.

The differences between the two clients sit behind RavenClientCompatibility
and RavenServerLogLevel. With RAVENDB6 the behavior is the one on master.
The existing RavenDB test projects test the 7.2 persisters only, so nothing
exercised the 6.2 persisters that existing instances keep running on.

Four test projects without tests of their own link the sources of the
matching RavenDB test project, define RAVENDB6 and reference the 6.2
persisters: ServiceControl.Persistence.Tests.RavenDB6,
ServiceControl.Audit.Persistence.Tests.RavenDB6,
ServiceControl.AcceptanceTests.RavenDB6 and
ServiceControl.Audit.AcceptanceTests.RavenDB6. They form the Raven6 test
category, which CI runs next to Raven.

Expectations that differ between the versions come from production code, so
the tests carry one conditional, the persistence type each flavour selects.
EmbeddedServerLoggingTests is excluded from the 6.2 run because it reads a
setting that only the 7.2 server reports. Particular.Approvals reads approved
files from the running test project, so the 6.2 persistence test projects
hold copies of the approved files. The copies are identical: index
definitions and persisted types do not differ between the two versions.

The multi-instance tests keep running on the 7.2 persisters only.
New instances default to RavenDB 7.2. RavenDB as persistence type now selects
the 6.2 persister, so the development configuration of the error and audit
instances names RavenDB7.
Each RavenDB persister starts the server it finds in a RavenDBServer folder
next to its own assembly, and the two persisters need different servers. The
installer shipped one archive, and in CI it held the 7.2 server under the
name the 6.2 persister uses.

RavenDBServer.zip now holds the 6.2 server, pinned by RavenDB6Version, and
RavenDB7Server.zip holds the 7.2 server, pinned by RavenDB.Embedded. The
download script used in CI fetches both self-contained servers, and the
packaging build fails with the name of the missing folder when one is absent.
A RavenDB 7.2 server that opens a 6.2 database converts it one-way, so the
installer must never place a 7.2 server where the 6.2 persister starts it,
and must never move an existing instance to RavenDB7 on its own.

An instance on RavenDB7 gets the 7.2 server under Persisters\RavenDB7. Every
other instance, including those on SQL Server and PostgreSQL, keeps the 6.2
server under Persisters\RavenDB: a migration from RavenDB to SQL reads the
old database through the RavenDB persister after the persistence type has
changed. The rule lives in RavenDBServerPackage, and an upgrade applies it to
the persister the instance already has.

New instances, and a forced upgrade that abandons a RavenDB 3.5 database, are
created on RavenDB7.

The installer resolves persistence names the way the instances do: names and
aliases before type names, so RavenDB, RavenDB6 and the old type names
select the 6.2 persister.

The storage conversion check compares the server the instance runs today
with the archive bundled for the persister it will run. Upgrading a
ServiceControl 6 instance on RavenDB therefore no longer warns and no longer
converts. The check also answers whether moving an instance from RavenDB to
RavenDB7 would convert its data.
The platform sample creates fresh databases and references the RavenDB 7.2
server package, but packaged Persisters\RavenDB, which is now the 6.2
persister. It packages Persisters\RavenDB7 instead. A consumer has to set
the persistence type to RavenDB7.
New deployments default to RavenDB 7.2, and RavenDB as persistence type now
selects the 6.2 persister. The ServiceControl and ServiceControl.Audit images
therefore set PersistenceType to RavenDB7. Both persisters are in the images,
so a deployment that stays on RavenDB 6 sets PersistenceType to RavenDB.
…ng by accident

A RavenDB 7.2 server that opens a 6.2 data directory converts it one-way,
which can take days. Deployments usually pin all images to one ServiceControl
version, so moving that version from 6 to 7 would start the conversion
without anyone having decided to.

servicecontrol-ravendb:<tag> is RavenDB 7.2. servicecontrol-ravendb:<tag>-ravendb6
is RavenDB 6.2, for deployments that stay on PersistenceType=RavenDB. Both
lines are built for every architecture and published for every tag.

The RavenDB 7 image writes a marker file into the data directory. On a data
directory that holds databases and no marker it refuses to start, and names
the two ways forward: the -ravendb6 tag with PersistenceType=RavenDB, or
RAVENDB7_ACCEPT_STORAGE_CONVERSION=true to convert. The RavenDB 6 image
refuses to start on a data directory that carries the marker. The variable
does not start with RAVEN_ because the server reads those as its settings.

The RavenDB 6 image builds from the ubuntu.22.04 base image because RavenDB
publishes no ubuntu.24.04 image for 6.2.
The integration test started the instances against the default database
image only. An additional case starts them with PersistenceType=RavenDB
against the -ravendb6 database image, so the combination that existing
deployments stay on is exercised too.
When the RavenDB server is older than the client, ServiceControl told the
operator to upgrade the server. For the RavenDB 7.2 persister facing a
RavenDB 6 server that advice starts a one-way conversion of the data.

The message for a 7.x client and a server before 7 now names both options:
stay on RavenDB 6 with PersistenceType=RavenDB and the -ravendb6 database
image, or move the server to RavenDB 7, which converts the data. The rule
uses the client version the check already receives, so the 6.2 persister
keeps the previous message.
@danielmarbach

Copy link
Copy Markdown
Contributor Author

Closing for now since we will be moving forward with this in some minor after the current major is released

@danielmarbach
danielmarbach deleted the ravendb-6-7-coexistence branch November 17, 2026 09:33
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