-
-
Notifications
You must be signed in to change notification settings - Fork 268
Package Constant: Check missing dsc_address instead of dsc_dtype and restore impure after using existing request #9065
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
Open
Noremos
wants to merge
1
commit into
FirebirdSQL:master
Choose a base branch
from
Noremos:package_invalid_dsc_address_and_impure_usage
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+25
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -172,12 +172,12 @@ dsc* ConstantValue::makeValue(thread_db* tdbb, Request* request) | |
| { | ||
| { | ||
| ReadLockGuard guard(m_makeValueLock, FB_FUNCTION); | ||
| if (m_value.vlu_desc.dsc_dtype != dtype_unknown) | ||
| if (m_value.vlu_desc.dsc_address != nullptr) | ||
| return &m_value.vlu_desc; | ||
| } | ||
|
|
||
| WriteLockGuard guard(m_makeValueLock, FB_FUNCTION); | ||
| if (m_value.vlu_desc.dsc_dtype != dtype_unknown) // Extra check in case of two callers waiting | ||
| if (m_value.vlu_desc.dsc_address != nullptr) // Extra check in case of two callers waiting | ||
| return &m_value.vlu_desc; | ||
|
|
||
| Attachment* attachment = tdbb->getAttachment(); | ||
|
|
@@ -196,6 +196,8 @@ dsc* ConstantValue::makeValue(thread_db* tdbb, Request* request) | |
|
|
||
| MET_parse_blob(tdbb, &name.schema, nullptr, &constantBid, &csb, nullptr, false, false); | ||
| fb_assert(csb->csb_node != nullptr); | ||
| csb->csb_node->pass1(tdbb, csb); | ||
| csb->csb_node->pass2(tdbb, csb); | ||
|
|
||
| if (request == nullptr) | ||
| { | ||
|
|
@@ -216,7 +218,27 @@ dsc* ConstantValue::makeValue(thread_db* tdbb, Request* request) | |
| executeCsbNode(tdbb, csb); | ||
| } | ||
| else | ||
| { | ||
| // A csb->csb_node will use impureArea from the incoming request | ||
| // but it contains other data | ||
| // Backup the current data and restore it later | ||
|
|
||
| // Reusing a small chunk is faster instead of makeing a new request | ||
| // And using existing space for a temporally value is better instead of adding this to request->impureArea | ||
| // and carrying it for whole request live | ||
|
|
||
| const auto nodeImpureSize = csb->csb_impure; | ||
| if (request->impureArea.getCount() < nodeImpureSize) | ||
| request->impureArea.grow(nodeImpureSize - request->impureArea.getCount()); | ||
|
|
||
| const Array<UCHAR> backup(request->impureArea.begin(), nodeImpureSize); | ||
|
|
||
| fb_assert(tdbb->getRequest() == request); | ||
| executeCsbNode(tdbb, csb); | ||
|
|
||
| // Restore | ||
| memcpy(request->impureArea.begin(), backup.begin(), nodeImpureSize); | ||
| } | ||
|
Comment on lines
+221
to
+241
Member
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. This whole thing is looking as a complete hack for me.
Contributor
Author
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. Got it. I just wanted to save time. I'll do it the right way |
||
| } | ||
| catch (const Exception& ex) | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 is this function called with null request and when is it called with not null request?
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.
With request: when executing ReferenceNode.
Without request: when зукащьтштп a packet scan (without minican) in metacache.
I will add a comment to clearify it
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.
BTW - why not save descriptor for getDesc() in a cache? I.e. move almost all code from getDesc() to scan().