Skip to content

Commit cfb61cd

Browse files
authored
Merge e268dff into 72213a0
2 parents 72213a0 + e268dff commit cfb61cd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ydb/core/kqp/compile_service/kqp_compile_service.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ class TKqpQueryCache {
4141
YQL_ENSURE(compileResult->PreparedQuery);
4242

4343
auto queryIt = QueryIndex.emplace(query, compileResult->Uid);
44+
if (!queryIt.second) {
45+
EraseByUid(compileResult->Uid);
46+
}
4447
Y_ENSURE(queryIt.second);
4548
}
4649

@@ -943,6 +946,9 @@ class TKqpCompileService : public TActorBootstrapped<TKqpCompileService> {
943946
if (QueryCache.FindByUid(compileResult->Uid, false)) {
944947
QueryCache.Replace(compileResult);
945948
} else if (keepInCache) {
949+
if (QueryCache.FindByQuery(query, keepInCache)) {
950+
LOG_ERROR_S(ctx, NKikimrServices::KQP_COMPILE_SERVICE, "Trying to insert query into compile cache when it is already there");
951+
}
946952
if (QueryCache.Insert(compileResult, TableServiceConfig.GetEnableAstCache(), isPerStatementExecution)) {
947953
Counters->CompileQueryCacheEvicted->Inc();
948954
}
@@ -1048,6 +1054,9 @@ class TKqpCompileService : public TActorBootstrapped<TKqpCompileService> {
10481054
if (compileResult->Ast && QueryCache.FindByAst(query, *compileResult->Ast, keepInCache)) {
10491055
return false;
10501056
}
1057+
if (QueryCache.FindByQuery(query, keepInCache)) {
1058+
LOG_ERROR_S(ctx, NKikimrServices::KQP_COMPILE_SERVICE, "Trying to insert query into compile cache when it is already there");
1059+
}
10511060
auto newCompileResult = TKqpCompileResult::Make(CreateGuidAsString(), compileResult->Status, compileResult->Issues, compileResult->MaxReadType, std::move(query), compileResult->Ast);
10521061
newCompileResult->AllowCache = compileResult->AllowCache;
10531062
newCompileResult->PreparedQuery = compileResult->PreparedQuery;

0 commit comments

Comments
 (0)