diff --git a/src/jrd/BulkInsert.cpp b/src/jrd/BulkInsert.cpp index a86f407d3f5..e1a88e1990d 100644 --- a/src/jrd/BulkInsert.cpp +++ b/src/jrd/BulkInsert.cpp @@ -219,7 +219,7 @@ void BulkInsert::Buffer::fragmentRecord(thread_db* tdbb, record_param* rpb, Comp // Fill up data pages tail first until what's left fits on a single page. auto size = dcc->getPackedLength(); - fb_assert(size > max_data); + fb_assert(size > max_data - (RHDE_SIZE - RHD_SIZE)); do { diff --git a/src/jrd/dpm.epp b/src/jrd/dpm.epp index 733d3ed49d1..f3f77ccb65d 100644 --- a/src/jrd/dpm.epp +++ b/src/jrd/dpm.epp @@ -4182,7 +4182,7 @@ static void store_big_record(thread_db* tdbb, // Fill up data pages tail first until what's left fits on a single page. auto size = dcc.getPackedLength(); - fb_assert(size > max_data); + fb_assert(size > max_data - (RHDE_SIZE - RHD_SIZE)); do { diff --git a/src/jrd/sqz.cpp b/src/jrd/sqz.cpp index 5ebcc7db49d..d21d4b66d26 100644 --- a/src/jrd/sqz.cpp +++ b/src/jrd/sqz.cpp @@ -344,16 +344,18 @@ ULONG Compressor::truncateTail(ULONG outLength) * Return the number of trailing input bytes that fit the given output length. * **************************************/ - fb_assert(m_length > outLength); + [[maybe_unused]] const bool truncateAll = m_length <= outLength; + + ULONG inLength = 0; if (m_runs.isEmpty()) { - m_length -= outLength; - return outLength; + inLength = MIN(outLength, m_length); + m_length -= inLength; + return inLength; } auto space = (int) outLength; - ULONG inLength = 0; while (m_runs.hasData()) { @@ -394,7 +396,7 @@ ULONG Compressor::truncateTail(ULONG outLength) m_runs.pop(); } - fb_assert(m_runs.hasData()); + fb_assert(truncateAll || m_runs.hasData()); if (m_allowUnpacked) { diff --git a/src/utilities/gstat/dba.epp b/src/utilities/gstat/dba.epp index 01ceaa869ec..8abd3a80dfa 100644 --- a/src/utilities/gstat/dba.epp +++ b/src/utilities/gstat/dba.epp @@ -1557,6 +1557,10 @@ static bool analyze_data_page( dba_rel* relation, const data_page* page, bool sw relation->rel_record_space -= RHDF_SIZE; relation->rel_record_space += analyze_fragments(relation, header); } + else if (header->rhdf_flags & rhd_long_tranum) + { + relation->rel_record_space -= RHDE_SIZE; + } else { relation->rel_record_space -= RHD_SIZE; @@ -1663,8 +1667,14 @@ static ULONG analyze_fragments(dba_rel* relation, const rhdf* header) if (!index->dpg_offset) break; space += index->dpg_length; - space -= RHDF_SIZE; + header = (const rhdf*) ((SCHAR *) page + index->dpg_offset); + if (header->rhdf_flags & rhd_incomplete) + space -= RHDF_SIZE; + else if (header->rhdf_flags & rhd_long_tranum) + space -= RHDE_SIZE; + else + space -= RHD_SIZE; fragments++; } @@ -1868,6 +1878,8 @@ static ULONG analyze_versions( dba_rel* relation, const rhdf* header) space -= RHDF_SIZE; space += analyze_fragments(relation, header); } + else if (header->rhdf_flags & rhd_long_tranum) + space -= RHDE_SIZE; else space -= RHD_SIZE; }