@@ -19,7 +19,7 @@ bool DatabasesAreSame(std::shared_ptr<TDbInfo> lhs, std::shared_ptr<TDbInfo> rhs
19
19
if (!lhs || !rhs) {
20
20
return false ;
21
21
}
22
- return lhs->path () == rhs->path () && lhs->endpoint () == rhs->endpoint ();
22
+ return lhs->name () == rhs-> name () && lhs-> path () == rhs->path () && lhs->endpoint () == rhs->endpoint ();
23
23
}
24
24
25
25
NTopic::TTopicClientSettings FromFederated (const TFederatedTopicClientSettings& settings);
@@ -107,8 +107,10 @@ void TFederatedWriteSessionImpl::OpenSubsessionImpl(std::shared_ptr<TDbInfo> db)
107
107
Y_ABORT_UNLESS (Lock.IsLocked ());
108
108
if (Subsession) {
109
109
PendingToken.reset ();
110
- Subsession->Close (TDuration::Zero ());
110
+ OldSubsession = std::move (Subsession);
111
+ OldSubsession->Close (TDuration::Zero ());
111
112
}
113
+
112
114
auto clientSettings = SubclientSettings;
113
115
clientSettings
114
116
.Database (db->path ())
@@ -148,6 +150,11 @@ void TFederatedWriteSessionImpl::OpenSubsessionImpl(std::shared_ptr<TDbInfo> db)
148
150
}
149
151
})
150
152
.SessionClosedHandler ([selfCtx = SelfContext](const NTopic::TSessionClosedEvent & ev) {
153
+ if (ev.IsSuccess ()) {
154
+ // The subsession was closed by the federated write session itself while creating a new subsession.
155
+ // In this case we get SUCCESS status and don't need to propagate it further.
156
+ return ;
157
+ }
151
158
if (auto self = selfCtx->LockShared ()) {
152
159
with_lock (self->Lock ) {
153
160
self->CloseImpl (ev);
@@ -291,8 +298,10 @@ void TFederatedWriteSessionImpl::ScheduleFederationStateUpdateImpl(TDuration del
291
298
auto cb = [selfCtx = SelfContext](bool ok) {
292
299
if (ok) {
293
300
if (auto self = selfCtx->LockShared ()) {
301
+ std::shared_ptr<NTopic::IWriteSession> old;
294
302
with_lock (self->Lock ) {
295
303
self->UpdateFederationStateImpl ();
304
+ old = std::move (self->OldSubsession );
296
305
}
297
306
}
298
307
}
0 commit comments