Skip to content

Commit

Permalink
Skip SELECTing revision that isn't used (#3207)
Browse files Browse the repository at this point in the history
This is a minor cleanup but it simplifies #3201 to avoid reading this, and pulling out this change to the existing logic into its own PR simplifies review.
  • Loading branch information
mhutchinson authored Nov 21, 2023
1 parent 02ed887 commit 1b80253
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions storage/mysql/tree_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (
VALUES(?,?,?,?,?,?)`

selectSubtreeSQL = `
SELECT x.SubtreeId, x.MaxRevision, Subtree.Nodes
SELECT x.SubtreeId, Subtree.Nodes
FROM (
SELECT n.TreeId, n.SubtreeId, max(n.SubtreeRevision) AS MaxRevision
FROM Subtree n
Expand Down Expand Up @@ -223,9 +223,8 @@ func (t *treeTX) getSubtrees(ctx context.Context, treeRevision int64, ids [][]by

for rows.Next() {
var subtreeIDBytes []byte
var subtreeRev int64
var nodesRaw []byte
if err := rows.Scan(&subtreeIDBytes, &subtreeRev, &nodesRaw); err != nil {
if err := rows.Scan(&subtreeIDBytes, &nodesRaw); err != nil {
klog.Warningf("Failed to scan merkle subtree: %s", err)
return nil, err
}
Expand Down

0 comments on commit 1b80253

Please sign in to comment.