Skip to content

Add documentation for ServiceControl SQL storage - #8499

Open
rbev wants to merge 90 commits into
masterfrom
sc-sql-support
Open

rbev wants to merge 90 commits into
masterfrom
sc-sql-support

Conversation

@rbev

@rbev rbev commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Documentation updates for ServiceControl v7

@rbev
rbev changed the base branch from master to sc-sql-support-02-move-pages October 26, 2026 05:47
@rbev
rbev added this pull request to stack #8598 October 26, 2026 05:48
Base automatically changed from sc-sql-support-02-move-pages to master October 27, 2026 05:39
@rbev
rbev marked this pull request as ready for review October 27, 2026 05:40
@rbev
rbev marked this pull request as draft October 27, 2026 05:40
abparticular and others added 6 commits November 24, 2026 15:15
Point to the specific StorageType setting and link to the external
message body storage page, since switching `MessageBody/*` settings
only changes where new messages are stored, not existing ones.
Use `MessageBody/*` instead of `MessageBody` to indicate these are multiple related settings, not a single key.

@ramonsmits ramonsmits left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many questions... but this is a massive PR that took me a long time to review and even that I did very fast.

I see many things changes in this PR that logically do no belong together. A stacked PR that groups different logical changes would have been useful


Each of these services can also use [managed identity](/servicecontrol/transports.md#azure-service-bus-enabling-managed-identity) instead of the keys and passwords shown; see [SQL Server authentication](/servicecontrol/storage/sqlserver/#authentication) and [Azure Blob Storage authentication](/servicecontrol/storage/external-body/azure-blob.md#authentication).

The `STORAGETYPE` environment variable is required. SQL Server and PostgreSQL storage also require an [external message body store](/servicecontrol/storage/external-body/), selected with `MESSAGEBODY_STORAGETYPE`: [file system](/servicecontrol/storage/external-body/file.md), [Azure Blob Storage](/servicecontrol/storage/external-body/azure-blob.md), or [Amazon S3](/servicecontrol/storage/external-body/amazon-s3.md). For PostgreSQL, set `STORAGETYPE` to `PostgreSQL` and use a [PostgreSQL connection string](/servicecontrol/storage/postgresql/). For RavenDB, set `STORAGETYPE` to `RavenDB` and replace the database and message body variables with `RAVENDB_CONNECTIONSTRING`, as described in [RavenDB container setup](/servicecontrol/storage/ravendb/containers.md). See [Storage selection](#required-settings-storage-selection).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see many of these constructs where multiople storage options are written in the same paragraph. That is very confusing. I think it helps if these options have separarate sections or even separate pages.


The `STORAGETYPE` environment variable is required. SQL Server and PostgreSQL storage also require an [external message body store](/servicecontrol/storage/external-body/), selected with `MESSAGEBODY_STORAGETYPE`: [file system](/servicecontrol/storage/external-body/file.md), [Azure Blob Storage](/servicecontrol/storage/external-body/azure-blob.md), or [Amazon S3](/servicecontrol/storage/external-body/amazon-s3.md). For PostgreSQL, set `STORAGETYPE` to `PostgreSQL` and use a [PostgreSQL connection string](/servicecontrol/storage/postgresql/). For RavenDB, set `STORAGETYPE` to `RavenDB` and replace the database and message body variables with `RAVENDB_CONNECTIONSTRING`, as described in [RavenDB container setup](/servicecontrol/storage/ravendb/containers.md). See [Storage selection](#required-settings-storage-selection).

SQL Server and PostgreSQL storage, and the `STORAGETYPE` setting, are available from ServiceControl 7. Earlier versions support only RavenDB storage: leave out `STORAGETYPE` and the database and message body variables, and set `RAVENDB_CONNECTIONSTRING` instead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when a user sets both RAVENDB_CONNECTIONSTRING and DATABASE_CONNECTIONSTRING?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whichever one isn't used by the selected STORAGETYPE gets ignored.

Although this is actually a required state during migration as we need to connect to Raven from the migration engine. We have not addressed a future state where a migration source and destination have overlapping configuration values, however the likely answer would be to provide them to the migration source using a prefix.

The Audit instance is stateless and does not require any mounted volumes.
The Audit instance container keeps no data of its own. With RavenDB storage, the data is in the RavenDB database. With SQL Server or PostgreSQL storage, the data is in the database and in the message body store. A mounted volume is needed only in these cases:

- **File system message body storage:** mount a durable volume at the path set by `SERVICECONTROL_AUDIT_MESSAGEBODY_FILESYSTEM_STORAGEPATH`. Do not share the volume path with another instance, unless the instances [share a database](/servicecontrol/audit-instances/scaling-out-ingestion.md#sql-storage-shared-database), in which case they must share the volume. See the [file system message body storage guide](/servicecontrol/storage/external-body/file.md). Azure Blob Storage and Amazon S3 need no volume.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does a customer make the file storage redundant to achieve high availability? I'm surprised there is not a BLOB storage in the database. A database is convenient due to its replication/ log shipping options. Using the file system to achieve this seems more complex.


## Storage

Each Audit instance must select its storage type with `ServiceControl.Audit/StorageType`: RavenDB, SQL Server, or PostgreSQL. There is no default. SQL Server and PostgreSQL storage, and the `StorageType` setting, are available from ServiceControl 7. Earlier versions store data in RavenDB.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to split this. Have you considered applying https://www.asd-ste100.org

component: ServiceControl
---

SQL Server and PostgreSQL storage are available from ServiceControl 7. Upgrading an existing instance to version 7 doesn't change its storage: it continues to use RavenDB with its existing data. How to move to SQL storage depends on the instance type:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a section to help customer determine if/when then should migration to SQL (and any of its implementations)

Comment thread servicecontrol/upgrades/6to7.md Resolved

- **Upgrading with the ServiceControl Management Utility or PowerShell:** no action is required. Upgrading an instance sets its storage type to `RavenDB` in the configuration file.
- **PowerShell scripts that create instances:** add `-StorageType RavenDB` to each `New-ServiceControlInstance` and `New-ServiceControlAuditInstance` call. The version 7 cmdlets require the parameter, and the version 6 cmdlets do not accept it.
- **Containers:** add the [`STORAGETYPE`](/servicecontrol/servicecontrol-instances/deployment/containers.md#required-settings-storage-selection) environment variable with the value `RavenDB` to each Error and Audit container. Version 6 images selected RavenDB automatically.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when the image is updated to 7.x and the volume already has data? Does v7 detect that? Will it indicate in the logs that envvars are missing including suggestion values based on envionment, existing data?

Will it provide a link to the upgrade guide so users that use latest (which is not recommended... but for sure happens) will be guided to help to complete the migration?


| Path | Rights |
|------|--------|
| Body storage path (the `ServiceControl/MessageBody/FileSystem/StoragePath` or `ServiceControl.Audit/MessageBody/FileSystem/StoragePath` setting) | Read, write, and delete at runtime. The identity that runs setup must also be able to create the directory. |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read no where what the file caching settings must be to ensure data isn't lost on powerfailure

#### Critical message database storage space

This is similar to the [Message database storage space check](#notifications-health-monitoring-message-database-storage-space). However, in this case, if the drive containing the database has less than 5% remaining of its total capacity, message ingestion on the ServiceControl instance is stopped to prevent data loss, and a failure is reported. This threshold is controlled by the [ServiceControl/MinimumStorageLeftRequiredForIngestion](/servicecontrol/servicecontrol-instances/configuration.md#troubleshooting-servicecontrolminimumstorageleftrequiredforingestion) (for the error instance) and [ServiceControl.Audit/MinimumStorageLeftRequiredForIngestion](/servicecontrol/audit-instances/configuration.md#troubleshooting-servicecontrol-auditminimumstorageleftrequiredforingestion) (for the audit instance) settings.
This check applies only to RavenDB storage. It is similar to the [Message database storage space check](#notifications-health-monitoring-message-database-storage-space). However, in this case, if the drive containing the database has less than 5% remaining of its total capacity, message ingestion on the ServiceControl instance is stopped to prevent data loss, and a failure is reported. This threshold is controlled by the [ServiceControl/MinimumStorageLeftRequiredForIngestion](/servicecontrol/servicecontrol-instances/configuration.md#storage-servicecontrolminimumstorageleftrequiredforingestion) (for the error instance) and [ServiceControl.Audit/MinimumStorageLeftRequiredForIngestion](/servicecontrol/audit-instances/configuration.md#troubleshooting-servicecontrol-auditminimumstorageleftrequiredforingestion) (for the audit instance) settings.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This check applies only to RavenDB storage. It is similar to the [Message database storage space check](#notifications-health-monitoring-message-database-storage-space). However, in this case, if the drive containing the database has less than 5% remaining of its total capacity, message ingestion on the ServiceControl instance is stopped to prevent data loss, and a failure is reported. This threshold is controlled by the [ServiceControl/MinimumStorageLeftRequiredForIngestion](/servicecontrol/servicecontrol-instances/configuration.md#storage-servicecontrolminimumstorageleftrequiredforingestion) (for the error instance) and [ServiceControl.Audit/MinimumStorageLeftRequiredForIngestion](/servicecontrol/audit-instances/configuration.md#troubleshooting-servicecontrol-auditminimumstorageleftrequiredforingestion) (for the audit instance) settings.
Maybe make more use of NOTE WARNING, etc.
> [!NOTE]
> This check applies only to RavenDB storage.
It is similar to the [Message database storage space check](#notifications-health-monitoring-message-database-storage-space). However, in this case, if the drive containing the database has less than 5% remaining of its total capacity, message ingestion on the ServiceControl instance is stopped to prevent data loss, and a failure is reported. This threshold is controlled by the [ServiceControl/MinimumStorageLeftRequiredForIngestion](/servicecontrol/servicecontrol-instances/configuration.md#storage-servicecontrolminimumstorageleftrequiredforingestion) (for the error instance) and [ServiceControl.Audit/MinimumStorageLeftRequiredForIngestion](/servicecontrol/audit-instances/configuration.md#troubleshooting-servicecontrol-auditminimumstorageleftrequiredforingestion) (for the audit instance) settings.


#### SQL storage retention

SQL Server and PostgreSQL storage use periodic retention sweeps to delete expired data. If three consecutive sweeps fail, a failure is reported. The check clears when a sweep succeeds. Check the instance logs for the cause of the failures.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this reported? Via a custom check?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, custom checks are used to report on the retention sweeps.

The Audit removal snippet called Remove-AuditInstance and the alias table listed Get-ServiceControlMgmtCommands. Neither cmdlet exists. The module exports Remove-ServiceControlAuditInstance and Get-ServiceControlManagementCommands, which the rest of both pages already use.
…settings

The StoragePath, ContainerName and KeyPrefix settings told readers to use a separate location for every Audit instance. Audit instances that share a SQL database must share one message body store, as the scaling-out guide says. An instance that followed the setting reference could not read bodies written by the other instances.
…irectory

The data removal option deletes the whole message body directory. When Audit instances share a database they also share that directory, so removing one instance with -RemoveDB, or with Remove message body files in ServiceControl Management, deletes the bodies the other instances still need.
ServiceControl Management and the PowerShell module reject UNC paths and mapped network drives for the message body path, and -Force does not override that. They also refuse a directory that already contains files unless the user confirms, which is -Force in PowerShell. The file system page says a shared database needs a shared mount, so it now also says that these tools cannot be given one.
ServiceControl Management and PowerShell do not set Database/Schema. A second Audit instance, or a second Error instance, created against the same database therefore writes to the same tables as the first, while each instance gets its own message body directory. The SQL Server and PostgreSQL pages now say to use separate databases, and point to the scaling-out guide for sharing one on purpose.
The Storage section of the Error and Audit configuration pages mixed settings for every storage type under one heading. It is now four sections on both pages: Storage, SQL Server and PostgreSQL storage, Message body storage, and RavenDB storage.

All settings that apply only to RavenDB move to the RavenDB storage section, and each has an "Applies only to RavenDB storage" line under its heading. On the Audit page they came from Host settings, Embedded database, Data retention, Performance tuning and Troubleshooting, so their anchors change. Links to those anchors are updated across the repository.

The sentences that sat between settings are now part of the section introductions, and MaxBodySizeToStore describes its effect per storage type in a table.
The container pages showed one example and then described the other storage types as changes to it, in a paragraph that also covered message body stores and version 6. Required settings listed only STORAGETYPE.

Required settings now has a section for SQL Server, PostgreSQL, RavenDB, and message body storage. Each lists its variables and a complete fragment to copy. The version 6 instruction is in the RavenDB section only, and Volumes has one list item per storage type.
…ement pages

Deploying an instance with PowerShell now has a subsection for RavenDB storage, one for SQL Server or PostgreSQL storage, and one for the message body storage parameters. The parameters that apply to every storage type come first.

The ServiceControl Management page has a Storage type subsection with a table of the fields each storage type needs.

Both pages describe what removing an instance deletes with one shared table, by storage type.
The rule that each instance needs its own message body location, unless instances share a database, was written out on about ten pages, and some copies had lost the exception. It now has its own section on the external message body storage page, and the other pages link to it.

Also in this commit: the health checks that apply only to RavenDB say so in a note, the storage overview states the version difference in its own paragraph, and the version 6 to 7 summary table lists the action for each deployment method on its own line.
Agents wrote several storage types into one paragraph and described one option as changes to another option's example. The new section tells them to give each option its own heading, table row or list item, and to state a rule once and link to it.
johnsimons and others added 3 commits November 25, 2026 15:59
Co-authored-by: Rhys Bevilaqua <rhys.bevilaqua@particular.net>
… PostgreSQL instances; update related documentation for retention periods and storage behavior.
@rbev
rbev marked this pull request as ready for review November 25, 2026 06:23
warwickschroeder and others added 3 commits November 25, 2026 14:49
Separate the storage types in the ServiceControl docs and fix five accuracy issues
With SQL Server or PostgreSQL storage and file system message body storage, an instance writes one file for each message body. Antivirus real-time scanning of these files increases CPU usage and decreases ingestion throughput.

- Add a 'Message body directories' section to the anti-virus checks.
- Link to it from the two StoragePath settings.
johnsimons and others added 4 commits November 26, 2026 11:23
Add antivirus guidance for file system message body storage
Updated the Error instance section to include a link to the issue for clarity.
Updated the note on Error instance to use lowercase 'keep'.
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.

5 participants