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

Use 64 bits for node IDs and SubtreeCache #2394

Merged
merged 1 commit into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions storage/cache/subtree_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ type SetSubtreesFunc func(ctx context.Context, s []*storagepb.SubtreeProto) erro

// maxSupportedTreeDepth is the maximum depth a tree can reach. Note that log
// trees are further limited to a depth of 63 by the use of signed 64 bit leaf
// indices. Map trees do not have this restriction.
const maxSupportedTreeDepth = 256
// indices.
const maxSupportedTreeDepth = 64

// SubtreeCache provides a caching access to Subtree storage. Currently there are assumptions
// in the code that all subtrees are multiple of 8 in depth and that log subtrees are always
Expand Down
5 changes: 2 additions & 3 deletions storage/cache/subtree_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import (
"github.com/golang/mock/gomock"
)

// TODO(pavelkalinnikov): This should be 8 bytes instead of 32.
var defaultLogStrata = []int{8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}
var defaultLogStrata = []int{8, 8, 8, 8, 8, 8, 8, 8}

func TestCacheFillOnlyReadsSubtrees(t *testing.T) {
mockCtrl := gomock.NewController(t)
Expand Down Expand Up @@ -133,7 +132,7 @@ func TestCacheFlush(t *testing.T) {
m := NewMockNodeStorage(mockCtrl)
c := NewSubtreeCache(defaultLogStrata, populateLogSubtreeNodes(rfc6962.DefaultHasher), prepareLogSubtreeWrite())

h := "0123456789abcdef0123456789abcdef"
h := "01234567"
nodeID := tree.NewNodeIDFromHash([]byte(h))
expectedSetIDs := make(map[string]string)
// When we loop around asking for all 0..32 bit prefix lengths of the above
Expand Down
2 changes: 1 addition & 1 deletion storage/cloudspanner/default_strata.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ var (
// defLogStrata is a suitable set of stratum sizes for Log trees.
// Log trees are dense and so each individual stratum cannot over-commit on
// storage.
defLogStrata = []int{8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}
defLogStrata = []int{8, 8, 8, 8, 8, 8, 8, 8}
)
2 changes: 1 addition & 1 deletion storage/memory/log_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
const logIDLabel = "logid"

var (
defaultLogStrata = []int{8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}
defaultLogStrata = []int{8, 8, 8, 8, 8, 8, 8, 8}

once sync.Once
queuedCounter monitoring.Counter
Expand Down
2 changes: 1 addition & 1 deletion storage/mysql/log_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const (
)

var (
defaultLogStrata = []int{8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}
defaultLogStrata = []int{8, 8, 8, 8, 8, 8, 8, 8}

once sync.Once
queuedCounter monitoring.Counter
Expand Down
2 changes: 1 addition & 1 deletion storage/postgres/log_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const (
)

var (
defaultLogStrata = []int{8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}
defaultLogStrata = []int{8, 8, 8, 8, 8, 8, 8, 8}

once sync.Once
queuedCounter monitoring.Counter
Expand Down