-
Notifications
You must be signed in to change notification settings - Fork 453
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
[dbnode] Ensure that bootstrap.Cache is always passed by reference #2703
Conversation
@@ -179,7 +179,7 @@ type readNamespaceResult struct { | |||
func (s *commitLogSource) Read( | |||
ctx context.Context, | |||
namespaces bootstrap.Namespaces, | |||
cache bootstrap.Cache, | |||
cache *bootstrap.Cache, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can be _
@@ -123,7 +123,7 @@ func newFileSystemSource(opts Options) (bootstrap.Source, error) { | |||
func (s *fileSystemSource) AvailableData( | |||
md namespace.Metadata, | |||
shardTimeRanges result.ShardTimeRanges, | |||
cache bootstrap.Cache, | |||
cache *bootstrap.Cache, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: these can all be _
@@ -119,7 +119,7 @@ func (s *peersSource) AvailableIndex( | |||
func (s *peersSource) Read( | |||
ctx context.Context, | |||
namespaces bootstrap.Namespaces, | |||
cache bootstrap.Cache, | |||
cache *bootstrap.Cache, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: these can be _
@@ -172,15 +172,15 @@ func TestPeersSourceAvailableDataAndIndex(t *testing.T) { | |||
require.NoError(t, sErr) | |||
|
|||
runOpts := testDefaultRunOpts.SetInitialTopologyState(tc.topoState) | |||
dataRes, err := src.AvailableData(nsMetadata, tc.shardsTimeRangesToBootstrap, cache, runOpts) | |||
dataRes, err := src.AvailableData(nsMetadata, tc.shardsTimeRangesToBootstrap, &cache, runOpts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: instead, could we have bootstrap.NewCache
return a pointer?
Why don't we make Should also require fewer changes but maybe some validation that cache is always set. |
@@ -236,7 +236,7 @@ func (b bootstrapProcess) Run( | |||
namespacesRunFirst, | |||
namespacesRunSecond, | |||
} { | |||
res, err := b.runPass(ctx, namespaces, cache) | |||
res, err := b.runPass(ctx, namespaces, &cache) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should get this for free if NewCache
returns a pointer
Yeah that's a good idea. Will do |
33ac1e4
to
00e4ae2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice change to an interface!
6316532
to
ac1b3ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
85942ac
to
d2f651a
Compare
5ee1d92
to
e0bd10c
Compare
What this PR does / why we need it:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing and/or backwards incompatible change?:
Does this PR require updating code package or user-facing documentation?: