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

storage: Remove revision from GetMerkleNodes #2391

Merged
merged 3 commits into from
Mar 11, 2021
Merged

Conversation

pav-kv
Copy link
Contributor

@pav-kv pav-kv commented Mar 10, 2021

Log trees always read from the revision corresponding to the root which
is read in the beginning of the transaction. There is no need for it to
make a roundtrip to the application layer.

Part of a larger refactoring [#2378]. More follow-up changes are WIP.

Checklist

@google-cla google-cla bot added the cla: yes label Mar 10, 2021
Log trees always read from the revision corresponding to the root which
is read in the beginning of the transaction. There is no need for it to
make a roundtrip to the application layer.
@pav-kv pav-kv force-pushed the refactoring branch 3 times, most recently from 16023a7 to 7c06486 Compare March 11, 2021 00:06
@codecov
Copy link

codecov bot commented Mar 11, 2021

Codecov Report

Merging #2391 (f7a7ea6) into master (3ca5674) will decrease coverage by 0.08%.
The diff coverage is 56.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2391      +/-   ##
==========================================
- Coverage   65.76%   65.68%   -0.09%     
==========================================
  Files         107      107              
  Lines        7759     7758       -1     
==========================================
- Hits         5103     5096       -7     
- Misses       2120     2127       +7     
+ Partials      536      535       -1     
Impacted Files Coverage Δ
storage/cloudspanner/tree_storage.go 34.92% <0.00%> (-0.51%) ⬇️
storage/memory/log_storage.go 3.50% <0.00%> (-0.05%) ⬇️
storage/memory/tree_storage.go 2.00% <ø> (+0.01%) ⬆️
storage/mysql/tree_storage.go 50.77% <ø> (-0.76%) ⬇️
storage/tools/dump_tree/dumplib.go 41.25% <0.00%> (ø)
log/sequencer.go 73.39% <100.00%> (ø)
server/log_rpc_server.go 84.07% <100.00%> (+0.70%) ⬆️
server/proof_fetcher.go 86.20% <100.00%> (ø)
storage/mysql/log_storage.go 65.48% <100.00%> (+0.29%) ⬆️
client/log_client.go 69.76% <0.00%> (-2.33%) ⬇️
... and 1 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 3ca5674...f7a7ea6. Read the comment docs.

@pav-kv pav-kv marked this pull request as ready for review March 11, 2021 00:25
@pav-kv pav-kv requested a review from a team as a code owner March 11, 2021 00:25
@@ -372,6 +373,14 @@ func (t *logTreeTX) WriteRevision(ctx context.Context) (int64, error) {
return t.treeTX.writeRevision, nil
}

// GetMerkleNodes returns the requested nodes at the read revision.
func (t *logTreeTX) GetMerkleNodes(ctx context.Context, nodeIDs []tree.NodeID) ([]tree.Node, error) {
Copy link
Contributor Author

@pav-kv pav-kv Mar 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit might look confusing: The GetMerkleNodes method just moved from treeTX to logTreeTX.
Reason: treeTX (for this particular implementation) doesn't know root.revision, whereas the logTreeTX does. In contrast, in other implementations (e.g. cloudspanner and spanner) tree storage TX does know it.

This indicates that tree vs log storage abstractions are sometimes violated / not defined. Given that we only have logs now, the bigger plan is to combine the two into one interface [#2378].

@pav-kv pav-kv requested a review from pphaneuf March 11, 2021 11:58
@pav-kv pav-kv merged commit bfb7a0d into google:master Mar 11, 2021
@pav-kv pav-kv deleted the refactoring branch March 11, 2021 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants