mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 06:43:04 +01:00
Fixed CORE-5677: RDB$PAGES is dirty after error after phase 3 of create_relation (#135)
This commit is contained in:
parent
95138483da
commit
3f62ad0e0a
@ -3551,6 +3551,30 @@ static bool create_relation(thread_db* tdbb, SSHORT phase, DeferredWork* work, j
|
||||
switch (phase)
|
||||
{
|
||||
case 0:
|
||||
// We need to cleanup RDB$PAGES and pages if they were added at phase 3.
|
||||
request.reset(tdbb, irq_c_relation3, IRQ_REQUESTS);
|
||||
|
||||
FOR(REQUEST_HANDLE request)
|
||||
X IN RDB$RELATIONS WITH
|
||||
X.RDB$RELATION_NAME EQ work->dfw_name.c_str()
|
||||
{
|
||||
rel_id = X.RDB$RELATION_ID;
|
||||
if ( (relation = MET_lookup_relation_id(tdbb, rel_id, false)) )
|
||||
{
|
||||
RelationPages* const relPages = relation->getBasePages();
|
||||
|
||||
if (relPages->rel_index_root)
|
||||
IDX_delete_indices(tdbb, relation, relPages);
|
||||
|
||||
if (relPages->rel_pages)
|
||||
DPM_delete_relation(tdbb, relation);
|
||||
|
||||
// Mark relation in the cache as dropped
|
||||
relation->rel_flags |= REL_deleted;
|
||||
}
|
||||
}
|
||||
END_FOR
|
||||
|
||||
if (work->dfw_lock)
|
||||
{
|
||||
LCK_release(tdbb, work->dfw_lock);
|
||||
@ -3595,7 +3619,9 @@ static bool create_relation(thread_db* tdbb, SSHORT phase, DeferredWork* work, j
|
||||
if (rel_id < local_min_relation_id || rel_id > MAX_RELATION_ID)
|
||||
rel_id = X.RDB$RELATION_ID = local_min_relation_id;
|
||||
|
||||
while ( (relation = MET_lookup_relation_id(tdbb, rel_id++, false)) )
|
||||
// Roman Simakov: We need to return deleted relations to skip them.
|
||||
// This maybe result of cleanup failure after phase 3.
|
||||
while ( (relation = MET_lookup_relation_id(tdbb, rel_id++, true)) )
|
||||
{
|
||||
if (rel_id < local_min_relation_id || rel_id > MAX_RELATION_ID)
|
||||
rel_id = local_min_relation_id;
|
||||
@ -4796,7 +4822,7 @@ static bool delete_relation(thread_db* tdbb, SSHORT phase, DeferredWork* work, j
|
||||
EXT_fini(relation, false);
|
||||
}
|
||||
|
||||
RelationPages* relPages = relation->getBasePages();
|
||||
RelationPages* const relPages = relation->getBasePages();
|
||||
if (relPages->rel_index_root) {
|
||||
IDX_delete_indices(tdbb, relation, relPages);
|
||||
}
|
||||
|
@ -175,6 +175,7 @@ enum irq_type_t
|
||||
irq_grant18, // process grant option (filters)
|
||||
irq_grant19, // process grant option (roles)
|
||||
irq_l_curr_format, // lookup table's current format
|
||||
irq_c_relation3, // lookup relation in phase 0 to cleanup
|
||||
|
||||
irq_linger, // get database linger value
|
||||
irq_dbb_ss_definer, // get database sql security value
|
||||
|
Loading…
Reference in New Issue
Block a user