From 14eac8b76bb4d2fb339e5387dd86927961e77d46 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Fri, 3 Nov 2017 14:59:59 +0000 Subject: [PATCH] Backport #5913 - Increase number of formats/versions of views from 255 to 32K (CORE-5647). --- src/jrd/constants.h | 2 -- src/jrd/dfw.epp | 12 ++++++++++-- src/jrd/ods.h | 6 ++++++ src/misc/ods.awk | 1 + 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/jrd/constants.h b/src/jrd/constants.h index 9d5555e948..31fa728f0b 100644 --- a/src/jrd/constants.h +++ b/src/jrd/constants.h @@ -207,8 +207,6 @@ const size_t MAX_ARRAY_DIMENSIONS = 16; const size_t MAX_SORT_ITEMS = 255; // ORDER BY f1,...,f255 -const int MAX_TABLE_VERSIONS = 255; // maybe this should be in ods.h. - const size_t MAX_DB_PER_TRANS = 256; // A multi-db txn can span up to 256 dbs // relation types diff --git a/src/jrd/dfw.epp b/src/jrd/dfw.epp index 9372e9079f..fd1997604e 100644 --- a/src/jrd/dfw.epp +++ b/src/jrd/dfw.epp @@ -5674,8 +5674,16 @@ static bool make_version(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_ null_view = blob_id.isEmpty(); external_flag = REL.RDB$EXTERNAL_FILE[0]; - if (REL.RDB$FORMAT == MAX_TABLE_VERSIONS) - raiseTooManyVersionsError(obj_relation, work->dfw_name); + if (REL.RDB$VIEW_BLR.NULL) + { + if (REL.RDB$FORMAT == MAX_TABLE_VERSIONS) + raiseTooManyVersionsError(obj_relation, work->dfw_name); + } + else + { + if (REL.RDB$FORMAT == MAX_VIEW_VERSIONS) + raiseTooManyVersionsError(obj_view, work->dfw_name); + } MODIFY REL USING blb* blob = blb::create(tdbb, transaction, &REL.RDB$RUNTIME); diff --git a/src/jrd/ods.h b/src/jrd/ods.h index 60aa15593e..5ba4c5b740 100644 --- a/src/jrd/ods.h +++ b/src/jrd/ods.h @@ -721,4 +721,10 @@ const USHORT PAGE_ALIGNMENT = 1024; // size of raw I/O operation for header page const USHORT RAW_HEADER_SIZE = 1024; // ROUNDUP(HDR_SIZE, PAGE_ALIGNMENT); +// max number of table formats (aka versions), limited by "UCHAR rhd_format" +const int MAX_TABLE_VERSIONS = 255; + +// max number of view formats (aka versions), limited by "SSHORT RDB$FORMAT" +const int MAX_VIEW_VERSIONS = MAX_SSHORT; + #endif // JRD_ODS_H diff --git a/src/misc/ods.awk b/src/misc/ods.awk index 53b6bb6451..c367a6ec98 100644 --- a/src/misc/ods.awk +++ b/src/misc/ods.awk @@ -46,6 +46,7 @@ BEGIN { print "" print "#include \"fb_types.h\"" print "#define ODS_TESTING" + print "#include \"../common/common.h\"" print "#include \"../jrd/ods.h\"" print "" print "using namespace Ods;"