mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:03:02 +01:00
Fixed bug #8386 : Crash when creating index on table that uses UDR and ParallelWorkers > 1
This commit is contained in:
parent
9d7f7a2985
commit
4ddbb69de0
@ -50,7 +50,8 @@ const unsigned WORKER_IDLE_TIMEOUT = 60; // 1 minute
|
||||
/// class WorkerStableAttachment
|
||||
|
||||
WorkerStableAttachment::WorkerStableAttachment(FbStatusVector* status, Jrd::Attachment* attachment) :
|
||||
SysStableAttachment(attachment)
|
||||
SysStableAttachment(attachment),
|
||||
m_provider(attachment->getProvider())
|
||||
{
|
||||
UserId user;
|
||||
user.setUserName("<Worker>");
|
||||
@ -69,6 +70,7 @@ WorkerStableAttachment::WorkerStableAttachment(FbStatusVector* status, Jrd::Atta
|
||||
Monitoring::publishAttachment(tdbb);
|
||||
|
||||
initDone();
|
||||
m_provider->addRef();
|
||||
}
|
||||
|
||||
WorkerStableAttachment::~WorkerStableAttachment()
|
||||
@ -76,12 +78,12 @@ WorkerStableAttachment::~WorkerStableAttachment()
|
||||
fini();
|
||||
}
|
||||
|
||||
WorkerStableAttachment* WorkerStableAttachment::create(FbStatusVector* status, Jrd::Database* dbb)
|
||||
WorkerStableAttachment* WorkerStableAttachment::create(FbStatusVector* status, Database* dbb, JProvider* provider)
|
||||
{
|
||||
Attachment* attachment = NULL;
|
||||
try
|
||||
{
|
||||
attachment = Attachment::create(dbb, NULL);
|
||||
attachment = Attachment::create(dbb, provider);
|
||||
attachment->att_filename = dbb->dbb_filename;
|
||||
attachment->att_flags |= ATT_worker;
|
||||
|
||||
@ -120,6 +122,8 @@ void WorkerStableAttachment::fini()
|
||||
BackgroundContextHolder tdbb(dbb, attachment, &status_vector, FB_FUNCTION);
|
||||
|
||||
Monitoring::cleanupAttachment(tdbb);
|
||||
dbb->dbb_extManager->closeAttachment(tdbb, attachment);
|
||||
|
||||
attachment->releaseLocks(tdbb);
|
||||
LCK_fini(tdbb, LCK_OWNER_attachment);
|
||||
|
||||
@ -433,18 +437,17 @@ StableAttachmentPart* WorkerAttachment::doAttach(FbStatusVector* status, Databas
|
||||
{
|
||||
StableAttachmentPart* sAtt = NULL;
|
||||
|
||||
AutoPlugin<JProvider> jInstance(JProvider::getInstance());
|
||||
//jInstance->setDbCryptCallback(&status, tdbb->getAttachment()->att_crypt_callback);
|
||||
|
||||
if (Config::getServerMode() == MODE_SUPER)
|
||||
sAtt = WorkerStableAttachment::create(status, dbb);
|
||||
sAtt = WorkerStableAttachment::create(status, dbb, jInstance);
|
||||
else
|
||||
{
|
||||
ClumpletWriter dpb(ClumpletReader::Tagged, MAX_DPB_SIZE, isc_dpb_version1);
|
||||
dpb.insertString(isc_dpb_trusted_auth, DBA_USER_NAME);
|
||||
dpb.insertInt(isc_dpb_worker_attach, 1);
|
||||
|
||||
AutoPlugin<JProvider> jInstance(JProvider::getInstance());
|
||||
|
||||
//jInstance->setDbCryptCallback(&status, tdbb->getAttachment()->att_crypt_callback);
|
||||
|
||||
JAttachment* jAtt = jInstance->attachDatabase(status, dbb->dbb_filename.c_str(),
|
||||
dpb.getBufferLength(), dpb.getBuffer());
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace Jrd
|
||||
class WorkerStableAttachment : public SysStableAttachment
|
||||
{
|
||||
public:
|
||||
static WorkerStableAttachment* create(FbStatusVector* status, Jrd::Database* dbb);
|
||||
static WorkerStableAttachment* create(FbStatusVector* status, Database* dbb, JProvider* provider);
|
||||
|
||||
void fini();
|
||||
|
||||
@ -56,6 +56,8 @@ protected:
|
||||
private:
|
||||
explicit WorkerStableAttachment(FbStatusVector* status, Jrd::Attachment* att);
|
||||
virtual ~WorkerStableAttachment();
|
||||
|
||||
Firebird::AutoPlugin<JProvider> m_provider;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user