-
Notifications
You must be signed in to change notification settings - Fork 373
Spark Client StorageID support #8918
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,7 +168,7 @@ class ApiClient private (conf: APIConfigurations) { | |
val storageNamespace = key.storageClientType match { | ||
case StorageClientType.HadoopFS => | ||
ApiClient | ||
.translateURI(URI.create(repo.getStorageNamespace), getBlockstoreType) | ||
.translateURI(URI.create(repo.getStorageNamespace), getBlockstoreType(repo.getStorageId)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The storage namespace information is cached in this client. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm adding a What cache are you suggesting here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was looking at the namespace cache and missed the key to namespace cache - can ignore my comment. |
||
.normalize() | ||
.toString | ||
case StorageClientType.SDKClient => repo.getStorageNamespace | ||
|
@@ -210,19 +210,27 @@ class ApiClient private (conf: APIConfigurations) { | |
retryWrapper.wrapWithRetry(prepareGcCommits) | ||
} | ||
|
||
def getGarbageCollectionRules(repoName: String): String = { | ||
val getGcRules = new dev.failsafe.function.CheckedSupplier[GarbageCollectionRules]() { | ||
def get(): GarbageCollectionRules = repositoriesApi.getGCRules(repoName).execute() | ||
def getRepository(repoName: String): Repository = { | ||
val getRepo = new dev.failsafe.function.CheckedSupplier[Repository]() { | ||
def get(): Repository = repositoriesApi.getRepository(repoName).execute() | ||
} | ||
val gcRules = retryWrapper.wrapWithRetry(getGcRules) | ||
gcRules.toString() | ||
retryWrapper.wrapWithRetry(getRepo) | ||
} | ||
|
||
def getBlockstoreType: String = { | ||
def getBlockstoreType(storageID: String): String = { | ||
val getStorageConfig = new dev.failsafe.function.CheckedSupplier[StorageConfig]() { | ||
def get(): StorageConfig = { | ||
val cfg = configApi.getConfig.execute() | ||
cfg.getStorageConfig | ||
val storageConfigList = cfg.getStorageConfigList | ||
if (storageConfigList.isEmpty || storageConfigList.size() == 1) { | ||
cfg.getStorageConfig | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could still check storageID when the list has size 1 and specifies a storage ID, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm complying with the other clients (WebUI, lakectl, Everest) - |
||
} else { | ||
Comment on lines
+225
to
+227
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In case of a non empty list, we still need to pick the configuration from the list - right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In such case, it'll be returned in the non-list part of the response. |
||
storageConfigList.asScala | ||
.find(_.getBlockstoreId == storageID) | ||
.getOrElse( | ||
throw new IllegalArgumentException(s"Storage config not found for ID: $storageID") | ||
) | ||
} | ||
} | ||
} | ||
val storageConfig = retryWrapper.wrapWithRetry(getStorageConfig) | ||
|
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.
Let's have this as a separate PR! It's not that I'm afraid, the lakeFS compatibility guarantees means this is a perfectly safe change. But I'd still rather be careful because I'm actually scared by this change.
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'd don't mind separating this, but since the CI tests pass here, I'm curious -
What difference will it make?
If merging the lib bump and right after it the MSB changes -
How will it give more confidence?
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.
Because we squash merges, 2 PRs give a more detailed commit history. That makes it easier to
git bisect
and/or roll back some changes. But not critical.