-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase index flags capacity in ODS14 #8340
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1956,7 +1956,7 @@ void Validation::walk_generators() | |
} | ||
} | ||
|
||
Validation::RTN Validation::walk_index(jrd_rel* relation, index_root_page& root_page, USHORT id) | ||
Validation::RTN Validation::walk_index(jrd_rel* relation, index_root_page* root_page, USHORT id) | ||
{ | ||
/************************************** | ||
* | ||
|
@@ -1976,25 +1976,26 @@ Validation::RTN Validation::walk_index(jrd_rel* relation, index_root_page& root_ | |
**************************************/ | ||
Database* dbb = vdr_tdbb->getDatabase(); | ||
|
||
const ULONG page_number = root_page.irt_rpt[id].getRoot(); | ||
if (!page_number) { | ||
if (root_page->irt_rpt[id].isEmpty()) | ||
return rtn_ok; | ||
} | ||
|
||
const bool unique = (root_page.irt_rpt[id].irt_flags & (irt_unique | idx_primary)); | ||
const bool descending = (root_page.irt_rpt[id].irt_flags & irt_descending); | ||
const bool condition = (root_page.irt_rpt[id].irt_flags & irt_condition); | ||
const ULONG page_number = root_page->irt_rpt[id].irt_root; | ||
fb_assert(page_number); | ||
|
||
const bool unique = (root_page->irt_rpt[id].irt_flags & (irt_unique | idx_primary)); | ||
const bool descending = (root_page->irt_rpt[id].irt_flags & irt_descending); | ||
const bool condition = (root_page->irt_rpt[id].irt_flags & irt_condition); | ||
|
||
temporary_key nullKey, *null_key = 0; | ||
temporary_key nullKey, *null_key = nullptr; | ||
if (unique) | ||
{ | ||
index_desc idx; | ||
{ | ||
// No need to evaluate index expression and/or condition | ||
AutoSetRestoreFlag<UCHAR> flags(&root_page.irt_rpt[id].irt_flags, | ||
AutoSetRestoreFlag<USHORT> flags(&root_page->irt_rpt[id].irt_flags, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it necessary to specify template arg, could it be auto deducted from ctor arguments by compiler ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's C++17 feature (https://en.cppreference.com/w/cpp/language/class_template_argument_deduction) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've found at least one such usage of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Auto deduction works for Nevertheless, I'd suggest (outside this PR) to remove |
||
irt_expression | irt_condition, false); | ||
|
||
BTR_description(vdr_tdbb, relation, &root_page, &idx, id); | ||
BTR_description(vdr_tdbb, relation, root_page, &idx, id); | ||
} | ||
|
||
null_key = &nullKey; | ||
|
@@ -3216,7 +3217,7 @@ Validation::RTN Validation::walk_root(jrd_rel* relation, bool getInfo) | |
|
||
for (USHORT i = 0; i < page->irt_count; i++) | ||
{ | ||
if (page->irt_rpt[i].getRoot() == 0) | ||
if (page->irt_rpt[i].isEmpty()) | ||
continue; | ||
|
||
MetaName index; | ||
|
@@ -3242,7 +3243,7 @@ Validation::RTN Validation::walk_root(jrd_rel* relation, bool getInfo) | |
if (page->irt_rpt[i].irt_flags & irt_condition) | ||
{ | ||
// No need to evaluate index expression | ||
AutoSetRestoreFlag<UCHAR> flag(&page->irt_rpt[i].irt_flags, irt_expression, false); | ||
AutoSetRestoreFlag<USHORT> flag(&page->irt_rpt[i].irt_flags, irt_expression, false); | ||
|
||
IdxInfo info; | ||
if (BTR_description(vdr_tdbb, relation, page, &info.m_desc, i)) | ||
|
@@ -3252,7 +3253,7 @@ Validation::RTN Validation::walk_root(jrd_rel* relation, bool getInfo) | |
} | ||
|
||
output("Index %d (%s)\n", i + 1, index.c_str()); | ||
walk_index(relation, *page, i); | ||
walk_index(relation, page, i); | ||
} | ||
|
||
release_page(&window); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it was private there was guarantee of consistent usage of
irt_root
,irt_transaction
and flagirt_in_progress
.Why make it public and open way for errors ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, private data members (and getters/setters) just look unnatural (to me) in ODS structures, IMHO they complicate things. That said, I agree about usage consistency. Now it's also consistent if you check for
isEmpty() / inProgress()
before usingirt_root / irt_transaction
and I thought that's enough. I can revert to private members if your disagree.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, it is good case when consistency is over complexity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Vlad - private members look better to me, specially in a cases when setter may change a few data members in sync and result of getter sometimes depends from more than single field.
Probably with wider than before IRT less such tricks are needed - but for example setting some state in flags that requires root page to be set together with assigning root page value still remains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, to be changed back.