fix: filter out datasets with inconsistent database and LakeFS records#5171
fix: filter out datasets with inconsistent database and LakeFS records#5171xuang7 wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5171 +/- ##
============================================
- Coverage 47.13% 45.81% -1.33%
- Complexity 2344 2345 +1
============================================
Files 1042 1046 +4
Lines 39989 40033 +44
Branches 4260 4258 -2
============================================
- Hits 18849 18341 -508
- Misses 20015 20582 +567
+ Partials 1125 1110 -15
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| ): List[DashboardDataset] = { | ||
| val uid = user.getUid | ||
| // Drop DB rows whose LakeFS repo is missing. | ||
| val existingRepos = LakeFSStorageClient.listAllRepoNames() |
There was a problem hiding this comment.
TOCTOU note: listAllRepoNames() is a snapshot taken before the .map that calls retrieveRepositorySize per row. If a concurrent admin / orchestrator deletes a LakeFS repo between the snapshot and the per-row size lookup, the request will still 500 on the now-stale "exists" check. The window is small but non-zero.
Worth knowing the existing dataset-search path (DatasetSearchQueryBuilder.toEntryImpl at lines 127-137 on main) already handles this with a try { retrieveRepositorySize(...) } catch (ApiException) { return null } pattern, logging and silently dropping the orphan. After this PR the two read paths have two different defenses for the same underlying inconsistency.
Could we use try-catch here too? That would close the race window, drop the need for the new listAllRepoNames() helper entirely, and unify the orphan defense with the existing search path. What do you think?
What changes were proposed in this PR?
This PR fixes an issue where dataset listings fail when dataset records in the database and LakeFS repositories are inconsistent. This breaks the workflow dataset picker and can also affect Hub dataset listings. The fix updates the dataset listing endpoints to first fetch existing LakeFS repository names and filter out dataset records whose repositories are missing, so valid datasets can still be returned normally.
Demo:
Any related issues, documentation, discussions?
Closes #5106
How was this PR tested?
Added two tests.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7