Conversation
Here's a summary of every change made: New files File Purpose src/SqliteErrorCodes.cs Internal constants and classifiers for SQLITE_BUSY, SQLITE_BUSY_SNAPSHOT (517), SQLITE_BUSY_RECOVERY, SQLITE_LOCKED, etc. src/Models/SqliteSynchronousMode.cs Enum for PRAGMA synchronous (Off/Normal/Full/Extra) with full durability trade-off documentation src/Models/WalCheckpointStatus.cs Record returned by GetWalCheckpointStatusAsync — exposes busy flag, total frames, checkpointed frames, and progress % Modified files SqliteConcurrencyOptions.cs Added SynchronousMode (default Normal), UpgradeTransactionsToImmediate (default true), LoggerFactory (excluded from equality) Added Validate() with bounds checks on all numeric properties Updated Equals/GetHashCode to include new behavior-affecting properties SqliteConcurrencyInterceptor.cs Creates ILogger<SqliteConcurrencyInterceptor> from options.LoggerFactory Logs SQLITE_BUSY_SNAPSHOT (Warning), SQLITE_BUSY (Warning), and SQLITE_LOCKED (Error) in CommandFailed/CommandFailedAsync Logs BEGIN IMMEDIATE upgrades at Debug level Respects UpgradeTransactionsToImmediate = false; also now catches BEGIN DEFERRED SqliteConnectionEnhancer.cs Uses options.SynchronousMode.ToString().ToUpperInvariant() instead of hardcoded NORMAL Added inline comments on every pragma explaining the reason, trade-off, and safe range Added GetWalCheckpointStatusAsync() — runs PRAGMA wal_checkpoint(PASSIVE) and returns WalCheckpointStatus SqliteConcurrencyExtensions.cs Calls options.Validate() on startup Retry now catches via SqliteErrorCodes.IsAnyBusy() (covers all extended codes); SQLITE_LOCKED propagates immediately Backoff replaced with exponential + full jitter: sleep in [baseDelay, 2×baseDelay] ThreadSafeSqliteContext.cs Same SqliteErrorCodes-based retry; SQLITE_BUSY_SNAPSHOT restarts the full operation lambda (correct semantics — stale data is re-queried) Jitter added to backoff TimeoutException message now identifies whether it was a snapshot error and includes the extended error code SqliteConcurrencyServiceCollectionExtensions.cs Resolves ILoggerFactory from the DI container and injects it into options automatically doc/QUICKSTART.md Removed all UseWriteQueue references Replaced the incorrect options table with the real six options, each with accurate defaults and descriptions
What was changed SqliteConcurrencyServiceCollectionExtensions.cs Added AddConcurrentSqliteDbContextFactory<TContext> — registers IDbContextFactory<TContext> with concurrency settings and auto-injected ILoggerFactory. Factory lifetime defaults to Singleton (appropriate since the factory holds no per-request state). Updated AddConcurrentSqliteDbContext XML doc to point users toward the factory overload for concurrent workloads. SqliteConnectionEnhancer.cs ComputeOptimizedConnectionString now throws ArgumentException when Cache=Shared is detected, with a clear message explaining the WAL incompatibility and pointing to connection pooling as the correct alternative. Added TryReleaseMigrationLockAsync — checks for a stale __EFMigrationsLock row and optionally deletes it. Accepts a release: false flag for diagnostic-only checks. Includes full XML docs covering when and why stale locks occur. QUICKSTART.md "Configure" section now shows both registration paths with guidance on when to use each. "Real-World Scenario" corrected: the bad pattern now shows the EF thread-safety violation explicitly, and the good pattern uses IDbContextFactory + CreateDbContext() per task. New "Multi-Instance Deployments and Migration Locks" section with TryReleaseMigrationLockAsync usage and network filesystem warning. Best Practices list updated to 7 items covering factory pattern, Cache=Shared, migration lock, and single-host constraint.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 51 minutes and 15 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR introduces new public APIs for WAL checkpoint monitoring and migration lock management, expands concurrency configuration with synchronous mode and transaction-upgrade settings, adds logging support through interceptors, enhances error classification with better SQLite error handling, and updates DI patterns with factory-based context registration. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
New files
File Purpose
src/SqliteErrorCodes.cs Internal constants and classifiers for SQLITE_BUSY, SQLITE_BUSY_SNAPSHOT (517), SQLITE_BUSY_RECOVERY, SQLITE_LOCKED, etc.
src/Models/SqliteSynchronousMode.cs Enum for PRAGMA synchronous (Off/Normal/Full/Extra) with full durability trade-off documentation
src/Models/WalCheckpointStatus.cs Record returned by GetWalCheckpointStatusAsync — exposes busy flag, total frames, checkpointed frames, and progress %
Modified files
SqliteConcurrencyOptions.cs
Added SynchronousMode (default Normal), UpgradeTransactionsToImmediate (default true), LoggerFactory (excluded from equality)
Added Validate() with bounds checks on all numeric properties
Updated Equals/GetHashCode to include new behavior-affecting properties
SqliteConcurrencyInterceptor.cs
Creates ILogger from options.LoggerFactory
Logs SQLITE_BUSY_SNAPSHOT (Warning), SQLITE_BUSY (Warning), and SQLITE_LOCKED (Error) in CommandFailed/CommandFailedAsync
Logs BEGIN IMMEDIATE upgrades at Debug level
Respects UpgradeTransactionsToImmediate = false; also now catches BEGIN DEFERRED
SqliteConnectionEnhancer.cs
Uses options.SynchronousMode.ToString().ToUpperInvariant() instead of hardcoded NORMAL
Added inline comments on every pragma explaining the reason, trade-off, and safe range
Added GetWalCheckpointStatusAsync() — runs PRAGMA wal_checkpoint(PASSIVE) and returns WalCheckpointStatus
SqliteConcurrencyExtensions.cs
Calls options.Validate() on startup
Retry now catches via SqliteErrorCodes.IsAnyBusy() (covers all extended codes); SQLITE_LOCKED propagates immediately
Backoff replaced with exponential + full jitter: sleep in [baseDelay, 2×baseDelay]
ThreadSafeSqliteContext.cs
Same SqliteErrorCodes-based retry; SQLITE_BUSY_SNAPSHOT restarts the full operation lambda (correct semantics — stale data is re-queried)
Jitter added to backoff
TimeoutException message now identifies whether it was a snapshot error and includes the extended error code
SqliteConcurrencyServiceCollectionExtensions.cs
Resolves ILoggerFactory from the DI container and injects it into options automatically
doc/QUICKSTART.md
Removed all UseWriteQueue references
Replaced the incorrect options table with the real six options, each with accurate defaults and descriptions
What was changed
SqliteConcurrencyServiceCollectionExtensions.cs
Added AddConcurrentSqliteDbContextFactory — registers IDbContextFactory with concurrency settings and auto-injected ILoggerFactory. Factory lifetime defaults to Singleton (appropriate since the factory holds no per-request state).
Updated AddConcurrentSqliteDbContext XML doc to point users toward the factory overload for concurrent workloads.
SqliteConnectionEnhancer.cs
ComputeOptimizedConnectionString now throws ArgumentException when Cache=Shared is detected, with a clear message explaining the WAL incompatibility and pointing to connection pooling as the correct alternative.
Added TryReleaseMigrationLockAsync — checks for a stale __EFMigrationsLock row and optionally deletes it. Accepts a release: false flag for diagnostic-only checks. Includes full XML docs covering when and why stale locks occur.
QUICKSTART.md
"Configure" section now shows both registration paths with guidance on when to use each.
"Real-World Scenario" corrected: the bad pattern now shows the EF thread-safety violation explicitly, and the good pattern uses IDbContextFactory + CreateDbContext() per task.
New "Multi-Instance Deployments and Migration Locks" section with TryReleaseMigrationLockAsync usage and network filesystem warning.
Best Practices list updated to 7 items covering factory pattern, Cache=Shared, migration lock, and single-host constraint.
Summary by CodeRabbit
New Features
SynchronousModefor durability control andUpgradeTransactionsToImmediatefor transaction optimization.AddConcurrentSqliteDbContextFactorymethod for concurrent workload scenarios.Improvements
Documentation