|
@@ -33,7 +33,7 @@ void TPartition::SendReadingFinished(const TString& consumer) {
|
|
|
Send(Tablet, new TEvPQ::TEvReadingPartitionStatusRequest(consumer, Partition.OriginalPartitionId));
|
|
|
}
|
|
|
|
|
|
-void TPartition::FillReadFromTimestamps(const NKikimrPQ::TPQTabletConfig& config, const TActorContext& ctx) {
|
|
|
+void TPartition::FillReadFromTimestamps(const TActorContext& ctx) {
|
|
|
TSet<TString> hasReadRule;
|
|
|
|
|
|
for (auto& [consumer, userInfo] : UsersInfoStorage->GetAll()) {
|
|
@@ -41,14 +41,14 @@ void TPartition::FillReadFromTimestamps(const NKikimrPQ::TPQTabletConfig& config
|
|
|
userInfo.HasReadRule = false;
|
|
|
hasReadRule.insert(consumer);
|
|
|
}
|
|
|
- for (ui32 i = 0; i < config.ReadRulesSize(); ++i) {
|
|
|
- const auto& consumer = config.GetReadRules(i);
|
|
|
- auto& userInfo = UsersInfoStorage->GetOrCreate(consumer, ctx, 0);
|
|
|
+
|
|
|
+ for (auto& consumer : Config.GetConsumers()) {
|
|
|
+ auto& userInfo = UsersInfoStorage->GetOrCreate(consumer.GetName(), ctx, 0);
|
|
|
userInfo.HasReadRule = true;
|
|
|
- ui64 rrGen = i < config.ReadRuleGenerationsSize() ? config.GetReadRuleGenerations(i) : 0;
|
|
|
- if (userInfo.ReadRuleGeneration != rrGen) {
|
|
|
+
|
|
|
+ if (userInfo.ReadRuleGeneration != consumer.GetGeneration()) {
|
|
|
THolder<TEvPQ::TEvSetClientInfo> event = MakeHolder<TEvPQ::TEvSetClientInfo>(
|
|
|
- 0, consumer, 0, "", 0, 0, 0, TActorId{}, TEvPQ::TEvSetClientInfo::ESCI_INIT_READ_RULE, rrGen
|
|
|
+ 0, consumer.GetName(), 0, "", 0, 0, 0, TActorId{}, TEvPQ::TEvSetClientInfo::ESCI_INIT_READ_RULE, consumer.GetGeneration()
|
|
|
);
|
|
|
//
|
|
|
// TODO(abcdef): заменить на вызов ProcessUserAct
|
|
@@ -61,12 +61,13 @@ void TPartition::FillReadFromTimestamps(const NKikimrPQ::TPQTabletConfig& config
|
|
|
}
|
|
|
userInfo.Step = userInfo.Generation = 0;
|
|
|
}
|
|
|
- hasReadRule.erase(consumer);
|
|
|
- TInstant ts = i < config.ReadFromTimestampsMsSize() ? TInstant::MilliSeconds(config.GetReadFromTimestampsMs(i)) : TInstant::Zero();
|
|
|
+ hasReadRule.erase(consumer.GetName());
|
|
|
+ TInstant ts = TInstant::MilliSeconds(consumer.GetReadFromTimestampsMs());
|
|
|
if (!ts) ts += TDuration::MilliSeconds(1);
|
|
|
if (!userInfo.ReadFromTimestamp || userInfo.ReadFromTimestamp > ts)
|
|
|
userInfo.ReadFromTimestamp = ts;
|
|
|
}
|
|
|
+
|
|
|
for (auto& consumer : hasReadRule) {
|
|
|
auto& userInfo = UsersInfoStorage->GetOrCreate(consumer, ctx);
|
|
|
if (userInfo.NoConsumer) {
|
|
@@ -179,9 +180,14 @@ void TPartition::Handle(NReadQuoterEvents::TEvAccountQuotaCountersUpdated::TPtr&
|
|
|
|
|
|
void TPartition::InitUserInfoForImportantClients(const TActorContext& ctx) {
|
|
|
TSet<TString> important;
|
|
|
- for (const auto& importantUser : Config.GetPartitionConfig().GetImportantClientId()) {
|
|
|
- important.insert(importantUser);
|
|
|
- TUserInfo* userInfo = UsersInfoStorage->GetIfExists(importantUser);
|
|
|
+ for (const auto& consumer : Config.GetConsumers()) {
|
|
|
+ if (!consumer.GetImportant()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ important.insert(consumer.GetName());
|
|
|
+
|
|
|
+ TUserInfo* userInfo = UsersInfoStorage->GetIfExists(consumer.GetName());
|
|
|
if (userInfo && !userInfo->Important && userInfo->LabeledCounters) {
|
|
|
ctx.Send(Tablet, new TEvPQ::TEvPartitionLabeledCountersDrop(Partition, userInfo->LabeledCounters->GetGroup()));
|
|
|
userInfo->SetImportant(true);
|
|
@@ -189,12 +195,12 @@ void TPartition::InitUserInfoForImportantClients(const TActorContext& ctx) {
|
|
|
}
|
|
|
if (!userInfo) {
|
|
|
userInfo = &UsersInfoStorage->Create(
|
|
|
- ctx, importantUser, 0, true, "", 0, 0, 0, 0, 0, TInstant::Zero(), {}
|
|
|
+ ctx, consumer.GetName(), 0, true, "", 0, 0, 0, 0, 0, TInstant::Zero(), {}
|
|
|
);
|
|
|
}
|
|
|
if (userInfo->Offset < (i64)StartOffset)
|
|
|
userInfo->Offset = StartOffset;
|
|
|
- ReadTimestampForOffset(importantUser, *userInfo, ctx);
|
|
|
+ ReadTimestampForOffset(consumer.GetName(), *userInfo, ctx);
|
|
|
}
|
|
|
for (auto& [consumer, userInfo] : UsersInfoStorage->GetAll()) {
|
|
|
if (!important.contains(consumer) && userInfo.Important && userInfo.LabeledCounters) {
|