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

Procedure to invalidate directory list cache #19821

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

agrawalreetika
Copy link
Member

Test plan - (Please fill in how you tested your changes)

Please make sure your submission complies with our Development, Formatting, and Commit Message guidelines. Don't forget to follow our attribution guidelines for any code copied from other projects.

Fill in the release notes towards the bottom of the PR description.
See Release Notes Guidelines for details.

== RELEASE NOTES ==


Hive Changes
* Introduce system procedure to invalidate directory list cache in Hive Catalog

@agrawalreetika agrawalreetika requested a review from a team as a code owner June 8, 2023 06:39
@agrawalreetika agrawalreetika requested a review from presto-oss June 8, 2023 06:39
@agrawalreetika agrawalreetika self-assigned this Jun 8, 2023
@nmahadevuni
Copy link
Member

@agrawalreetika Instead of single directory, we may want to clear the whole cache too. May be make the directoryPath optional, and if its not provided, then clear all cache. Also, please change the procedure name to something more intuitive.

If there are multiple hive catalogs, how can we invalidate the cache from one particular catalog?

system.invalidate_file_list_cache(Optional<String> directoryPath)

@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch from f95b59e to cec513e Compare June 12, 2023 05:15
@agrawalreetika
Copy link
Member Author

@agrawalreetika Instead of single directory, we may want to clear the whole cache too. May be make the directoryPath optional, and if its not provided, then clear all cache. Also, please change the procedure name to something more intuitive.

If there are multiple hive catalogs, how can we invalidate the cache from one particular catalog?

system.invalidate_file_list_cache(Optional<String> directoryPath)

Hi @nmahadevuni, Thanks for your comment.
I have added the directory path as optional to allow full directory list cache invalidation.
Just like any other procedure in Presto we will have to provide catalog name while making procedure call on specific catalog. (ref - https://prestodb.io/docs/current/connector/hive.html#procedures)

@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch from cec513e to 06fb04f Compare June 14, 2023 13:29
@agrawalreetika
Copy link
Member Author

@tdcmeehan Could you please help me review this?

Copy link
Member

@imjalpreet imjalpreet left a comment

Choose a reason for hiding this comment

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

@agrawalreetika thanks for the PR, overall LGTM. A few minor nits.

@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch from 06fb04f to 05cafc7 Compare June 15, 2023 12:42
imjalpreet
imjalpreet previously approved these changes Jun 15, 2023
Copy link
Member

@imjalpreet imjalpreet left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏼

}
}

private void doInvalidateDirectoryListCache(ConnectorSession session, Optional<String> directoryPath)
Copy link
Contributor

@tdcmeehan tdcmeehan Jun 15, 2023

Choose a reason for hiding this comment

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

Can we improve the enapsulation of CachingDirectoryLister by moving this method to be inside of it? We could also write a simple unit test.

Copy link
Member Author

Choose a reason for hiding this comment

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

@tdcmeehan Since we are going to use this for the Directory list invalidation procedure, which is why I thought of keeping it here. Do you think we should move this to CachingDirectoryLister?

I have added tests.

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 in favor of keeping this inside of CachingDirectoryLister for improved encapsulation.

@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch from 05cafc7 to 9433002 Compare June 19, 2023 06:48
@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch from 9433002 to 2bf4b22 Compare July 12, 2023 06:02
assertEquals(missCount, 1);

// Invalidate directory list cache
assertQuerySucceeds("CALL hive.system.invalidate_directory_list_cache()");

Choose a reason for hiding this comment

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

would be nice to also test parametrized version.

@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch from 2bf4b22 to 0627839 Compare August 9, 2023 08:47
@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch from 0627839 to a45324d Compare December 1, 2023 12:55
Copy link

github-actions bot commented Dec 1, 2023

Codenotify: Notifying subscribers in CODENOTIFY files for diff 908327e...004ba4b.

Notify File(s)
@steveburnett presto-docs/src/main/sphinx/connector/hive.rst

steveburnett
steveburnett previously approved these changes Dec 1, 2023
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)
Local build of docs, new additions look good.

tdcmeehan
tdcmeehan previously approved these changes Jan 26, 2024
@steveburnett
Copy link
Contributor

Failing on one test (test / test (:presto-hive) (pull_request), and no option to re-run failed tests.

@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch 2 times, most recently from 180a458 to e361fad Compare February 16, 2024 13:11
@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch 2 times, most recently from 1200de1 to 21bc4e2 Compare February 22, 2024 05:00
@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch from 21bc4e2 to 0d6069a Compare February 22, 2024 18:13
@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch from 89afaf4 to dac10e2 Compare February 26, 2024 18:17
@tdcmeehan tdcmeehan self-assigned this Feb 26, 2024
@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch 3 times, most recently from 6d5a116 to 2ea3862 Compare February 27, 2024 12:03
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static java.util.Objects.requireNonNull;

public class CachingDirectoryLister
implements DirectoryLister
{
protected final DirectoryLister delegate;
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this is still protected

@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch 6 times, most recently from a6b4e7b to d2f938c Compare February 28, 2024 11:24
@agrawalreetika
Copy link
Member Author

@tdcmeehan I have been facing this issue in product-tests-basic-environment here but not finding the details around what's causing this.
Are there any more logs that get captured as part of workflow run?

@tdcmeehan
Copy link
Contributor

@agrawalreetika why do we need new product tests for this feature? Can't it run in an existing suite?

@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch 2 times, most recently from 9c55082 to 3097b5e Compare February 28, 2024 19:06
@agrawalreetika
Copy link
Member Author

@agrawalreetika why do we need new product tests for this feature? Can't it run in an existing suite?

@tdcmeehan I added tests to the existing suite, but looks like product-tests-basic-environment is having same issue here

@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch 4 times, most recently from 31d3e88 to 7afa178 Compare March 6, 2024 13:52
@agrawalreetika agrawalreetika force-pushed the list-cache-invalidation branch from 7afa178 to 004ba4b Compare March 6, 2024 14:01
@agrawalreetika
Copy link
Member Author

@tdcmeehan & @steveburnett all the tests are green, this is ready for final review.

Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pulled updated branch, new local build, docs looks good. Thanks!

@tdcmeehan tdcmeehan merged commit a4c2639 into prestodb:master Mar 6, 2024
57 checks passed
@wanglinsong wanglinsong mentioned this pull request May 1, 2024
48 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants