@@ -50,7 +50,8 @@ const unsigned WORKER_IDLE_TIMEOUT = 60; // 1 minute
5050// / class WorkerStableAttachment
5151
5252WorkerStableAttachment::WorkerStableAttachment (FbStatusVector* status, Jrd::Attachment* attachment) :
53- SysStableAttachment (attachment)
53+ SysStableAttachment (attachment),
54+ m_provider (attachment->getProvider ())
5455{
5556 UserId user;
5657 user.setUserName (" <Worker>" );
@@ -69,19 +70,20 @@ WorkerStableAttachment::WorkerStableAttachment(FbStatusVector* status, Jrd::Atta
6970 Monitoring::publishAttachment (tdbb);
7071
7172 initDone ();
73+ m_provider->addRef ();
7274}
7375
7476WorkerStableAttachment::~WorkerStableAttachment ()
7577{
7678 fini ();
7779}
7880
79- WorkerStableAttachment* WorkerStableAttachment::create (FbStatusVector* status, Jrd:: Database* dbb)
81+ WorkerStableAttachment* WorkerStableAttachment::create (FbStatusVector* status, Database* dbb, JProvider* provider )
8082{
8183 Attachment* attachment = NULL ;
8284 try
8385 {
84- attachment = Attachment::create (dbb, NULL );
86+ attachment = Attachment::create (dbb, provider );
8587 attachment->att_filename = dbb->dbb_filename ;
8688 attachment->att_flags |= ATT_worker;
8789
@@ -120,6 +122,8 @@ void WorkerStableAttachment::fini()
120122 BackgroundContextHolder tdbb (dbb, attachment, &status_vector, FB_FUNCTION);
121123
122124 Monitoring::cleanupAttachment (tdbb);
125+ dbb->dbb_extManager ->closeAttachment (tdbb, attachment);
126+
123127 attachment->releaseLocks (tdbb);
124128 LCK_fini (tdbb, LCK_OWNER_attachment);
125129
@@ -433,18 +437,17 @@ StableAttachmentPart* WorkerAttachment::doAttach(FbStatusVector* status, Databas
433437{
434438 StableAttachmentPart* sAtt = NULL ;
435439
440+ AutoPlugin<JProvider> jInstance (JProvider::getInstance ());
441+ // jInstance->setDbCryptCallback(&status, tdbb->getAttachment()->att_crypt_callback);
442+
436443 if (Config::getServerMode () == MODE_SUPER)
437- sAtt = WorkerStableAttachment::create (status, dbb);
444+ sAtt = WorkerStableAttachment::create (status, dbb, jInstance );
438445 else
439446 {
440447 ClumpletWriter dpb (ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
441448 dpb.insertString (isc_dpb_trusted_auth, DBA_USER_NAME);
442449 dpb.insertInt (isc_dpb_worker_attach, 1 );
443450
444- AutoPlugin<JProvider> jInstance (JProvider::getInstance ());
445-
446- // jInstance->setDbCryptCallback(&status, tdbb->getAttachment()->att_crypt_callback);
447-
448451 JAttachment* jAtt = jInstance->attachDatabase (status, dbb->dbb_filename .c_str (),
449452 dpb.getBufferLength (), dpb.getBuffer ());
450453
0 commit comments