Conversation
Contributor
Incompatible changesThe compatibility report is too large to post as a PR comment — The full report is available as a downloadable artifact from the To generate it locally, run: The report will be written to |
Migrate execution layer to Cats Effect 3 and FS2: replace Future-based thread pool with CE3 blocking dispatcher, db.run() now returns F[R], db.stream() returns Stream[F, T], transactions roll back on fiber cancellation. Remove AsyncExecutor, ExecutionContext from DBIOAction combinators and model-building API.
- removed reactive-stream-tests from build, the will be added back once we add Reactive Streams support back
- Add ConcurrencyControl as the unified execution control layer for database runs/streams. - Implement AdmissionControl to enforce queueSize fail-fast admission and maxInflightActions gating for full DBIO chain lifetime. - Implement ConnectionArbiter to manage connection-slot acquisition/release with ordered fairness for chain continuations and fresh submissions. - Wire controls through BasicBackend/JdbcBackend, expose concurrency gauges, and update docs/tests for new config keys and overload behavior.
…emit based The old code already had iterators around, but they were turned into push-style emiters. The new iterator-based approach allowed for a better integration with pull-based fs2 streams.
- removes vars and uses composition of iterators instead, making the code both more robust and more readable
* Prepare streaming internals for new API
Contributor
Incompatible changesThe compatibility report is too large to post as a PR comment — The full report is available as a downloadable artifact from the To generate it locally, run: The report will be written to |
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.
Slick 4
Slick 4 is a major release that modernises the execution engine from the ground up while keeping everything users care about — the query DSL,
DBIOActioncombinators, profile imports, SQL generation, HikariCP integration, and code generation — completely unchanged. The core is now built on Cats Effect 3, giving Slick a rock-solid, principled concurrency foundation. Three ready-made facades coverFuturewith Reactive Streams, Cats Effect IO with FS2, and ZIO with ZIO Streams — all sharing the sameDBIOActionAPI. The threading model has been rewritten so that connection use, backpressure, cancellation, and lifecycle management are all correct by construction rather than by convention.Three facades — one API
slick.future.Databaseslick-futurescala.concurrent.FutureDatabasePublisher[T]slick.cats.Databaseslick(core)cats.effect.IOfs2.Stream[IO, T]slick.zio.Databaseslick-ziozio.Taskzio.stream.ZStream[Any, Throwable, T]slick.future.Database—db.runreturnsFuture[R]anddb.streamreturns a Reactive StreamsDatabasePublisher[T], exactly as in Slick 3. The only mechanical changes are database construction and the removal ofExecutionContextparameters from DBIO combinators.slick.cats.Database—db.runreturnsIO[R],db.streamreturnsfs2.Stream[IO, T], and lifecycle is managed withResource[IO, Database].slick.zio.Database—db.runreturnsTask[R],db.streamreturnsZStream[Any, Throwable, T], and lifecycle is managed withZIO[Scope, Throwable, Database].Execution engine
Database[F[_], S[_]]trait is abstract over both the effect type and the stream type.db.run(action)returnsF[R]anddb.stream(action)returnsS[T], whereFandSare supplied by whichever facade you use. All JDBC blocking work is dispatched viaF.blocking, which maps to the appropriate blocking thread pool for the chosen effect type.AsyncExecutorremoved — the bespoke thread-pool abstraction and its intricateminThreads == maxThreads == maxConnectionsconstraint are gone. Connection-pool sizing is now independent of thread counts; size HikariCP to what the database server can handle and nothing more..transactionallyblock is cancelled the transaction is rolled back automatically, with no extra user code required.ExecutionContextremoved fromDBIOActioncombinators —map,flatMap,filter,withFilter,cleanUp,zipWith, andDBIO.foldno longer require an implicitExecutionContext. DBIO composition is now boilerplate-free.Concurrency control
ConcurrencyControl— a new, principled two-layer execution gate replaces the old queue:AdmissionControl— enforcesqueueSize(fail-fast when the caller queue is full) andmaxInflightActions(caps the number of concurrently running DBIO chains for the full chain lifetime, not just while holding a connection).ConnectionArbiter— manages connection-slot allocation with ordered fairness, prioritising chain continuations over fresh submissions to prevent head-of-line blocking.inflightAdmissionTimeoutandconnectionAcquireTimeoutlet you bound how long a caller waits for a slot, distinct from JDBC execution time.db.controlStatus— returns a live snapshot ofavailableConnectionSlots,pendingConnectionSlots,availableAdmissionQueueSlots, andavailableInflightSlots, making it straightforward to distinguish admission saturation from connection-slot contention.Streaming Internals
CloseableIteratormodel (that was at the bottom of the stack earlier) has been surfaced. The result is simpler code and correct demand-driven back-pressure throughout.bufferNextoverload removed — Slick 4's pull model keeps the JDBC cursor positioned on the current row until the subscriber signals new demand, so LOB handles andResultSetMutatorvalues are safe without any flag.DatabasePublisher.closeis idempotent — safe to call multiple times or from finalizers.Database construction
Database.forXxxfactory methods moved toDatabaseConfig.forXxx—DatabaseConfigbundles the profile with the connection configuration. Each facade provides its own idiomatic lifecycle:open/useforslick.future,make/resourceforslick.cats, andmake/scopedforslick.zio.Documentation
migrating-to-slick4.md) — covers every breaking change, includes a mechanical checklist suitable for automated tooling, and maps every Slick 3 pattern to its Slick 4 equivalent.