Search before asking
Motivation
In CachingCatalog, when multi thread calls the getTable with the same Identifier ,if them all find cache miss, they will call the wrapped.getTable(identifier) multiple times concurrently, which is very expensive. And actually, we just need to call the wrapped.getTable(identifier) once, and return the result for all calls.
Solution
Only allow the first cache-missing thread to call wrapped.getTable(identifier). Other concurrent threads requesting the same Identifier should wait for and reuse the result. This can be implemented by introducing a lock or a Future-based coordination mechanism.
Anything else?
No response
Are you willing to submit a PR?
Search before asking
Motivation
In
CachingCatalog, when multi thread calls thegetTablewith the sameIdentifier,if them all find cache miss, they will call thewrapped.getTable(identifier)multiple times concurrently, which is very expensive. And actually, we just need to call thewrapped.getTable(identifier)once, and return the result for all calls.Solution
Only allow the first cache-missing thread to call
wrapped.getTable(identifier). Other concurrent threads requesting the same Identifier should wait for and reuse the result. This can be implemented by introducing a lock or a Future-based coordination mechanism.Anything else?
No response
Are you willing to submit a PR?