Skip to content

Conversation

@jeqo
Copy link
Contributor

@jeqo jeqo commented Dec 23, 2025

Refactor fetch planning by changing how fetch operations are scheduled on the data executor. It only assigns the data executor for remote fetch operations and let the calling thread to run the cache.get(), avoiding the scenario where calls to cache are blocked by all data executor threads being used.

By doing this, the CacheFetchJob component got irrelevant as most of the logic is already on the planning, even the scheduling.

Changes:

  • Delete CacheFetchJob
  • Extend ObjectCache to allow passing the executor to run the load function
  • Refactor the FetchPlanner to use the new approach
  • Update documentation on FetchPlanner and Reader to clarify how stages are ran
  • Move CacheFetchJobTest to FetchPlannerTest to keep and improve coverage

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the fetch planning architecture to optimize thread pool usage by executing only remote fetches on the data executor, while cache lookups run on the calling thread. The key changes eliminate the CacheFetchJob component and extend the ObjectCache interface to accept an executor parameter for async operations.

Key Changes:

  • Deleted CacheFetchJob and moved its logic into FetchPlanner, which now directly interacts with the cache and schedules remote fetches
  • Modified ObjectCache API to return CompletableFuture and accept an executor parameter for controlling where load operations run
  • Migrated tests from CacheFetchJobTest to FetchPlannerTest with expanded coverage for cache hit/miss scenarios

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
FetchPlannerTest.java Migrated and expanded tests from CacheFetchJobTest, adding comprehensive tests for concurrent requests, cache hits/misses, and failure scenarios
CacheFetchJobTest.java Deleted - tests migrated to FetchPlannerTest
NullCache.java Updated to implement new async computeIfAbsent API that returns CompletableFuture and accepts executor parameter
Reader.java Added clarifying comments about execution stages and which thread pools handle different operations
FetchPlanner.java Major refactor: removed CacheFetchJob dependency, integrated cache operations directly, added ObjectFetchRequest and MergedBatchRequest records for internal planning
CacheFetchJob.java Deleted - functionality merged into FetchPlanner
ObjectCache.java Changed computeIfAbsent signature to return CompletableFuture and accept an Executor parameter for controlling async load execution
MemoryCache.java Deleted - test-only implementation no longer needed
CaffeineCache.java Updated to implement new async computeIfAbsent API using Caffeine's async cache with custom executor

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jeqo jeqo force-pushed the jeqo/only-fetch-on-work-thread branch from 6f06aff to d4c4bc4 Compare December 23, 2025 11:07
@jeqo jeqo requested a review from Copilot December 23, 2025 11:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jeqo jeqo force-pushed the jeqo/only-fetch-on-work-thread branch 2 times, most recently from c64c4aa to 31b9aa9 Compare December 23, 2025 13:48
@jeqo jeqo requested a review from Copilot December 23, 2025 13:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jeqo added 2 commits December 23, 2025 17:16
Refactor fetch planning by changing how fetch operations are scheduled
on the data executor. It only assigns the data executor for remote fetch
operations and let the calling thread to run the cache.get(), avoiding
the scenario where calls to cache are blocked by all data executor
threads being used.

By doing this, the CacheFetchJob component becomes irrelevant as most of
the logic is already on the planning, even the scheduling decision.

Changes:
- Delete CacheFetchJob
- Extend ObjectCache to allow passing the executor to run the load
function
- Refactor the FetchPlanner to use the new approach
- Update documentation on FetchPlanner and Reader to clarify how stages
are ran
- Move CacheFetchJobTest to FetchPlannerTest to keep and improve
coverage
@jeqo jeqo force-pushed the jeqo/only-fetch-on-work-thread branch from 31b9aa9 to f6be2a5 Compare December 23, 2025 15:16
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.

2 participants