From 65021e5c9b63c617232f8f493185ffd9fd8fae6a Mon Sep 17 00:00:00 2001 From: Pavel Kalinnikov Date: Mon, 19 Jul 2021 14:52:14 +0100 Subject: [PATCH] Don't compute the unused ephemeral nodes (#2579) --- storage/cache/log_tile.go | 4 ---- storage/mysql/storage_test.go | 4 ---- storage/testonly/fake_node_reader.go | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/storage/cache/log_tile.go b/storage/cache/log_tile.go index be6c9f979c..a545e2e33e 100644 --- a/storage/cache/log_tile.go +++ b/storage/cache/log_tile.go @@ -83,10 +83,6 @@ func PopulateLogTile(st *storagepb.SubtreeProto, hasher hashers.LogHasher) error return err } } - _, err := cr.GetRootHash(store) - if err != nil { - return fmt.Errorf("failed to compute root hash: %v", err) - } // Additional check - after population we should have the same number of internal nodes // as before the subtree was written to storage. Either because they were loaded from diff --git a/storage/mysql/storage_test.go b/storage/mysql/storage_test.go index 485a1a2486..2812ca116b 100644 --- a/storage/mysql/storage_test.go +++ b/storage/mysql/storage_test.go @@ -177,10 +177,6 @@ func createLogNodesForTreeAtSize(t *testing.T, ts, rev int64) ([]stree.Node, err return nil, err } } - // Store the ephemeral nodes as well. - if _, err := cr.GetRootHash(store); err != nil { - return nil, err - } // Unroll the map, which has deduped the updates for us and retained the latest nodes := make([]stree.Node, 0, len(nodeMap)) diff --git a/storage/testonly/fake_node_reader.go b/storage/testonly/fake_node_reader.go index e922209d60..c10e14c771 100644 --- a/storage/testonly/fake_node_reader.go +++ b/storage/testonly/fake_node_reader.go @@ -126,7 +126,7 @@ func NewMultiFakeNodeReaderFromLeaves(batches []LeafBatch) *MultiFakeNodeReader } } // TODO(pavelkalinnikov): Use testing.T.Fatalf instead of panics. - root, err := cr.GetRootHash(store) // Store the ephemeral nodes as well. + root, err := cr.GetRootHash(nil) if err != nil { panic(fmt.Errorf("GetRootHash: %v", err)) }