aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhcpp <hcpp@ydb.tech>2023-04-17 12:13:40 +0300
committerhcpp <hcpp@ydb.tech>2023-04-17 12:13:40 +0300
commitae7b4803a84f0f9723a99815b78fb56c82df74f3 (patch)
tree3a6c033737b0f4157efa27a105c31cac3966233c
parent271a9a37704b9d286b8a6916c963133eae3160d9 (diff)
downloadydb-ae7b4803a84f0f9723a99815b78fb56c82df74f3.tar.gz
tenant info assign has been fixed
-rw-r--r--ydb/core/fq/libs/control_plane_config/events/events.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/ydb/core/fq/libs/control_plane_config/events/events.h b/ydb/core/fq/libs/control_plane_config/events/events.h
index e2f1bf5f4d..20f75253fa 100644
--- a/ydb/core/fq/libs/control_plane_config/events/events.h
+++ b/ydb/core/fq/libs/control_plane_config/events/events.h
@@ -31,9 +31,10 @@ struct TTenantInfo {
THashMap<TString /* tenant */, ui32 /* state */> TenantState;
TInstant StateTime;
- TString Assign(const TString& cloudId, const TString& /* scope */, const TString& DefaultTenantName = "") {
-
- auto vTenant = SubjectMapping[SUBJECT_TYPE_CLOUD].Value(cloudId, "");
+ // this method must be thread safe
+ TString Assign(const TString& cloudId, const TString& /* scope */, const TString& DefaultTenantName = "") const {
+ auto it = SubjectMapping.find(SUBJECT_TYPE_CLOUD);
+ auto vTenant = it == SubjectMapping.end() ? "" : it->second.Value(cloudId, "");
if (!vTenant && CommonVTenants.size()) {
vTenant = CommonVTenants[MultiHash(cloudId) % CommonVTenants.size()];
}