Skip to content
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

[FLINK-24861][connector][jdbc] Fix false cache lookup for empty data #17754

Merged
merged 1 commit into from
Nov 24, 2021
Merged

[FLINK-24861][connector][jdbc] Fix false cache lookup for empty data #17754

merged 1 commit into from
Nov 24, 2021

Conversation

gaurav726
Copy link
Contributor

@gaurav726 gaurav726 commented Nov 10, 2021

What is the purpose of the change

Ideally, in case of cache miss for a key, or with null value fetch for key, key shouldn't be cached, however empty result query should also be in the scope, so including an extra optional parameter to configure same

Brief change log

empty check on row list will make sure for database read for empty data for the key

Verifying this change

This change is a trivial check / code fix without any test coverage.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no/ don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

flinkbot commented Nov 10, 2021

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 29cfbf7 (Wed Nov 10 13:53:00 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@hililiwei
Copy link
Contributor

look good

@gaurav726 gaurav726 closed this Nov 12, 2021
@gaurav726 gaurav726 reopened this Nov 12, 2021
@gaurav726 gaurav726 closed this Nov 12, 2021
@gaurav726 gaurav726 reopened this Nov 12, 2021
Copy link
Contributor

@wenlong88 wenlong88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaurav726 thanks for the contribution, I left some comments

@@ -174,6 +175,7 @@ public void testJdbcLookupProperties() {
.setCacheMaxSize(1000)
.setCacheExpireMs(10_000)
.setMaxRetryTimes(10)
.setExcludeEmptyQueryResult(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to a new case instead of override the default value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean new test case,right?, I have added another one,

for (RowData cachedRow : cachedRows) {
collect(cachedRow);
if (!cachedRows.isEmpty() || !excludeEmptyQueryResult) {
for (RowData cachedRow : cachedRows) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am afraid that you should not just ignore the empty values, instead you should remove the keyRow from the cache if exlucdeEmptyQueryResult is true, and collect is still needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @wenlong88 , changes has been done, please review

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @wenlong88 , pipeline got succeed, can you please review and merge

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi, you need to add a test cover the cache changes, refer to JdbcRowDataLookupFunctionTest#testEval, on the other hands, I think it is more clearer if you do not put empty to cache in eval instead of put to cache and then invalidate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, got it, making changes

Copy link
Contributor Author

@gaurav726 gaurav726 Nov 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wenlong88 can we resolve conversations now? Also will @wuchong get it merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wenlong88 anything else is remaining in this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaurav726 the pr looks good for me now, but you still need to wait for Committers to join the review.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, thanks for the update @wenlong88

Copy link
Contributor Author

@gaurav726 gaurav726 Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wuchong can you please review my PR.
cc @wenlong88

@wenlong88
Copy link
Contributor

LGTM for now, cc @wuchong

@wuchong
Copy link
Member

wuchong commented Nov 23, 2021

Thanks @gaurav726 for the great work. The implementation looks good to me. However, I have some concerns about the option key. From my point of view, this issue wants to disable caching missing key (same problem with FLINK-21415). Therefore, this option key would be better to belong to lookup.cache.xx. How about naming it lookup.cache.caching-missing-key=true which looks more intuitive?

@gaurav726
Copy link
Contributor Author

Hi @wuchong , thanks for reviewing my PR, making changes

@gaurav726
Copy link
Contributor Author

Hi @wuchong , changes has been done, please review, pipeline is running, will update once success

@gaurav726
Copy link
Contributor Author

Hi @wuchong, pipeline got succeed, please review and merge

Copy link
Member

@wuchong wuchong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@wuchong wuchong merged commit f8fdb67 into apache:master Nov 24, 2021
niklassemmler pushed a commit to niklassemmler/flink that referenced this pull request Feb 3, 2022
zhongqishang pushed a commit to zhongqishang/flink that referenced this pull request Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants