Skip to content

Commit afd8c9e

Browse files
authored
reset CS schemas cache in unit-tests (#13883)
1 parent 3237d80 commit afd8c9e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

ydb/core/kqp/ut/common/columnshard.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <ydb/core/formats/arrow/serializer/native.h>
55
#include <ydb/core/formats/arrow/serializer/parsing.h>
66
#include <ydb/core/testlib/cs_helper.h>
7+
#include <ydb/core/tx/columnshard/engines/scheme/objects_cache.h>
78

89
extern "C" {
910
#include <yql/essentials/parser/pg_wrapper/postgresql/src/include/catalog/pg_type_d.h>
@@ -26,6 +27,8 @@ namespace NKqp {
2627
TableClient =
2728
std::make_unique<NYdb::NTable::TTableClient>(Kikimr->GetTableClient(NYdb::NTable::TClientSettings().AuthToken("root@builtin")));
2829
Session = std::make_unique<NYdb::NTable::TSession>(TableClient->CreateSession().GetValueSync().GetSession());
30+
31+
NOlap::TSchemaCachesManager::DropCaches();
2932
}
3033

3134
NKikimr::NKqp::TKikimrRunner& TTestHelper::GetKikimr() {

ydb/core/tx/columnshard/engines/scheme/objects_cache.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,19 @@ class TSchemaCachesManager {
9494
return CacheByTableOwner.emplace(ownerPathId, std::make_shared<TSchemaObjectsCache>()).first->second;
9595
}
9696

97+
void DropCachesImpl() {
98+
TGuard lock(Mutex);
99+
CacheByTableOwner.clear();
100+
}
101+
97102
public:
98103
static std::shared_ptr<TSchemaObjectsCache> GetCache(const ui64 ownerPathId) {
99104
return Singleton<TSchemaCachesManager>()->GetCacheImpl(ownerPathId);
100105
}
106+
107+
static void DropCaches() {
108+
Singleton<TSchemaCachesManager>()->DropCachesImpl();
109+
}
101110
};
102111

103112
} // namespace NKikimr::NOlap

0 commit comments

Comments
 (0)