Skip to content

Commit f496d88

Browse files
committed
Better fix for bug #8386 : Crash when creating index on table that uses UDR and ParallelWorkers > 1.
It works correctly with non-SS too.
1 parent 03e5b3e commit f496d88

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/jrd/WorkerAttachment.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ const unsigned WORKER_IDLE_TIMEOUT = 60; // 1 minute
5050
/// class WorkerStableAttachment
5151

5252
WorkerStableAttachment::WorkerStableAttachment(FbStatusVector* status, Jrd::Attachment* attachment) :
53-
SysStableAttachment(attachment),
54-
m_provider(attachment->getProvider())
53+
SysStableAttachment(attachment)
5554
{
5655
UserId user;
5756
user.setUserName("<Worker>");
@@ -70,7 +69,6 @@ WorkerStableAttachment::WorkerStableAttachment(FbStatusVector* status, Jrd::Atta
7069
Monitoring::publishAttachment(tdbb);
7170

7271
initDone();
73-
m_provider->addRef();
7472
}
7573

7674
WorkerStableAttachment::~WorkerStableAttachment()
@@ -459,6 +457,7 @@ StableAttachmentPart* WorkerAttachment::doAttach(FbStatusVector* status, Databas
459457
{
460458
sAtt->addRef(); // !!
461459
sAtt->getHandle()->setIdleTimeout(WORKER_IDLE_TIMEOUT);
460+
jInstance->addRef();
462461
}
463462

464463
return sAtt;
@@ -468,6 +467,15 @@ void WorkerAttachment::doDetach(FbStatusVector* status, StableAttachmentPart* sA
468467
{
469468
status->init();
470469

470+
AutoPlugin<JProvider> provider;
471+
{
472+
AttSyncLockGuard guard(*sAtt->getSync(), FB_FUNCTION);
473+
474+
Attachment* attachment = sAtt->getHandle();
475+
if (attachment)
476+
provider.reset(attachment->getProvider());
477+
}
478+
471479
// if (att->att_flags & ATT_system)
472480
if (Config::getServerMode() == MODE_SUPER)
473481
{

src/jrd/WorkerAttachment.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ class WorkerStableAttachment : public SysStableAttachment
5656
private:
5757
explicit WorkerStableAttachment(FbStatusVector* status, Jrd::Attachment* att);
5858
virtual ~WorkerStableAttachment();
59-
60-
Firebird::AutoPlugin<JProvider> m_provider;
6159
};
6260

6361

0 commit comments

Comments
 (0)