diff options
author | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-11-28 09:51:57 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-11-28 10:46:19 +0300 |
commit | 1d644912f1f2a4db97462dc1095d5a6b6c777b67 (patch) | |
tree | ba488b1239d16189746616d53d9233ad1797653b | |
parent | cfcea9a51e10b12e6e4a28e908e479da31d15f3e (diff) | |
download | ydb-1d644912f1f2a4db97462dc1095d5a6b6c777b67.tar.gz |
KIKIMR-20072: fix tests after normalizer
-rw-r--r-- | ydb/core/base/appdata_fwd.h | 15 | ||||
-rw-r--r-- | ydb/core/tx/columnshard/engines/storage/optimizer/abstract/optimizer.h | 4 |
2 files changed, 16 insertions, 3 deletions
diff --git a/ydb/core/base/appdata_fwd.h b/ydb/core/base/appdata_fwd.h index 85dc3ccbb3..2863ddd572 100644 --- a/ydb/core/base/appdata_fwd.h +++ b/ydb/core/base/appdata_fwd.h @@ -277,11 +277,24 @@ struct TAppData { inline TAppData* AppData(NActors::TActorSystem* actorSystem) { Y_DEBUG_ABORT_UNLESS(actorSystem); - TAppData * const x = actorSystem->AppData<TAppData>(); + TAppData* const x = actorSystem->AppData<TAppData>(); Y_DEBUG_ABORT_UNLESS(x && x->Magic == TAppData::MagicTag); return x; } +inline bool HasAppData() { + return !!NActors::TlsActivationContext; +} + +inline TAppData& AppDataVerified() { + Y_ABORT_UNLESS(HasAppData()); + auto& actorSystem = NActors::TlsActivationContext->ExecutorThread.ActorSystem; + Y_ABORT_UNLESS(actorSystem); + TAppData* const x = actorSystem->AppData<TAppData>(); + Y_ABORT_UNLESS(x && x->Magic == TAppData::MagicTag); + return *x; +} + inline TAppData* AppData() { return AppData(NActors::TlsActivationContext->ExecutorThread.ActorSystem); } diff --git a/ydb/core/tx/columnshard/engines/storage/optimizer/abstract/optimizer.h b/ydb/core/tx/columnshard/engines/storage/optimizer/abstract/optimizer.h index a55c2118dd..d1d0ddfe1e 100644 --- a/ydb/core/tx/columnshard/engines/storage/optimizer/abstract/optimizer.h +++ b/ydb/core/tx/columnshard/engines/storage/optimizer/abstract/optimizer.h @@ -80,7 +80,7 @@ public: std::vector<std::shared_ptr<TPortionInfo>> RemovePortions; public: TModificationGuard& AddPortion(const std::shared_ptr<TPortionInfo>& portion) { - if (AppData()->ColumnShardConfig.GetSkipOldGranules() && portion->GetDeprecatedGranuleId() > 0) { + if (HasAppData() && AppDataVerified().ColumnShardConfig.GetSkipOldGranules() && portion->GetDeprecatedGranuleId() > 0) { AFL_WARN(NKikimrServices::TX_COLUMNSHARD)("event", "skip_granule")("granule_id", portion->GetDeprecatedGranuleId()); return *this; } @@ -89,7 +89,7 @@ public: } TModificationGuard& RemovePortion(const std::shared_ptr<TPortionInfo>& portion) { - if (AppData()->ColumnShardConfig.GetSkipOldGranules() && portion->GetDeprecatedGranuleId() > 0) { + if (HasAppData() && AppDataVerified().ColumnShardConfig.GetSkipOldGranules() && portion->GetDeprecatedGranuleId() > 0) { AFL_WARN(NKikimrServices::TX_COLUMNSHARD)("event", "skip_granule")("granule_id", portion->GetDeprecatedGranuleId()); return *this; } |