Skip to content
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

fix groups allocation cleaning #10274

Merged
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions ydb/core/tx/limiter/grouped_memory/service/ids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ ui64 TIdsControl::ExtractInternalIdVerified(const ui64 externalId) {
return result;
}

std::optional<ui64> TIdsControl::ExtractInternalIdOptional(const ui64 externalId) {
auto it = ExternalIdIntoInternalId.find(externalId);
if (it == ExternalIdIntoInternalId.end()) {
return std::nullopt;
}
const ui64 result = it->second;
InternalIdIntoExternalId.erase(result);
ExternalIdIntoInternalId.erase(it);
return result;
}

std::optional<ui64> TIdsControl::GetInternalIdOptional(const ui64 externalId) const {
auto it = ExternalIdIntoInternalId.find(externalId);
if (it != ExternalIdIntoInternalId.end()) {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/tx/limiter/grouped_memory/service/ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class TIdsControl {
}

[[nodiscard]] ui64 ExtractInternalIdVerified(const ui64 externalId);
[[nodiscard]] std::optional<ui64> ExtractInternalIdOptional(const ui64 externalId);

ui64 GetMinInternalIdVerified() const;
ui64 GetExternalIdVerified(const ui64 internalId) const;
Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/limiter/grouped_memory/service/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class TProcessMemoryScope: public NColumnShard::TMonitoringObjectsCounter<TProce
}

void UnregisterGroup(const bool isPriorityProcess, const ui64 externalGroupId) {
if (auto internalGroupId = GroupIds.GetInternalIdOptional(externalGroupId)) {
if (auto internalGroupId = GroupIds.ExtractInternalIdOptional(externalGroupId)) {
AFL_INFO(NKikimrServices::GROUPED_MEMORY_LIMITER)("event", "remove_group")("external_group_id", externalGroupId)(
"internal_group_id", internalGroupId);
UnregisterGroupImpl(*internalGroupId);
Expand Down
Loading