-
Notifications
You must be signed in to change notification settings - Fork 365
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
Add StorageID to adapter GetStorageNamespaceInfo and ResolveNamespace #8551
Add StorageID to adapter GetStorageNamespaceInfo and ResolveNamespace #8551
Conversation
cmd/lakefs/cmd/run.go
Outdated
@@ -430,7 +430,8 @@ func checkRepos(ctx context.Context, logger logging.Logger, authMetadataManager | |||
logger.Debug("lakeFS isn't initialized, skipping mismatched adapter checks") | |||
} else { | |||
logger. | |||
WithField("adapter_type", blockStore.BlockstoreType()). | |||
// TODO (gilo): uncomment 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.
why is this commented out?
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.
It's a log for repos validation, adding the adapter_type.
The BlockstoreType in now actually in the context of a repo -
So I think it's ok to remove this from the log.
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.
I suggest a slight change to the design that will make this much cleaner
pkg/block/adapter.go
Outdated
BlockstoreMetadata(ctx context.Context) (*BlockstoreMetadata, error) | ||
GetStorageNamespaceInfo() StorageNamespaceInfo | ||
ResolveNamespace(storageNamespace, key string, identifierType IdentifierType) (QualifiedKey, error) | ||
BlockstoreType(storageID string) string |
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.
If these methods take storageid then they need to return error in the case that they are passed an invalid storageid
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.
Good point. Changing.
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.
Added 😖
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.
Please have a look at my open comments
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.
Thanks,
I think we can solves this in a simpler way if we switch the wrapping order MetricsAdapter <-> BlockAdapter.
See if this makes more sense
cmd/lakefs/cmd/run.go
Outdated
@@ -430,7 +430,8 @@ func checkRepos(ctx context.Context, logger logging.Logger, authMetadataManager | |||
logger.Debug("lakeFS isn't initialized, skipping mismatched adapter checks") | |||
} else { | |||
logger. | |||
WithField("adapter_type", blockStore.BlockstoreType()). | |||
// TODO (gilo): uncomment 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.
Question: Why don't we just pass the responsibility to check the repo to the block adapter, provide it with the repository object and let it do this validation?
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.
This might make sense.
But -
We'll anyway need to refactor this part soon, when adding a couple more validations.
So I suggest we'll postpone it to this stage.
pkg/block/metrics.go
Outdated
@@ -23,12 +23,20 @@ func (m *MetricsAdapter) InnerAdapter() Adapter { | |||
} | |||
|
|||
func (m *MetricsAdapter) Put(ctx context.Context, obj ObjectPointer, sizeBytes int64, reader io.Reader, opts PutOpts) (*PutResponse, error) { | |||
ctx = httputil.SetClientTrace(ctx, m.adapter.BlockstoreType()) | |||
blockstoreType, err := m.adapter.BlockstoreType(obj.StorageID) |
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.
Just a thought:
If BlockAdapter will wrap MetricsAdapter instead of the other way around, you'd probably won't need to provide the storageID to BlockstoreType
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.
I'm not sure if this will improve the code,
And I'm kinda ok with the MetricsAdapter being a bit more "technical".
In this case also, we'll (probably) have to make such changes in this area when dealing with the stats and metrics of this change. So I suggest linking this comment to the relevant Issue, and dealing with this later.
Does this make sense to you?
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.
What does it mean more "technical"?
Switching the wrapping order might release us from the need to pass the storageID to the blockstore type.
This PR handles the issue of "Add StorageID to adapter metadata functions". What is the relevant issue for this comment if not this one?
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.
Look at the example of statsCollector
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.
@N-o-Z thanks for the interesting suggestions.
Can you PTAL again?
cmd/lakefs/cmd/run.go
Outdated
@@ -430,7 +430,8 @@ func checkRepos(ctx context.Context, logger logging.Logger, authMetadataManager | |||
logger.Debug("lakeFS isn't initialized, skipping mismatched adapter checks") | |||
} else { | |||
logger. | |||
WithField("adapter_type", blockStore.BlockstoreType()). | |||
// TODO (gilo): uncomment 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.
This might make sense.
But -
We'll anyway need to refactor this part soon, when adding a couple more validations.
So I suggest we'll postpone it to this stage.
pkg/block/metrics.go
Outdated
@@ -23,12 +23,20 @@ func (m *MetricsAdapter) InnerAdapter() Adapter { | |||
} | |||
|
|||
func (m *MetricsAdapter) Put(ctx context.Context, obj ObjectPointer, sizeBytes int64, reader io.Reader, opts PutOpts) (*PutResponse, error) { | |||
ctx = httputil.SetClientTrace(ctx, m.adapter.BlockstoreType()) | |||
blockstoreType, err := m.adapter.BlockstoreType(obj.StorageID) |
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.
I'm not sure if this will improve the code,
And I'm kinda ok with the MetricsAdapter being a bit more "technical".
In this case also, we'll (probably) have to make such changes in this area when dealing with the stats and metrics of this change. So I suggest linking this comment to the relevant Issue, and dealing with this later.
Does this make sense to you?
@N-o-Z removed storageID param from StorageType(). |
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.
Thanks
# This is the 1st commit message: StorageConfigList response changes # The commit message #2 will be skipped: # Fix newConfig # The commit message #3 will be skipped: # More fixes # The commit message #4 will be skipped: # More fixes # The commit message #5 will be skipped: # Add admin/superuser error handling and cleanup (#8559) # # * Add admin/superuser error handling and cleanup # # - Added a defer function to clean up the admin user if an error occurs during creation. # - Added tests for creating an admin user, verifying successful creation, attempting to create another admin user, deleting the admin user, creating an admin user without a secret access key, and re-adding the admin user. # - Included a new test `TestAddAdminUser` to verify the behavior of the `AddAdminUser` function in various scenarios. # # * Added a logger to log the error message and warn about deleting the user # The commit message #6 will be skipped: # Add StorageID to adapter GetStorageNamespaceInfo and ResolveNamespace (#8551) # # * Add StorageID to adapter metadata functions # # * Fix tests # # * Add error handling # # * Fix tests # # * Fix lint # # * Revert "Fix lint" # # This reverts commit 850f17b. # # * Revert "Fix tests" # # This reverts commit 7bf9acc. # # * Revert "Add error handling" # # This reverts commit 9d3f0a2. # # * Revert "Fix tests" # # This reverts commit a2a4ab5. # # * Revert "Add StorageID to adapter metadata functions" # # This reverts commit 06b32ee. # # * Add storageID to metadata functions # # * Fix tests # # * Fix tests # # * Remove storageID from BlockstoreMetadata
Closes #8550.
Notes
DefaultResolveNamespace
is still not usingStorageID
. This might be implemented later on.