Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial KV Tx RPC implementation #626

Merged
merged 50 commits into from
Apr 19, 2022
Merged

Add initial KV Tx RPC implementation #626

merged 50 commits into from
Apr 19, 2022

Conversation

canepat
Copy link
Member

@canepat canepat commented Apr 1, 2022

This PR introduces the initial implementation of KV Tx bidirectional RPC. Key points:

  • every new Tx incoming RPC creates a new MDBX read-only transaction
  • one unsolicited message containing the txn ID is notified to the client
  • cursor open/close and tracking by pairing db::Cursor with table name to support reopening
  • one max txn TTL timer protects against long-lived txn by aborting/reopening the txn on behalf of the client, opened cursors are saved/restored transparently
  • another idle timer protects against clients which don't send any (more) requests and eventually terminates the RPC

TODOLIST:

  • check errors when limits are reached (max number of txns, max number of cursors per txn), if applicable

canepat added 2 commits April 1, 2022 09:48
Fix and add unit tests
Implement Tx RPC cursor operations [WIP]
Fix cursor ID assignment in BackEndKV test client
@codecov
Copy link

codecov bot commented Apr 1, 2022

Codecov Report

Merging #626 (d90a87e) into master (d57404a) will increase coverage by 0.27%.
The diff coverage is 87.27%.

@@            Coverage Diff             @@
##           master     #626      +/-   ##
==========================================
+ Coverage   82.09%   82.36%   +0.27%     
==========================================
  Files         173      173              
  Lines       14425    14997     +572     
==========================================
+ Hits        11842    12353     +511     
- Misses       2583     2644      +61     
Impacted Files Coverage Δ
node/silkworm/backend/ethereum_backend.cpp 100.00% <ø> (ø)
node/silkworm/rpc/client/sentry_client.hpp 100.00% <ø> (ø)
node/silkworm/rpc/completion_end_point.cpp 100.00% <ø> (ø)
node/silkworm/rpc/kv_calls.cpp 87.39% <86.16%> (-1.27%) ⬇️
node/silkworm/rpc/call.hpp 93.23% <89.69%> (+2.75%) ⬆️
node/silkworm/backend/ethereum_backend.hpp 100.00% <100.00%> (ø)
node/silkworm/rpc/backend_calls.cpp 100.00% <100.00%> (ø)
node/silkworm/rpc/backend_kv_server.cpp 100.00% <100.00%> (ø)
node/silkworm/rpc/call_factory.hpp 100.00% <100.00%> (ø)
node/silkworm/rpc/client/call.hpp 67.85% <100.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

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

canepat added 27 commits April 1, 2022 23:49
Refactor chaindata environment type
Handle any exception raised in mdbx::env::start_read
Fix error handling in save and restore cursors
Add MDBX max readers option in BackEnd KV server
Refactor for testability
Add unit tests for coverage
Add unit tests for Tx max idle timeout
Add unit tests for max TTL duration
Add unit tests for Tx cursor FIRST operation
Add unit tests for Tx cursor NEXT operation
Fix cursor FIRST_DUP implementation in Tx RPC
Fix cursor CURRENT implementation in Tx RPC
Add unit tests
@canepat canepat marked this pull request as ready for review April 13, 2022 20:10
@canepat canepat requested a review from mriccobene April 13, 2022 20:10
@canepat canepat merged commit f4f6759 into master Apr 19, 2022
@canepat canepat deleted the backend_kv_server6 branch April 19, 2022 18:26
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.

2 participants