DaisyModi opened a new pull request, #4175:
URL: https://github.com/apache/gobblin/pull/4175

   Dear Gobblin maintainers,
   
   Please accept this PR. I understand that it will not be reviewed until I 
have checked off all the steps below!
   
   
   ### JIRA
   - [ ] My PR addresses the following [Gobblin 
JIRA](https://issues.apache.org/jira/browse/GOBBLIN/) issues and references 
them in the PR title.
   
   
   ### Description
   - [x] Here are some details about my PR:
   
   Every flow gets compiled twice — once on submission and once on execution. 
The execution path already runs on a thread pool of size 3 
(`DagProcessingEngine`), proving that `compileFlow()` is thread-safe. However, 
the submission path was fully serialized by:
   1. A `synchronized` block on `SpecCatalogListenersList.onAddSpec()`
   2. A single-thread executor inside `CallbacksDispatcher`
   
   This caused unnecessary queuing when multiple flows were submitted 
simultaneously.
   
   **Changes:**
   - Removed `synchronized` from `SpecCatalogListenersList.onAddSpec()` to 
allow concurrent flow compilations
   - Added a new constructor to `SpecCatalogListenersList` that accepts an 
`ExecutorService`
   - Updated `FlowCatalog` to create a configurable `FixedThreadPool` (default: 
3 threads) via `gobblin.service.specCatalogListener.numThreads`
   
   **Safety:**
   - `onDeleteSpec`/`onUpdateSpec` remain `synchronized` (topology changes are 
infrequent)
   - `addListener`/`removeListener` remain `synchronized`
   - `topologySpecMap` is a `ConcurrentMap` — safe for concurrent reads
   - The execution path (`DagProcessingEngine` with 3 threads) already 
validates `compileFlow()` thread-safety
   
   
   ### Tests
   - [ ] My PR does not need new testing because it only removes serialization 
that was already proven unnecessary by the execution path 
(`DagProcessingEngine`) which runs `compileFlow()` from 3 concurrent threads. 
Existing `FlowCatalogTest` and `MultiHopFlowCompilerTest` cover the compilation 
flow.
   
   
   ### Commits
   - [x] My commits follow the guidelines from "How to write a good git commit 
message":
       1. Subject is separated from body by a blank line
       2. Subject is limited to 50 characters
       3. Subject does not end with a period
       4. Subject uses the imperative mood ("add", not "adding")
       5. Body wraps at 72 characters
       6. Body explains "what" and "why", not "how"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to