Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
135693: sql/importer: avoid pointless rand read for imported uuids r=dt a=dt

Imported UUIDs are replaced with deterministic UUIDs to enable resuming imports. Previously however, the in-memory UUID with this deterministic UUID was made by making a random UUID -- reading random numbers from system entropy -- and then replacing what it read with the deterministic numbers.

This skips the epensive and pointless init and just makes an empty struct for the deterministic numbers to be set in.

Release note: none.
Epic: none.

Co-authored-by: David Taylor <[email protected]>
  • Loading branch information
craig[bot] and dt committed Nov 19, 2024
2 parents dbcf096 + 6973f8a commit 411026e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sql/row/expr_walker.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func importGenUUID(
c.randSource = makeImportRand(c)
}
gen := c.randSource.Int63(c)
id := uuid.MakeV4()
id := uuid.UUID{}
id.DeterministicV4(uint64(gen), uint64(1<<63))
return tree.NewDUuid(tree.DUuid{UUID: id}), nil
}
Expand Down

0 comments on commit 411026e

Please sign in to comment.