Repository navigation
Query the throughput endpoints through a static index - #6099
Open
mauroservienti wants to merge 5 commits into
Open
mauroservienti wants to merge 5 commits into
mauroservienti wants to merge 5 commits into
Conversation
IndexDeployment always deployed to the default database of the store. The throughput indexes belong to the throughput database, which shares the store with the error database. Take an optional database name, and expose the index discovery so callers can split the indexes by database.
The licensing queries on EndpointDocuments were dynamic, so RavenDB created auto indexes in the throughput database, for example Auto/EndpointDocuments/ByEndpointId.ThroughputSource. An auto index has no per-index search engine setting, so the search engine custom check keeps failing after all static indexes use Lucene. EndpointIndex existed but was deployed to the error database, which has no endpoint documents, and its field names did not match the queries. Deploy it to the throughput database, map the fields the queries filter on with the names the client uses for nested properties, and query through it. Queries without a filter, or only on the document id, stay collection queries, which create no index. UpdateUserIndicatorOnEndpoints writes based on its query results, so it waits for non-stale results instead of skipping endpoints that were just saved.
mauroservienti
marked this pull request as draft
November 10, 2026 13:06
mauroservienti
requested review from
PhilBastian,
danielmarbach,
mikeminutillo,
ramonsmits and
saratry
November 10, 2026 13:09
2 tasks
The licensing queries read their own writes: a usage report reads the throughput that was just recorded, and the connection test checks for throughput that just arrived from monitoring. Before, the first dynamic query on a new database created the auto index and RavenDB waited for it. A static index that already exists can be stale, which failed EndpointsTests and the usage report acceptance test on the Windows build. Query EndpointIndex through one helper that waits for non-stale results. The index has one entry per endpoint and source, so the wait is short.
mauroservienti
marked this pull request as ready for review
November 10, 2026 16:16
saratry
approved these changes
Nov 11, 2026
ramonsmits
pushed a commit
that referenced
this pull request
Nov 11, 2026
* Query the event log through a static index GetEventLogItems ran a dynamic query on EventLogItems sorted by RaisedAt. RavenDB serves that with an Auto/EventLogItems/ByRaisedAt index, which exists on every error database that ServicePulse has read the event log from. An auto index has no per-index search engine setting, so the "Error Database Search Engine" custom check keeps failing after all static indexes are migrated to Lucene. Add EventLogItems_ByRaisedAt and query through it. * Fail RavenDB persistence tests that create an auto index Each test gets its own error database. Before deleting it, list the auto indexes in it and fail the test if there are any, so a new dynamic query in a data store is caught by the tests that exercise it. With the event log query fixed, the suite creates no auto index in the error database. The throughput database is not checked yet: its licensing queries still create auto indexes until #6099 is merged.
Earlier versions deployed all indexes in the assembly to the error database, including the throughput EndpointIndex that no query there uses.
…g it RavenDB ignores the deletion of a LockedIgnore index and rejects that of a LockedError index. An operator might have locked the index after migrating it to Lucene.
This was referenced Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The licensing queries on
EndpointDocumentswere dynamic. RavenDB served them with auto indexes in the throughput database, for exampleAuto/EndpointDocuments/ByEndpointId.ThroughputSource. Same problem as #5953 for retry batches.Analysis
Indexing.Auto.SearchEngineTypeand has no per-index search engine setting. The migration procedure in the docs changes the engine per index, so it cannot change these indexes. The search engine custom check and the start-up warning keep reporting them after all static indexes use Lucene.EndpointIndexexisted, butDatabaseSetupdeployed every index in the assembly to the error database, which has no endpoint documents. The throughput database had no static index.ThroughputSourceandName. The client maps a query onEndpointId.ThroughputSourceto the fieldEndpointId_ThroughputSource, so the index could not serve the queries even in the right database.Changes
IndexDeployment.CreateIndexesAsynctakes an optional database name.IndexDeployment.FindIndexesexposes the discovery, whichTestHelper.IndexDefinitionTextnow reuses.DatabaseSetupdeploys the indexes in theThroughput.Indexesnamespace to the throughput database and all others to the error database.EndpointIndexmapsEndpointId_ThroughputSource,EndpointId_Name,SanitizedNameandEndpointIndicators.LicensingDataStorego throughEndpointIndex. Queries without a filter, or only on the document id, stay collection queries, which create no index and are never stale.EndpointIndexwaits for non-stale results, through one helper. The callers read their own writes: a usage report reads the throughput that was just recorded, the monitoring connection test checks for throughput that just arrived, andUpdateUserIndicatorOnEndpointsupdates the documents the query returns. Before, the first dynamic query on a new database created the auto index and RavenDB waited for it. Without the wait,EndpointsTestsandWhen_creating_a_usage_report_on_a_non_broker_transportfailed on the Windows build. The index has one entry per endpoint and source, so the wait is short. If it stays stale for longer than the default 15 seconds, the query throws instead of returning stale results.LicensingDataStoreIndexTests.Licensing_queries_create_no_auto_index. It fails without the change and passes with it.DatabaseSetupdeletes the throughput indexes from the error database, if they are there, before deploying the indexes. A locked index is unlocked first: RavenDB ignores the deletion of aLockedIgnoreindex and rejects that of aLockedErrorindex, and an operator might have locked it after migrating it to Lucene. New testThroughputIndexPlacementTests.Setup_should_delete_the_throughput_index_from_the_error_database, for each lock mode.Existing databases
EndpointIndexin the throughput database is new and covers one document per endpoint and source.EndpointIndexin the error database is deleted at start-up. The auto indexes in the throughput database are deleted by RavenDB once idle, or can be deleted in RavenDB Studio.IndexDefinitionApprovalschanged because of the newEndpointIndexdefinition. Followingdocs/testing.md, the upgrade guide of the next release needs an entry, which belongs in docs.particular.net.Testing
ServiceControl.Persistence.Tests.RavenDB, filterThroughput|IndexDefinitionApprovals|IndexSetupTests: all pass except tests that fail in setup with a refused connection to the shared embedded server on port 33334, which also happens onmaster.ServiceControl.Audit.Persistence.Tests.RavenDB, filterIndexSetupTests|IndexDefinitionApprovals|DatabaseSettingsTests: 26/26.Open points
docs/testing.mdasks.