davidzollo opened a new issue, #10537:
URL: https://github.com/apache/seatunnel/issues/10537

   Sub-issue of #10533
   
   ## Scope
   
   `MultiTableSinkWriter` is the most complex undocumented class in the 
multi-table framework: 373 lines, heavy concurrency, zero method-level Javadoc. 
It manages per-table async write queues and resource sharing.
   
   ## File
   
   
`seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java`
   
   ## Methods to document
   
   | Method | Line | What to explain |
   |--------|------|-----------------|
   | Constructor | 64 | `queueSize * 2` thread pool reason (write threads + 
prepareCommit tasks); BlockingQueue-to-writer assignment; modulo distribution 
formula `entry.getKey().getIndex() % queueSize` |
   | `initResourceManager(int)` | 112 | One-shot init from first writer; 
broadcasts shared resource to all writers via `setMultiTableResourceManager`; 
primary key map population |
   | `subSinkErrorCheck()` | 134 | Propagates exceptions from async writer 
threads back to the caller thread; called before every state-mutating operation 
|
   | `write(SeaTunnelRow)` | 179 | Role of `submitted` flag (lazy executor 
start); primary-key hashing for ordered delivery (`hashCode % queueSize`); 
random queue for no-primary-key tables |
   | `prepareCommit(long)` | 246 | Parallel per-table `prepareCommit` inside 
executor service; `Future` aggregation into `MultiTableCommitInfo` |
   | `snapshotState(long)` | 222 | Synchronizes with runnable 
(`synchronized(runnable.get(i))`) to prevent concurrent mutation during 
snapshot |
   | `abortPrepare()` | 294 | First-exception-wins error aggregation across 
sub-writers |
   | `close()` | 322 | `executorService.shutdownNow()` then per-writer 
`close()` under runnable lock; resource manager teardown |
   | `checkQueueRemain()` | 361 | Busy-waits until all BlockingQueues drain 
before snapshot/commit; polls every 100 ms; must complete before lock-protected 
state operations |
   
   ## How to contribute
   
   1. Fork the repo and create a branch
   2. Add Javadoc to the methods above
   3. Run `./mvnw spotless:apply` and `./mvnw -q -DskipTests verify`
   4. Open a PR with title: `[Docs][Core] Add Javadoc to MultiTableSinkWriter`


-- 
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