mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 03:23:04 +01:00
This should fix bug #7314 : Multitreaded activating indices restarts server process
This commit is contained in:
parent
fbc1185fbf
commit
86f2550ba3
@ -4587,9 +4587,9 @@ static void check_partners(thread_db* tdbb, const USHORT rel_id)
|
|||||||
jrd_rel *relation = (*relations)[rel_id];
|
jrd_rel *relation = (*relations)[rel_id];
|
||||||
fb_assert(relation);
|
fb_assert(relation);
|
||||||
|
|
||||||
|
relation->rel_flags |= REL_check_partners;
|
||||||
LCK_lock(tdbb, relation->rel_partners_lock, LCK_EX, LCK_WAIT);
|
LCK_lock(tdbb, relation->rel_partners_lock, LCK_EX, LCK_WAIT);
|
||||||
LCK_release(tdbb, relation->rel_partners_lock);
|
LCK_release(tdbb, relation->rel_partners_lock);
|
||||||
relation->rel_flags |= REL_check_partners;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -348,9 +348,9 @@ void MET_update_partners(thread_db* tdbb)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// signal other processes
|
// signal other processes
|
||||||
|
relation->rel_flags |= REL_check_partners;
|
||||||
LCK_lock(tdbb, relation->rel_partners_lock, LCK_EX, LCK_WAIT);
|
LCK_lock(tdbb, relation->rel_partners_lock, LCK_EX, LCK_WAIT);
|
||||||
LCK_release(tdbb, relation->rel_partners_lock);
|
LCK_release(tdbb, relation->rel_partners_lock);
|
||||||
relation->rel_flags |= REL_check_partners;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2993,9 +2993,13 @@ jrd_rel* MET_lookup_relation(thread_db* tdbb, const MetaName& name)
|
|||||||
if (check_relation != relation)
|
if (check_relation != relation)
|
||||||
{
|
{
|
||||||
LCK_release(tdbb, check_relation->rel_existence_lock);
|
LCK_release(tdbb, check_relation->rel_existence_lock);
|
||||||
|
if (!(check_relation->rel_flags & REL_check_partners))
|
||||||
|
{
|
||||||
|
check_relation->rel_flags |= REL_check_partners;
|
||||||
LCK_release(tdbb, check_relation->rel_partners_lock);
|
LCK_release(tdbb, check_relation->rel_partners_lock);
|
||||||
LCK_release(tdbb, check_relation->rel_rescan_lock);
|
|
||||||
check_relation->rel_flags &= ~REL_check_partners;
|
check_relation->rel_flags &= ~REL_check_partners;
|
||||||
|
}
|
||||||
|
LCK_release(tdbb, check_relation->rel_rescan_lock);
|
||||||
check_relation->rel_flags |= REL_deleted;
|
check_relation->rel_flags |= REL_deleted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3076,9 +3080,13 @@ jrd_rel* MET_lookup_relation_id(thread_db* tdbb, SLONG id, bool return_deleted)
|
|||||||
if (check_relation != relation)
|
if (check_relation != relation)
|
||||||
{
|
{
|
||||||
LCK_release(tdbb, check_relation->rel_existence_lock);
|
LCK_release(tdbb, check_relation->rel_existence_lock);
|
||||||
|
if (!(check_relation->rel_flags & REL_check_partners))
|
||||||
|
{
|
||||||
|
check_relation->rel_flags |= REL_check_partners;
|
||||||
LCK_release(tdbb, check_relation->rel_partners_lock);
|
LCK_release(tdbb, check_relation->rel_partners_lock);
|
||||||
LCK_release(tdbb, check_relation->rel_rescan_lock);
|
|
||||||
check_relation->rel_flags &= ~REL_check_partners;
|
check_relation->rel_flags &= ~REL_check_partners;
|
||||||
|
}
|
||||||
|
LCK_release(tdbb, check_relation->rel_rescan_lock);
|
||||||
check_relation->rel_flags |= REL_deleted;
|
check_relation->rel_flags |= REL_deleted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4493,8 +4501,11 @@ static int partners_ast_relation(void* ast_object)
|
|||||||
|
|
||||||
AsyncContextHolder tdbb(dbb, FB_FUNCTION, relation->rel_partners_lock);
|
AsyncContextHolder tdbb(dbb, FB_FUNCTION, relation->rel_partners_lock);
|
||||||
|
|
||||||
LCK_release(tdbb, relation->rel_partners_lock);
|
if (!(relation->rel_flags & REL_check_partners))
|
||||||
|
{
|
||||||
relation->rel_flags |= REL_check_partners;
|
relation->rel_flags |= REL_check_partners;
|
||||||
|
LCK_release(tdbb, relation->rel_partners_lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (const Exception&)
|
catch (const Exception&)
|
||||||
{} // no-op
|
{} // no-op
|
||||||
@ -5067,6 +5078,14 @@ void scan_partners(thread_db* tdbb, jrd_rel* relation)
|
|||||||
**************************************/
|
**************************************/
|
||||||
Attachment* attachment = tdbb->getAttachment();
|
Attachment* attachment = tdbb->getAttachment();
|
||||||
|
|
||||||
|
while (relation->rel_flags & REL_check_partners)
|
||||||
|
{
|
||||||
|
relation->rel_flags &= ~REL_check_partners;
|
||||||
|
LCK_lock(tdbb, relation->rel_partners_lock, LCK_SR, LCK_WAIT);
|
||||||
|
|
||||||
|
if (relation->rel_flags & REL_check_partners)
|
||||||
|
continue;
|
||||||
|
|
||||||
AutoCacheRequest request(tdbb, irq_foreign1, IRQ_REQUESTS);
|
AutoCacheRequest request(tdbb, irq_foreign1, IRQ_REQUESTS);
|
||||||
frgn* references = &relation->rel_foreign_refs;
|
frgn* references = &relation->rel_foreign_refs;
|
||||||
int index_number = 0;
|
int index_number = 0;
|
||||||
@ -5188,9 +5207,7 @@ void scan_partners(thread_db* tdbb, jrd_rel* relation)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
END_FOR
|
END_FOR
|
||||||
|
}
|
||||||
LCK_lock(tdbb, relation->rel_partners_lock, LCK_SR, LCK_WAIT);
|
|
||||||
relation->rel_flags &= ~REL_check_partners;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user