[SPIKE] Adding all implementations for SqlServer, MySql and Postgresql persistence#5224
Draft
johnsimons wants to merge 23 commits intomasterfrom
Draft
[SPIKE] Adding all implementations for SqlServer, MySql and Postgresql persistence#5224johnsimons wants to merge 23 commits intomasterfrom
johnsimons wants to merge 23 commits intomasterfrom
Conversation
e9f8cf8 to
b8b61fc
Compare
Refactors the upsert logic in several data stores to leverage EF Core's change tracking more efficiently. Instead of creating a new entity and then calling Update, the code now fetches the existing entity (if any) and modifies its properties directly. This reduces the overhead and potential issues associated with detached entities. The RecoverabilityIngestionUnitOfWork is also updated to use change tracking for FailedMessageEntity updates. This commit was made on the `john/more_interfaces` branch.
Adds data store and entities required for persisting licensing and throughput data. This includes adding new tables for licensing metadata, throughput endpoints, and daily throughput data, as well as configurations and a data store implementation to interact with these tables.
0c8bfe9 to
34b8228
Compare
Also added headers to the serialised entity
Updates data stores to utilize IServiceScopeFactory instead of IServiceProvider for creating database scopes. This change improves dependency injection and resource management, ensuring proper scope lifecycle management, especially for asynchronous operations.
Adds full-text search capabilities for error messages, allowing users to search within message headers and, optionally, the message body. Introduces an interface for full-text search providers to abstract the database-specific implementation. Stores small message bodies inline for faster retrieval and populates a searchable text field from headers and the message body. Adds configuration option to set the maximum body size to store inline.
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.
SQL Persistence Implementation for ServiceControl
Summary
Implements SQL persistence layer for ServiceControl with support for SQL Server, PostgreSQL, and MySQL. Introduces Entity Framework Core-based implementation as an alternative to the existing RavenDB persistence.
Key Changes
Core Persistence Infrastructure (
ServiceControl.Persistence.Sql.Core)ServiceControlDbContextBasewith 16 entity setsBasePersistence,SqlPersisterSettings)Provider-Specific Implementations
Data Store Implementations
All 19+ persistence interfaces implemented including:
ErrorMessageDataStore,BodyStorage)RetryBatchesDataStore,RetryDocumentDataStore,RetryHistoryDataStore)MonitoringDataStore,CustomChecksDataStore)EndpointSettingsStore,QueueAddressStore,NotificationsManager)Testing
Design Decisions
Data Modeling
FailedMessageEntitystores fullProcessingAttemptsJsonbut denormalizesLastProcessedAt,MessageType,ExceptionTypefor query performanceMessageBodiestable to keep primary tables lean and improve query performanceRetryHistoryEntity,NotificationsSettingsEntity) use fixed IDs as they represent single configuration recordsQuery Optimization
Best Way to Review
1. Start with the abstractions (understand the architecture)
2. Review the data model (entities represent the domain)
3. Check one provider implementation (SQL Server recommended)
4. Review key data store implementations (focus on complex ones)
5. Spot-check tests (verify integration test coverage)
Migration Notes