Skip to content

Commit

Permalink
cache: Set a fixed tile height of 8 (#2726)
Browse files Browse the repository at this point in the history
  • Loading branch information
pav-kv authored Apr 29, 2022
1 parent 3ef1b6a commit 241204c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
### Misc improvements

* #2712: Fix MySQL world-writable config warning.
* #2726: Check the tile height invariant stricter. No changes required.

## v1.4.0

Expand Down
9 changes: 4 additions & 5 deletions storage/cache/log_tile.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ const (
//
// TODO(pavelkalinnikov): Unexport it after the refactoring.
func PopulateLogTile(st *storagepb.SubtreeProto, hasher merkle.LogHasher) error {
if st.Depth < 1 {
return fmt.Errorf("populate log subtree with invalid depth: %d", st.Depth)
if got, want := st.Depth, int32(logStrataDepth); got != want {
return fmt.Errorf("invalid log tile depth %d, want %d", got, want)
}
// maxLeaves is the number of leaves that fully populates a subtree of the depth we are
// working with.
maxLeaves := 1 << uint(st.Depth)
// maxLeaves is the number of leaves in a fully populated tile.
const maxLeaves = 1 << logStrataDepth

// If the subtree is fully populated then the internal node map is expected to be nil but in
// case it isn't we recreate it as we're about to rebuild the contents. We'll check
Expand Down

0 comments on commit 241204c

Please sign in to comment.