Skip to content

feat: Transaction TTL Cache for HTTP API#4271

Open
jsimnz wants to merge 15 commits intodevelopfrom
jsimnz/feat/i4222-transaction-ttl
Open

feat: Transaction TTL Cache for HTTP API#4271
jsimnz wants to merge 15 commits intodevelopfrom
jsimnz/feat/i4222-transaction-ttl

Conversation

@jsimnz
Copy link
Member

@jsimnz jsimnz commented Dec 11, 2025

Relevant issue(s)

Resolves #4222 #4266

Description

This adds a TTLCache to the HTTP API Transaction middleware.

There is a discussion to be had here:
This only adds a transaction TTL to explicit transactions made through the HTTP API, embedded usage isn't changed. In an ideal case we would have no transaction TTL since I think it limits the user. The downside of the HTTP API is that transactions have a possible of falling into limbo due to network delivery issues beyond our control. If a transaction is left open indefinitely it will seriously impact and degrade the entire database until eventually panicing. So the HTTP API needs the TTL, the discussion is whether it should apply to all manual transaction creation, regardless if using the HTTP API.

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

Just a single integration test, once the above discussion has been resolved I'll expand them.

Specify the platform(s) on which this was tested:

  • Ubuntu (WSL2)

@jsimnz jsimnz self-assigned this Dec 11, 2025
@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

❌ Patch coverage is 16.14907% with 270 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.11%. Comparing base (d546f23) to head (e12556b).

Files with missing lines Patch % Lines
internal/ttl/wheel.go 29.73% 73 Missing and 5 partials ⚠️
internal/datastore/txn_ttl.go 0.00% 67 Missing ⚠️
http/handler_tx.go 0.00% 32 Missing ⚠️
internal/ttl/cache.go 18.42% 29 Missing and 2 partials ⚠️
internal/db/db.go 0.00% 21 Missing and 2 partials ⚠️
http/middleware.go 0.00% 16 Missing ⚠️
http/utils.go 0.00% 7 Missing ⚠️
http/errors.go 0.00% 5 Missing ⚠️
http/handler.go 0.00% 4 Missing ⚠️
internal/db/config.go 33.33% 4 Missing ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           develop    #4271       +/-   ##
============================================
- Coverage    77.40%   55.11%   -22.29%     
============================================
  Files          485      350      -135     
  Lines        38023    32379     -5644     
============================================
- Hits         29430    17845    -11585     
- Misses        6273    13017     +6744     
+ Partials      2320     1517      -803     
Flag Coverage Δ
all-tests 55.11% <16.15%> (-22.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
client/db.go 91.30% <100.00%> (ø)
http/client.go 0.00% <ø> (-61.81%) ⬇️
node/node.go 53.33% <ø> (-20.00%) ⬇️
internal/db/txn.go 18.37% <85.71%> (-8.16%) ⬇️
http/handler_store.go 0.00% <0.00%> (-82.26%) ⬇️
http/handler.go 0.00% <0.00%> (-81.03%) ⬇️
internal/db/config.go 66.67% <33.33%> (-29.41%) ⬇️
http/errors.go 0.00% <0.00%> (-40.00%) ⬇️
http/utils.go 0.00% <0.00%> (-90.91%) ⬇️
http/middleware.go 0.00% <0.00%> (-76.60%) ⬇️
... and 5 more

... and 295 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d546f23...e12556b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jsimnz jsimnz force-pushed the jsimnz/feat/i4222-transaction-ttl branch from e798e29 to e12556b Compare December 13, 2025 10:24
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.

Need a TTL timeout for transaction IDs

1 participant