Skip to content

Commit

Permalink
autocomplete-improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
StekPerepolnen committed May 8, 2024
1 parent 6dc1fa2 commit 7a29f22
Show file tree
Hide file tree
Showing 7 changed files with 371 additions and 111 deletions.
38 changes: 38 additions & 0 deletions ydb/core/tx/scheme_board/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,36 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
break;
}
}

// const auto& self = pathDesc.GetSelf();
// bool needSysFolder = false;
// const auto& domainsInfo = AppData()->DomainsInfo;
// if (self.GetPathType() == NKikimrSchemeOp::EPathType::EPathTypeSubDomain ||
// self.GetPathType() == NKikimrSchemeOp::EPathType::EPathTypeColumnStore ||
// self.GetPathType() == NKikimrSchemeOp::EPathType::EPathTypeColumnTable)
// {
// needSysFolder = true;
// } else if (self.GetPathId() == NSchemeShard::RootPathId) {
// if (const auto& domain = domainsInfo->Domain; domain && domain->SchemeRoot == self.GetSchemeshardId()) {
// needSysFolder = true;
// }
// }

// if (needSysFolder) {
// bool hasSysFolder = false;

// const auto& children = pathDesc.GetChildren();
// if (!children.empty()) {
// auto size = children.size();
// if (children[size - 1].GetName() == NSysView::SysPathName) {
// hasSysFolder = true;
// }
// }

// if (!hasSysFolder) {
// ListNodeEntry->Children.emplace_back(TString(NSysView::SysPathName), TPathId(self.GetSchemeshardId(), InvalidLocalPathId), TNavigate::KindPath);
// }
// }
}
}

Expand Down Expand Up @@ -1918,6 +1948,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
<< ", entry# " << entry.ToString()
<< ", props# " << props.ToString());

Cerr << "IIII FillEntry " << Endl;
TKeyDesc& keyDesc = *entry.KeyDescription;

if (props.IsSync && props.Partial) {
Expand Down Expand Up @@ -2172,13 +2203,16 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
TPathExtractor pathExtractor, TTabletIdExtractor tabletIdExtractor)
{
auto path = pathExtractor(entry);
Cerr << "IIII HandleEntry " << path << Endl;
TCacheItem* cacheItem = Cache.FindPtr(path);

if (!cacheItem) {
Cerr << "IIII !cacheItem " << Endl;
const EPathType pathType = PathType(path);
switch (pathType) {
case EPathType::RegularPath:
{
Cerr << "IIII RegularPath " << Endl;
const ui64 tabletId = tabletIdExtractor(entry);
if (tabletId == ui64(NSchemeShard::InvalidTabletId) || (tabletId >> 56) != 1) {
return SetRootUnknown(context.Get(), entry);
Expand Down Expand Up @@ -2212,11 +2246,13 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
break;
}
case EPathType::SysPath:
Cerr << "IIII SysPath " << Endl;
cacheItem = &Cache.Upsert(path, TCacheItem(this, TSubscriber(), true));
cacheItem->FillAsSysPath();
break;
case EPathType::SysLocksV1:
case EPathType::SysLocksV2:
Cerr << "IIII SysLocks " << Endl;
cacheItem = &Cache.Upsert(path, TCacheItem(this, TSubscriber(), true));
cacheItem->FillAsSysLocks(pathType == EPathType::SysLocksV2);
break;
Expand All @@ -2225,6 +2261,8 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {

Cache.Promote(path);

Cerr << "IIII cacheItem->IsFilled() " << cacheItem->IsFilled() << Endl;
Cerr << "IIII !entry.SyncVersion " << !entry.SyncVersion << Endl;
if (cacheItem->IsFilled() && !entry.SyncVersion) {
cacheItem->FillEntry(context.Get(), entry);
}
Expand Down
27 changes: 27 additions & 0 deletions ydb/core/tx/scheme_board/cache_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class TCacheTest: public TTestWithSchemeshard {
UNIT_TEST(RacyRecreateAndSync);
UNIT_TEST(RacyCreateAndSync);
UNIT_TEST(CheckAccess);
UNIT_TEST(Check1000);
UNIT_TEST(CheckSystemViewAccess);
UNIT_TEST(SystemView);
UNIT_TEST(SysLocks);
Expand All @@ -72,6 +73,7 @@ class TCacheTest: public TTestWithSchemeshard {
void RacyRecreateAndSync();
void RacyCreateAndSync();
void CheckAccess();
void Check1000();
void CheckSystemViewAccess();
void SystemView();
void SysLocks();
Expand Down Expand Up @@ -300,6 +302,21 @@ void TCacheTest::CheckAccess() {
TestNavigateByTableId(entry.TableId, TNavigate::EStatus::Ok, "/Root/DirA", "user0@builtin");
}

void TCacheTest::Check1000() {
ui64 txId = 100;
TestCreateSubDomain(*Context, ++txId, "/Root", "Name: \"SubDomainA\"");
TestWaitNotification(*Context, {txId}, CreateNotificationSubscriber(*Context, TTestTxConfig::SchemeShard));
TestModifyACL(*Context, ++txId, "/Root", "SubDomainA", TString(), "user0@builtin");

auto entry = TestNavigate("/Root/SubDomainA",
TNavigate::EStatus::Ok, TString(), TNavigate::OpList, true, true, false);

auto tableId = entry.TableId;
//UNIT_ASSERT_VALUES_EQUAL(tableId.SysViewInfo, "partition_stats");

//TestResolve(tableId, TResolve::EStatus::OkData);
}

void TCacheTest::CheckSystemViewAccess() {
ui64 txId = 100;
TestCreateSubDomain(*Context, ++txId, "/Root", "Name: \"SubDomainA\"");
Expand Down Expand Up @@ -393,6 +410,16 @@ TNavigate::TEntry TCacheTest::TestNavigateImpl(THolder<TNavigate> request, TNavi
UNIT_ASSERT(!ev->Get()->Request->ResultSet.empty());

const TNavigate::TEntry result = ev->Get()->Request->ResultSet[0];

Cerr << "iiiii 1 " << Endl;
if (result.ListNodeEntry) {
Cerr << "iiiii 11 " << Endl;
Cerr << "iiiii size() " << result.ListNodeEntry->Children.size() << Endl;
for (auto& child: result.ListNodeEntry->Children) {
Cerr << "iiiii child.Name " << child.Name << Endl;
}
}
Cerr << "iiiii 2 " << Endl;
UNIT_ASSERT_VALUES_EQUAL(result.Status, expectedStatus);
return result;
}
Expand Down
Loading

0 comments on commit 7a29f22

Please sign in to comment.