From e20c3096f6b5b61967664c49fbbc70c365ae8ac1 Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Thu, 6 Oct 2022 21:10:29 +0300 Subject: [PATCH 1/3] Raised the record size limit --- src/jrd/val.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jrd/val.h b/src/jrd/val.h index e44b17a1407..ee85ffd108c 100644 --- a/src/jrd/val.h +++ b/src/jrd/val.h @@ -49,7 +49,7 @@ class VaryingString : public pool_alloc_rpt UCHAR str_data[2]; // one byte for ALLOC and one for the NULL }; -const ULONG MAX_RECORD_SIZE = 65535; +const ULONG MAX_RECORD_SIZE = 1000000; // just to protect from misuse namespace Jrd { From f8a6c977b705334c8303a11618d6c97d49e46b3b Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Sat, 4 Oct 2025 12:22:46 +0300 Subject: [PATCH 2/3] Represent the limit as 2^20 --- src/jrd/val.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jrd/val.h b/src/jrd/val.h index ee85ffd108c..b9108fbf607 100644 --- a/src/jrd/val.h +++ b/src/jrd/val.h @@ -49,7 +49,7 @@ class VaryingString : public pool_alloc_rpt UCHAR str_data[2]; // one byte for ALLOC and one for the NULL }; -const ULONG MAX_RECORD_SIZE = 1000000; // just to protect from misuse +const ULONG MAX_RECORD_SIZE = 1048576; // 1 MB -- just to protect from possible misuse namespace Jrd { From 8d06dd94afeb88838f258a116bf3a37e1a0f35dd Mon Sep 17 00:00:00 2001 From: Dmitry Yemanov Date: Sat, 4 Oct 2025 12:30:30 +0300 Subject: [PATCH 3/3] Protect against extremely high InlineSortThreshold settings --- src/jrd/optimizer/Optimizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jrd/optimizer/Optimizer.cpp b/src/jrd/optimizer/Optimizer.cpp index 9ad3cd5d5cd..1ad462ca5a5 100644 --- a/src/jrd/optimizer/Optimizer.cpp +++ b/src/jrd/optimizer/Optimizer.cpp @@ -1248,7 +1248,7 @@ SortedStream* Optimizer::generateSort(const StreamList& streams, const auto dbb = tdbb->getDatabase(); const auto threshold = dbb->dbb_config->getInlineSortThreshold(); - refetchFlag = (totalLength > threshold); + refetchFlag = (totalLength > MIN(threshold, MAX_SORT_RECORD / 2)); } // Check for persistent fields to be excluded from the sort.