Skip to content

feat: Implement Cached and Lazy Executor Service for getFileInfo - #357

Draft
suni72 wants to merge 32 commits into
GoogleCloudPlatform:mainfrom
suni72:lazy-executor-service
Draft

feat: Implement Cached and Lazy Executor Service for getFileInfo#357
suni72 wants to merge 32 commits into
GoogleCloudPlatform:mainfrom
suni72:lazy-executor-service

Conversation

@suni72

@suni72 suni72 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Type of Change

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • chore: Changes to the build process or auxiliary tools and libraries such as documentation generation

Description

What?

  • Introduced a lightweight LazyExecutorService in the client module that defers task execution until Future.get() is invoked, running tasks synchronously on the caller's thread.
  • Added a new configuration property analytics-core.list.parallel.enabled to control parallelized list behavior.
  • Refactored GcsFileSystemImpl to split its underlying thread pools into two dedicated executors: one for read operations (readExecutorServiceSupplier) and one for list operations (listExecutorServiceSupplier).
  • Updated the listExecutorServiceSupplier to dynamically select its implementation: it uses a concurrent Cached Thread Pool when parallel listing is enabled, and falls back to the newly created LazyExecutorService when parallel listing is disabled.
  • Refactored GcsClientImplTest to use centralized constants (e.g., TEST_PROJECT, TEST_OBJECT) instead of hardcoded literal strings.
  • Added comprehensive unit testing for the new LazyExecutorService and the modified executor initialization logic in GcsFileSystemImplTest.

Why?

  • ListExecutorService is used to check directory emptiness or find child folders etc. using a list call.
  • The new LazyExecutorService provides a highly efficient fallback when parallel listing is disabled.

Checklist

  • PR title follows Conventional Commits (e.g., feat(core): ...)
  • All files include the Apache License 2.0 header
  • Documentation has been updated to reflect changes

Generated/Assisted by Agent? [Yes]

suni72 and others added 21 commits July 14, 2026 11:07
…nject BucketPropertiesLoader to GcsFileSystemImpl
- rename HNS configuration key to hierarchical.namespace.enable
- Update test names for clarity
- Reverted unrelated changes in FakeGcsFileSystemImpl

Updated tests to use constants instead of hardcoded strings
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the GCS file system client by introducing specialized executor services for improved performance and resource management. It also implements a strategy-based approach to handle different namespace models (Flat vs. Hierarchical), enabling better support for modern cloud storage features and providing a more flexible architecture for future directory operations.

Highlights

  • Lazy Executor Service: Introduced a new LazyExecutorService that defers task execution until the Future.get() method is invoked, executing tasks synchronously on the caller's thread.
  • Parallel Listing Support: Added a cached executor service to support parallel directory listing operations, improving performance for large bucket structures.
  • Namespace Strategy Pattern: Implemented a NamespaceStrategy interface with Flat and Hierarchical (HNS) implementations to allow the file system to adapt to different storage namespace models.
  • Configuration Enhancements: Added new configuration options for enabling HNS API support and parallel listing capabilities within GcsFileSystemOptions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for hierarchical namespace (HNS) bucket resolution by adding a NamespaceStrategy interface with flat and hierarchical implementations, alongside a new LazyExecutorService to defer task execution. It also updates GcsFileSystemImpl to manage separate read and list executor services. Feedback on these changes highlights three key issues: a potential compilation error in GcsFileSystemImpl.resolveStrategy due to an unhandled checked IOException in a lambda expression, unnecessary thread pool initialization during close() when calling .get() on unused executor suppliers, and a violation of the standard Future.get(timeout, unit) contract in LazyFutureTask where synchronous execution ignores the specified timeout.

@suni72
suni72 force-pushed the lazy-executor-service branch from 39af3de to f57dda2 Compare August 5, 2026 14:54
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.23%. Comparing base (42476eb) to head (150aa9c).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #357      +/-   ##
============================================
+ Coverage     98.14%   98.23%   +0.09%     
- Complexity      564      597      +33     
============================================
  Files            38       41       +3     
  Lines          1779     1873      +94     
  Branches        167      180      +13     
============================================
+ Hits           1746     1840      +94     
  Misses           15       15              
  Partials         18       18              
Files with missing lines Coverage Δ
...nalyticscore/client/FlatNamespaceStrategyImpl.java 100.00% <100.00%> (ø)
.../cloud/gcs/analyticscore/client/GcsClientImpl.java 100.00% <100.00%> (ø)
...ud/gcs/analyticscore/client/GcsFileSystemImpl.java 100.00% <100.00%> (ø)
...gcs/analyticscore/client/GcsFileSystemOptions.java 100.00% <100.00%> (ø)
...core/client/HierarchicalNamespaceStrategyImpl.java 100.00% <100.00%> (ø)
.../gcs/analyticscore/client/LazyExecutorService.java 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suni72 suni72 changed the title Implement Cached and Lazy Executor Service feat: Implement Cached and Lazy Executor Service for getFileInfo Aug 5, 2026
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.

1 participant