Skip to content

Return Long from Update run/updateMany via executeLargeUpdate - #2480

Open
mwisnicki wants to merge 3 commits into
typelevel:mainfrom
mwisnicki:large-updates
Open

Return Long from Update run/updateMany via executeLargeUpdate#2480
mwisnicki wants to merge 3 commits into
typelevel:mainfrom
mwisnicki:large-updates

Conversation

@mwisnicki

Copy link
Copy Markdown

Summary

Update#run, Update0#run, updateMany, and their *AlteringExecution variants now return ConnectionIO[Long] instead of ConnectionIO[Int], using JDBC's executeLargeUpdate / executeLargeBatch. This avoids overflow when more than 2^31 rows are affected.

Fixes #2479

Details

  • modules/core/.../util/update.scala — switched executeUpdateexecuteLargeUpdate and executeBatchexecuteLargeBatch; return types and the PreparedExecutionWithoutProcessStep type parameters changed from Int to Long. The free algebra already provided executeLargeUpdate/executeLargeBatch.
  • Updated downstream call sites that hard-coded Int (tests, examples, and mdoc docs).

Breaking change

This is a source- and binary-breaking change to the Update/Update0 execution API. Per the issue discussion, targeting it for 1.0 (#1728) rather than adding a separate runLarge method.

Testing

  • core/test — all passing (H2 in-memory)
  • postgres/test — all passing (exercises real executeLargeUpdate/executeLargeBatch)
  • mysql/test — all passing

Generated with Claude Code

Update#run, Update0#run, updateMany, and their *AlteringExecution
variants now return ConnectionIO[Long] instead of ConnectionIO[Int],
using JDBC's executeLargeUpdate/executeLargeBatch. This avoids
overflow when more than 2^31 rows are affected.

This is a breaking change targeted for 1.0.

Fixes typelevel#2479

Co-Authored-By: Claude <noreply@anthropic.com>
@mergify

mergify Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@mwisnicki

Copy link
Copy Markdown
Author

I've reviewed all the changes

mwisnicki and others added 2 commits July 19, 2026 23:17
yolo.scala's Update0YoloOps.quick shows the update count via Show, so
switching the count from Int to Long makes cats.instances.int unused
(fatal under tpolecatCiMode) and requires cats.instances.long instead.

Co-Authored-By: Claude <noreply@anthropic.com>
Update#run and updateMany now invoke executeLargeUpdate/executeLargeBatch,
so TracedInterpreter emits spans named executeLargeUpdate/executeLargeBatch
(the interpreter already overrode these). Update TracedTransactorSuite's
expected span names and db.operation.name attributes to match.

Co-Authored-By: Claude <noreply@anthropic.com>
@mwisnicki

Copy link
Copy Markdown
Author

Also I expected MiMa to fail but looks like the MiMa step is not really checking anything?

@jatcwang jatcwang added this to the 1.0 milestone Jul 20, 2026
@jatcwang

Copy link
Copy Markdown
Collaborator

@mwisnicki Yes MiMa is disabled until we reach 1.0 which is why there's not failure here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update run returns Int instead of Long

2 participants