aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSemyon <yentsovsemyon@ydb.tech>2025-07-30 11:56:24 +0300
committerGitHub <noreply@github.com>2025-07-30 08:56:24 +0000
commita82cb1ec5dddc0928ac73a1935f7016a1eba6412 (patch)
treed83e909dc46f4bb9bb54c272b6589797f0e72dd3
parent321dc7b5db882d07983a30fd503d5e86ffbdf9f4 (diff)
downloadydb-a82cb1ec5dddc0928ac73a1935f7016a1eba6412.tar.gz
keep operators for unavailable tiers (#21841)
-rw-r--r--ydb/core/tx/columnshard/blobs_action/abstract/action.h2
-rw-r--r--ydb/core/tx/columnshard/columnshard.cpp1
-rw-r--r--ydb/core/tx/tiering/manager.cpp17
-rw-r--r--ydb/core/tx/tiering/manager.h19
4 files changed, 27 insertions, 12 deletions
diff --git a/ydb/core/tx/columnshard/blobs_action/abstract/action.h b/ydb/core/tx/columnshard/blobs_action/abstract/action.h
index 90d5959e51c..f3eff4bf803 100644
--- a/ydb/core/tx/columnshard/blobs_action/abstract/action.h
+++ b/ydb/core/tx/columnshard/blobs_action/abstract/action.h
@@ -83,7 +83,7 @@ private:
TStorageAction& GetStorageAction(const TString& storageId) {
auto it = StorageActions.find(storageId);
if (it == StorageActions.end()) {
- it = StorageActions.emplace(storageId, Storages->GetOperator(storageId)).first;
+ it = StorageActions.emplace(storageId, Storages->GetOperatorVerified(storageId)).first;
}
return it->second;
}
diff --git a/ydb/core/tx/columnshard/columnshard.cpp b/ydb/core/tx/columnshard/columnshard.cpp
index 0cc62cf4fa8..b3e2af249fa 100644
--- a/ydb/core/tx/columnshard/columnshard.cpp
+++ b/ydb/core/tx/columnshard/columnshard.cpp
@@ -112,6 +112,7 @@ void TColumnShard::OnActivateExecutor(const TActorContext& ctx) {
Tiers->Start(Tiers);
if (const auto& tiersSnapshot = NYDBTest::TControllers::GetColumnShardController()->GetOverrideTierConfigs(); !tiersSnapshot.empty()) {
for (const auto& [id, tier] : tiersSnapshot) {
+ Tiers->ActivateTiers({ NTiers::TExternalStorageId(id) });
Tiers->UpdateTierConfig(tier, NTiers::TExternalStorageId(id), false);
}
}
diff --git a/ydb/core/tx/tiering/manager.cpp b/ydb/core/tx/tiering/manager.cpp
index add3368f009..5192f9674b4 100644
--- a/ydb/core/tx/tiering/manager.cpp
+++ b/ydb/core/tx/tiering/manager.cpp
@@ -257,8 +257,11 @@ const NTiers::TManager* TTiersManager::GetManagerOptional(const NTiers::TExterna
void TTiersManager::ActivateTiers(const THashSet<NTiers::TExternalStorageId>& usedTiers) {
AFL_VERIFY(Actor)("error", "tiers_manager_is_not_started");
for (const NTiers::TExternalStorageId& tierId : usedTiers) {
- if (!Tiers.contains(tierId)) {
- Tiers.emplace(tierId, TTierGuard(tierId, this));
+ auto findTier = Tiers.find(tierId);
+ if (findTier == Tiers.end()) {
+ findTier = Tiers.emplace(tierId, TTierGuard(tierId, this)).first;
+ }
+ if (findTier->second.GetState() != TTiersManager::ETierState::AVAILABLE) {
const auto& actorContext = NActors::TActivationContext::AsActorContext();
AFL_VERIFY(&actorContext)("error", "no_actor_context");
actorContext.Send(Actor->SelfId(), new NTiers::TEvWatchSchemeObject({ tierId.GetConfigPath() }));
@@ -277,14 +280,12 @@ void TTiersManager::UpdateSecretsSnapshot(std::shared_ptr<NMetadata::NSecret::TS
void TTiersManager::UpdateTierConfig(
std::optional<NTiers::TTierConfig> config, const NTiers::TExternalStorageId& tierId, const bool notifyShard) {
AFL_INFO(NKikimrServices::TX_TIERING)("event", "update_tier_config")("name", tierId.ToString())("tablet", TabletId)("has_config", !!config);
+ TTierGuard* findTier = Tiers.FindPtr(tierId);
+ AFL_VERIFY(findTier)("tier", tierId.ToString());
if (config) {
- TTierGuard* findTier = Tiers.FindPtr(tierId);
- if (!findTier) {
- findTier = &Tiers.emplace(tierId, TTierGuard(tierId, this)).first->second;
- }
findTier->UpsertConfig(*config);
} else {
- Tiers.erase(tierId);
+ findTier->ResetConfig();
}
OnConfigsUpdated(notifyShard);
}
@@ -292,7 +293,7 @@ void TTiersManager::UpdateTierConfig(
ui64 TTiersManager::GetAwaitedConfigsCount() const {
ui64 count = 0;
for (const auto& [id, tier] : Tiers) {
- if (!tier.HasConfig()) {
+ if (tier.GetState() == ETierState::REQUESTED) {
++count;
}
}
diff --git a/ydb/core/tx/tiering/manager.h b/ydb/core/tx/tiering/manager.h
index 6921fb78303..0c8a7f051ba 100644
--- a/ydb/core/tx/tiering/manager.h
+++ b/ydb/core/tx/tiering/manager.h
@@ -48,25 +48,38 @@ public:
class TTiersManager: public ITiersManager {
public:
+ enum class ETierState {
+ REQUESTED = 1,
+ UNAVAILABLE = 2,
+ AVAILABLE = 3,
+ };
+
class TTierGuard : NNonCopyable::TMoveOnly {
private:
NTiers::TExternalStorageId StorageId;
- std::optional<NTiers::TTierConfig> Config;
+ NTiers::TTierConfig Config;
TTiersManager* Owner;
+ YDB_READONLY(ETierState, State, TTiersManager::ETierState::REQUESTED);
public:
bool HasConfig() const {
- return !!Config;
+ return State == ETierState::AVAILABLE;
}
const NTiers::TTierConfig& GetConfigVerified() const {
- return *TValidator::CheckNotNull(Config);
+ AFL_VERIFY(HasConfig());
+ return Config;
}
void UpsertConfig(NTiers::TTierConfig config) {
+ State = ETierState::AVAILABLE;
Config = std::move(config);
}
+ void ResetConfig() {
+ State = ETierState::UNAVAILABLE;
+ }
+
const NTiers::TExternalStorageId& GetStorageId() const {
return StorageId;
}