-
Notifications
You must be signed in to change notification settings - Fork 819
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
Update CachedQuery.java #948
Open
LittleWuCoding
wants to merge
1
commit into
pgjdbc:master
Choose a base branch
from
LittleWuCoding:master
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
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.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
Could you please explain:
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.
line 42 is actually "save result if no overflow"
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.
So what? Is it good enough?
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.
@vlsi OK, for your question 1 : sorry , I forgot to delete the comment on line 42. Just like @panchenko says, line 42 ~44 only handled the situation of no overflows. For overflows, just thinks about a situation query q1's executeCount is Max_value -3 ,query q2's executeCount is Max_value -2 ,they are both in the cache pool, now q2 increased by 3 or larger and q1 is increase by 2, now the newValue of q2 was turn to be negative number ,so q2's executeCount was unchanged ,but q1's executeCount is Max_value,which is larger than q2's executeCount . That means q1 has Higher opportunities rsesides in Cache. But actually, q2's execution times is more than q1's. This is just a extreme examples, but is shows there must be some problems.
And my patch can ensure that if q2's execution times is more than q1‘s, then q2's ’executeCount will be larger or at least equal to q1's.
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.
A)
executeCount
is never used for cache eviction policy.B)
executeCount
is used only forexecuteCount > prepareThreshold
check. In that regard things aroundMAX_VALUE
do not make any differenceC) If there are queries with
MAX_VALUE-2
, then they all should better be kept in the cache, so it does not matter if a query has "execute countMAX_VALUE-2
vsMAX_VALUE-3
"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.
@vlsi OK, I missunderstand the code, but what if a query‘s’ initial value is a very small integer(less than prepareThreshold) , but the parameter inc of function increaseExecuteCount(int inc) is a big one ,their sum is overflows, in that way, this query's executeCount unchanged, With a high execution times ,this query may not be prepared, is it a problem?
Anyway, I am happy to discuss it with you~