Skip to content

[KIKIMR-22131] Add temporary feature-flag for new pattern cache in yql/essentials #14891

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

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ydb/library/yql/dq/runtime/dq_tasks_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ class TDqTaskRunner : public IDqTaskRunner {
std::shared_ptr<TPatternCacheEntry> entry;
bool canBeCached;
if (UseSeparatePatternAlloc(task) && Context.PatternCache) {
#if !defined(NEW_PATTERN_CACHE_IN_MKQL)
auto& cache = Context.PatternCache;
auto ticket = cache->FindOrSubscribe(program.GetRaw());
if (!ticket.HasFuture()) {
Expand All @@ -454,6 +455,27 @@ class TDqTaskRunner : public IDqTaskRunner {
} else {
entry = ticket.GetValueSync();
}
#else
auto& cache = Context.PatternCache;
auto future = cache->FindOrSubscribe(program.GetRaw());
if (!future.HasValue()) {
try {
entry = CreateComputationPattern(task, program.GetRaw(), true, canBeCached);
if (canBeCached && entry->Pattern->GetSuitableForCache()) {
cache->EmplacePattern(task.GetProgram().GetRaw(), entry);
} else {
cache->IncNotSuitablePattern();
cache->NotifyPatternMissing(program.GetRaw());
}
} catch (...) {
// TODO: not sure if there may be exceptions in the first place.
cache->NotifyPatternMissing(program.GetRaw());
throw;
}
} else {
entry = future.GetValueSync();
}
#endif
}

if (!entry) {
Expand Down
Loading