-
Notifications
You must be signed in to change notification settings - Fork 367
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
Controller populate storage ID #8714
Conversation
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.
Very nice.
Approving,
But I think that making the StorageConfig
part of the ref.ManagerConfig
struct will make things cleaner.
pkg/catalog/catalog.go
Outdated
@@ -363,7 +364,8 @@ func New(ctx context.Context, cfg Config) (*Catalog, error) { | |||
CommitCacheConfig: ref.CacheConfig(baseCfg.Graveler.CommitCache), | |||
MaxBatchDelay: baseCfg.Graveler.MaxBatchDelay, | |||
BranchApproximateOwnershipParams: makeBranchApproximateOwnershipParams(baseCfg.Graveler.BranchOwnership), | |||
}) | |||
}, cfg.Config.StorageConfig(), |
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: new line,
So it's easier to understand to which func this is passed.
pkg/graveler/ref/manager.go
Outdated
@@ -4,6 +4,7 @@ import ( | |||
"context" | |||
"errors" | |||
"fmt" | |||
"github.com/treeverse/lakefs/pkg/config" |
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.
Imports order.
pkg/graveler/ref/manager.go
Outdated
@@ -142,6 +145,10 @@ func (m *Manager) getRepository(ctx context.Context, repositoryID graveler.Repos | |||
} | |||
return nil, err | |||
} | |||
repo := graveler.RepoFromProto(&data) | |||
if repo.StorageID == config.SingleBlockstoreID { | |||
repo.StorageID = graveler.StorageID(m.storageConfig.GetStorageByID(config.SingleBlockstoreID).ID()) // Will return the real actual ID |
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.
Noting that on server start storageConfig.GetStorageByID()
is checked for each repo, so it can't return null here (which is obviously good).
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.
Wait, no -
The checkRepos
in run.go
uses ListRepositories()
for this validation.
So in case of a bad config, we'll get a nil panic here, instead of a nice message.
Any idea how to handle this?
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.
Fixed
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.
Requesting changes because of an error handling issue we have to solve...
pkg/graveler/ref/manager.go
Outdated
@@ -142,6 +145,10 @@ func (m *Manager) getRepository(ctx context.Context, repositoryID graveler.Repos | |||
} | |||
return nil, err | |||
} | |||
repo := graveler.RepoFromProto(&data) | |||
if repo.StorageID == config.SingleBlockstoreID { | |||
repo.StorageID = graveler.StorageID(m.storageConfig.GetStorageByID(config.SingleBlockstoreID).ID()) // Will return the real actual ID |
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.
Wait, no -
The checkRepos
in run.go
uses ListRepositories()
for this validation.
So in case of a bad config, we'll get a nil panic here, instead of a nice message.
Any idea how to handle this?
24867f1
to
b357485
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.
Looking good.
I like it better in the controller, seems like a more natural choice than in Graveler.
Approving,
With two questions:
- Any reason
GetRepository
doesn't usegetActualStorageID
? - Can we cover this change (even in a minimal way) with tests?
|
Controller, populate storage ID with actual value when returning repository information