8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 05:23:03 +01:00

Fixed CORE-4267: Server crashes while sweeping the database.

This commit is contained in:
dimitr 2013-11-15 15:40:31 +00:00
parent efa979b1c1
commit 8143f9aa6b
2 changed files with 24 additions and 1 deletions

View File

@ -164,6 +164,7 @@ enum irq_type_t
irq_grant14, // process grant option (exceptions)
irq_grant15, // process grant option (generators)
irq_grant16, // process grant option (domains)
irq_l_curr_format, // lookup table's current format
irq_linger, // get database linger value

View File

@ -1006,8 +1006,30 @@ Format* MET_current(thread_db* tdbb, jrd_rel* relation)
return relation->rel_current_format;
SET_TDBB(tdbb);
Jrd::Attachment* attachment = tdbb->getAttachment();
return relation->rel_current_format = MET_format(tdbb, relation, relation->rel_current_fmt);
if (!(relation->rel_flags & REL_scanned))
{
AutoCacheRequest request(tdbb, irq_l_curr_format, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request)
REL IN RDB$RELATIONS WITH REL.RDB$RELATION_ID EQ relation->rel_id
{
relation->rel_current_fmt = REL.RDB$FORMAT;
}
END_FOR
}
// Usually, format numbers start with one and they are present in RDB$FORMATS.
// However, system tables have zero as their initial format and they don't have
// any related records in RDB$FORMATS, instead their rel_formats[0] is initialized
// directly (see ini.epp). Every other case of zero format number found for an already
// scanned table must be catched here and investigated.
fb_assert(relation->rel_current_fmt || relation->isSystem());
relation->rel_current_format = MET_format(tdbb, relation, relation->rel_current_fmt);
return relation->rel_current_format;
}