-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix(gms): Write back lineage search results to in-memory cache bound to feature flag #6006
fix(gms): Write back lineage search results to in-memory cache bound to feature flag #6006
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.
Small suggestions to make it easier to debug if there is unexpected staleness.
if (lineageResult == null) { | ||
maxHops = maxHops != null ? maxHops : 1000; | ||
lineageResult = _graphService.getLineage(sourceUrn, direction, 0, MAX_RELATIONSHIPS, maxHops); | ||
if (cacheEnabled) { | ||
cache.put(Pair.of(sourceUrn, direction), lineageResult); |
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.
Could we drop in the current timestamp into the value section?
So maybe
cache.put(Pair.of(sourceUrn,direction), Pair.of(lineageResult, currentTimestamp))
that way we can always know when a cache entry was inserted into the cache, at least for debugging purposes.
@@ -71,10 +73,14 @@ public LineageSearchResult searchAcrossLineage(@Nonnull Urn sourceUrn, @Nonnull | |||
@Nonnull List<String> entities, @Nullable String input, @Nullable Integer maxHops, @Nullable Filter inputFilters, | |||
@Nullable SortCriterion sortCriterion, int from, int size) { | |||
// Cache multihop result for faster performance | |||
EntityLineageResult lineageResult = cache.get(Pair.of(sourceUrn, direction), EntityLineageResult.class); | |||
EntityLineageResult lineageResult = cacheEnabled ? cache.get(Pair.of(sourceUrn, direction), EntityLineageResult.class) |
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.
add a log.warn here if we found something in the cache and if the insert timestamp is from a long time ago (we can default to hard-coded 1 hour for this PR).
Checklist