Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7b75e89

Browse files
authored
Add detach replica to shutdown function (#8688)
When apply segment using an external engine (Jaybird/UDR), the replica is not detached by nullifying the variable, because releaseAttachment is not called
1 parent ab7da95 commit 7b75e89

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

‎src/remote/server/ReplServer.cpp‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,11 @@ namespace
384384
provider->attachDatabase(&localStatus, m_config->dbName.c_str(),
385385
dpb.getBufferLength(), dpb.getBuffer());
386386
localStatus.check();
387-
m_attachment.assignRefNoIncr(att);
387+
m_attachment = att;
388388

389389
const auto repl = m_attachment->createReplicator(&localStatus);
390390
localStatus.check();
391-
m_replicator.assignRefNoIncr(repl);
391+
m_replicator = repl;
392392

393393
fb_assert(!m_sequence);
394394

@@ -416,8 +416,17 @@ namespace
416416

417417
void shutdown()
418418
{
419-
m_replicator = nullptr;
420-
m_attachment = nullptr;
419+
FbLocalStatus localStatus;
420+
if (m_replicator)
421+
{
422+
m_replicator->close(&localStatus);
423+
m_replicator = nullptr;
424+
}
425+
if (m_attachment)
426+
{
427+
m_attachment->detach(&localStatus);
428+
m_attachment = nullptr;
429+
}
421430
m_sequence = 0;
422431
m_connected = false;
423432
}
@@ -437,7 +446,7 @@ namespace
437446

438447
bool isShutdown() const
439448
{
440-
return (m_attachment == NULL);
449+
return (m_attachment == nullptr);
441450
}
442451

443452
const PathName& getDirectory() const
@@ -495,8 +504,8 @@ namespace
495504

496505
private:
497506
AutoPtr<const Replication::Config> m_config;
498-
RefPtr<IAttachment> m_attachment;
499-
RefPtr<IReplicator> m_replicator;
507+
IAttachment* m_attachment;
508+
IReplicator* m_replicator;
500509
FB_UINT64 m_sequence;
501510
bool m_connected;
502511
string m_lastError;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /