Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/jrd/BulkInsert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/dpm.epp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment thread
hvlad marked this conversation as resolved.
Resolved
fb_assert(size > max_data - (RHDE_SIZE - RHD_SIZE));

do
{
Expand Down
12 changes: 7 additions & 5 deletions src/jrd/sqz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be it is better to fix caller (store_big_record()) and not break compressor assumptions ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that we are breaking compressor assumption. As I see, it's fine that we can have head with no data, so at least outLength can be equal to m_length. But, anyway, I think it's fine that outLength can also be bigger then m_length because outLength is more like a buffer size, and return value will contain actual length anyway, so I see no restriction why we should limit outLength value to m_length (except branch if (m_runs.isEmpty()) at the beginning will break if outLength is bigger then m_length, but I can fix that).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dyemanov, what do you think ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree that nothing is going to be broken.


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())
{
Expand Down Expand Up @@ -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)
{
Expand Down
14 changes: 13 additions & 1 deletion src/utilities/gstat/dba.epp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Comment thread
dyemanov marked this conversation as resolved.
Resolved

fragments++;
}
Expand Down Expand Up @@ -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;
}
Expand Down
Loading