Skip to content

Commit 6984ae6

Browse files
committed
Moved commit "Federated Topic: Log on federation discovery failure" from ydb repo
1 parent e584d37 commit 6984ae6

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/client/federated_topic/impl/federation_observer.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,27 @@ void TFederatedDbObserverImpl::OnFederationDiscovery(TStatus&& status, Ydb::Fede
147147
FederatedDbState->DbInfos.emplace_back(std::move(db));
148148

149149
} else {
150-
if (!status.IsSuccess()) {
150+
if (status.IsSuccess()) {
151+
ScheduleFederationDiscoveryImpl(REDISCOVERY_DELAY);
152+
} else {
153+
LOG_LAZY(DbDriverState_->Log, TLOG_ERR, TStringBuilder()
154+
<< "OnFederationDiscovery: Got error. Status: " << status.GetStatus()
155+
<< ". Description: " << status.GetIssues().ToOneLineString());
151156
if (!FederationDiscoveryRetryState) {
152157
FederationDiscoveryRetryState = FederationDiscoveryRetryPolicy->CreateRetryState();
153158
}
154159

155-
auto retryDelay = FederationDiscoveryRetryState->GetNextRetryDelay(status.GetStatus());
156-
157-
if (retryDelay) {
158-
ScheduleFederationDiscoveryImpl(*retryDelay);
160+
if (auto d = FederationDiscoveryRetryState->GetNextRetryDelay(status.GetStatus())) {
161+
ScheduleFederationDiscoveryImpl(*d);
159162
return;
160163
}
161-
// If retryDelay is Nothing, meaning there won't be another retry,
162-
// we replace FederatedDbState with the unsuccessful one and then set the PromiseToInitState if needed,
163-
// and the observer becomes stale (see IsStale method).
164-
} else {
165-
ScheduleFederationDiscoveryImpl(REDISCOVERY_DELAY);
164+
// If there won't be another retry, we replace FederatedDbState with the unsuccessful one
165+
// and set the PromiseToInitState to make the observer stale (see IsStale method).
166166
}
167167

168168
// TODO validate new state and check if differs from previous
169-
170169
auto newInfo = std::make_shared<TFederatedDbState>(std::move(result), std::move(status));
170+
171171
// TODO update only if new state differs
172172
std::swap(FederatedDbState, newInfo);
173173
}

src/client/topic/impl/read_session_impl.ipp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ bool TSingleClusterReadSessionImpl<UseMigrationProtocol>::Reconnect(const TPlain
258258

259259
if (!status.Ok()) {
260260
LOG_LAZY(Log, TLOG_ERR, GetLogPrefix() << "Got error. Status: " << status.Status
261-
<< ". Description: " << IssuesSingleLineString(status.Issues));
261+
<< ". Description: " << IssuesSingleLineString(status.Issues));
262262
}
263263

264264
NYdbGrpc::IQueueClientContextPtr delayContext = nullptr;

0 commit comments

Comments
 (0)