Particular / ServiceControl

Backend for ServiceInsight and ServicePulse
https://docs.particular.net/servicecontrol/
Other
52 stars 47 forks source link

Indexes not auto re-created when database folder is removed when using RavenDB 5 storage engine (v4.30) #3498

Open ramonsmits opened 1 year ago

ramonsmits commented 1 year ago

Describe the bug

Description

All SC instances that use RavenDB 3.5 auto recreated the database including any indexes. This was useful as a user could just stop an instance, delete the folder and start the instance and the database was recreated without issues.

Expected behavior

Same behavior as RavenDB 3.5 instances

Actual behavior

Some database content gets recreated but not the indexes.

Versions

Please list the version of the relevant packages or applications in which the bug exists.

4.30.0

Steps to reproduce

  1. Stop instance
  2. Delete DBPath folder contents or the whole folder
  3. Start instance

Relevant log output

The log file shows:

2023-04-18 15:23:24.6381|7|Info|Microsoft.Hosting.Lifetime|Application started. Hosting environment: Production; Content root path: C:\Program Files (x86)\Particular Software\Particular.Test.Audit\
2023-04-18 15:23:24.8431|9|Error|NServiceBus.CustomChecks.TimerBasedPeriodicCheck|'ServiceControl.Audit.Auditing.FailedAuditImportCustomCheck' implementation failed to run.
Raven.Client.Exceptions.Documents.Indexes.IndexDoesNotExistException: Could not find index FailedAuditImportIndex

Additional Information

Workarounds

Users can run the instance setup via:

ServiceControl.Audit.exe /setup

Possible solutions

  1. Have the same behavior as RavenDB 3.5 engines
  2. Have the ability to run a setup action in the SCMU interface advanced options

Additional information

mauroservienti commented 1 year ago

A connected issue is that in the documentation about troubleshooting corrupted indexes we link to the RavenDB documentation on how to reset indexes, but that's not relevant for RavenDB 5 because it doesn't expose that option in the studio. That means users will try the suggested option to delete the indexes folder and end up with an audit instance that cannot start.