Skip to content

Commit 8e2b38a

Browse files
committed
Reworked skipping unused & dropped entries when initializing indices for temp table in temp pagespace
1 parent abd0c27 commit 8e2b38a

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/jrd/Relation.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -376,17 +376,15 @@ RelationPages* RelationPermanent::getPagesInternal(thread_db* tdbb, TraNumber tr
376376
QualifiedName idx_name;
377377
auto* idp = this->lookupIndex(tdbb, idx.idx_id, CacheFlag::AUTOCREATE);
378378
if (idp)
379-
{
380379
idx_name = idp->getName();
381380

382-
switch (idp->getState())
383-
{
384-
case Ods::irt_drop:
385-
case Ods::irt_unused:
386-
continue;
387-
default:
388-
break;
389-
}
381+
switch (idx.idx_state)
382+
{
383+
case Ods::irt_drop:
384+
case Ods::irt_unused:
385+
continue;
386+
default:
387+
break;
390388
}
391389

392390
idx.idx_root = 0;

src/jrd/Relation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ class IndexPermanent : public Firebird::PermanentStorage
496496
RelationPermanent* idp_relation;
497497
MetaId idp_id;
498498
TraNumber idp_tranum = 0;
499-
UCHAR idp_state = 0;
499+
UCHAR idp_state = 0; // Makes sense only for expression/conditional indices
500500
UCHAR idp_formatNumber = 0;
501501

502502
[[noreturn]] void errIndexGone();

src/jrd/btr.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,7 @@ bool BTR_description(thread_db* tdbb, Cached::Relation* relation, const index_ro
13921392
idx->idx_condition_node = nullptr;
13931393
idx->idx_condition_statement = nullptr;
13941394
idx->idx_fraction = 1.0;
1395+
idx->idx_state = irt_desc->getState();
13951396

13961397
// pick up field ids and type descriptions for each of the fields
13971398
const UCHAR* ptr = (UCHAR*) root + irt_desc->irt_desc;

src/jrd/btr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ struct index_desc
100100
Statement* idx_expression_statement; // stored statement for expression evaluation
101101
BoolExprNode* idx_condition_node; // node tree for index condition
102102
Statement* idx_condition_statement; // stored statement for index condition
103-
float idx_fraction; // fraction of keys included in the index
103+
float idx_fraction; // fraction of keys included in the index
104+
UCHAR idx_state; // state from irt_rpt
104105
// This structure should exactly match IRTD structure for current ODS
105106
struct idx_repeat
106107
{

0 commit comments

Comments
 (0)