Rangsh commented on PR #12081: URL: https://github.com/apache/seatunnel/pull/12081#issuecomment-7189890556
Hi @SEZ9 — thanks for the follow-up. Your client truncated my earlier table after **row 4**, so this comment reposts the **full 1–8 mapping**, restates **row 4** end-to-end, and answers your **three points** directly. **HEAD / scope:** Production behavior for your checklist is on **`7c9e0f192c`**. **`c0a6c38b1d`** is test-only (Daniel Issues 1/2 acceptance); it does not change production for points 1–8 unless your pass finds a gap. **CI:** Latest fork Build on **`c0a6c38b1d`**: https://github.com/Rangsh/seatunnel/actions/runs/45533084279 (**success**). Earlier green Build on **`7c9e0f192c`**: https://github.com/Rangsh/seatunnel/actions/runs/45302550317 (**success**). *Note:* Daniel’s “Issue 1/2/6/7” in his reviews are **test-acceptance** items, not the same numbering as your points 1–8. --- ### Full table (your points 1–8) | Your # | Status | Where to verify | |--------|--------|-----------------| | 1 | Bounded by design (caller-side) | `RequestFuture` (`get()`, `get(long, TimeUnit)`); `IMapFileStorage` — `operationDeadlineNanos()`, `queryExecuteStatusBeforeDeadline`, timed `get(remainingNanos, …)` on all wait paths | | 2 | Consumer survives failures (tested) | `WALWorkHandler#executeResponse`; `WALWorkHandlerSurvivabilityTest` | | 3 | Intentional `Future` contract; callers adjusted | `RequestFuture`; `IMapFileStorage` (production uses timed `get` only); `RequestFutureTest` | | 4 | Fail-close by design | `WALWorkHandler` — `appendBlockedAfterWriteFailure`, APPEND path in `walEvent(...)`; `WALDisruptor#isAppendBlockedAfterWriteFailure()`; `IMapFileStorage#isAppendPermanentlyBlocked()` (`IMapStorage` API, e.g. `FileMapStore`); `WALWorkHandlerSurvivabilityTest`, `DefaultReaderTornMidFileRecordTest`, `DefaultReaderTornTrailingRecordTest` | | 5 | Mockito via parent POM; flush test on branch | Root `pom.xml` (`mockito-junit-jupiter` / `mockito-inline`; not in `imap-storage-file/pom.xml`); `HdfsWriterFlushCallCountTest` — review name `HdfsWriterFlushSyncPathTest` is **not** a class on this branch | | 6 | One shared batch deadline (production) | `IMapFileStorage#batchQueryExecuteFailsStatus`, `storeAll` / `deleteAll`; `IMapFileStorageBatchDeadlineTest` | | 7 | Documented on timed `get` | `RequestFuture#get(long, TimeUnit)` Javadoc | | 8 | Timeout logging (intentional policy) | `IMapFileStorage#queryExecuteStatusBeforeDeadline`, `#batchQueryExecuteFailsStatus` | --- ### Row 4 — fail-close (explicit) We do **not** “reuse” the WAL writer as healthy after a write failure. The same `WALWriter` handle may stay open, but **`appendBlockedAfterWriteFailure` is sticky for the process lifetime**: further APPEND events do **not** write more bytes (`done(false)` / early return in `walEvent`). There is **no** in-process reopen/truncate of `wal.txt` on that path (mid-file tear risk). Recovery is **process restart**, not clearing the flag in-process. --- ### Details (your numbering) **1. Unbounded wait / `Error` / never dispatched** Production `IMapFileStorage` waits only via **`requestFuture.get(remainingNanos, TimeUnit.NANOSECONDS)`** under one budget from **`operationDeadlineNanos()`** (single-key and batch paths). If the WAL worker dies with an **`Error`**, or a response is never dispatched, the caller still **returns within that budget** as **`TimeoutException`**, then **removes the entry from `RequestFutureCache` in the `finally` block** — not an unbounded hang. Required no-arg **`RequestFuture#get()`** delegates to **`get(untimedGetTimeoutMillis, TimeUnit.MILLISECONDS)`** and wraps expiry in **`ExecutionException`** with **`TimeoutException`** cause. Cap field: **`untimedGetTimeoutMillis`** (constructor argument; typically aligned with the write timeout). **No production call sites** use no-arg `get()` on `RequestFuture` in `imap-storage-file`. We do **not** catch **`Error`** on the WAL worker write path (intentional). **2. `executeResponse()` / worker vs timeout + eviction** Private **`WALWorkHandler#executeResponse(long, boolean)`** is wrapped in **`try/catch (Exception)`**: missing/evicted future → **WARN** and return; `future.done(...)` throwing → **ERROR** logged, **not** rethrown from `onEvent`, so the sole disruptor consumer keeps processing. Covered by **`WALWorkHandlerSurvivabilityTest`** (see your point 2 below). **3. `get()` semantics / contract change** - Timed **`get(long, TimeUnit)`** throws **`TimeoutException`** on expiry (not `false`). - No-arg **`get()`** is capped via **`untimedGetTimeoutMillis`** (not unbounded). - **Caller:** timeout → treat as failure for that key (`IMapFileStorage` catches **`TimeoutException`**, removes the cache entry, returns `false` / batch failure set). - **WAL:** timing out does **not** invoke **`Future#cancel`** or stop the disruptor thread; an in-flight append may still complete on the worker (including fail-close if the write path fails). Tests: **`RequestFutureTest`**, **`WALWorkHandlerSurvivabilityTest`**. **4.** Same as **Row 4** above. **5. Mockito / flush coverage** Flush/sync on this branch: **`HdfsWriterFlushCallCountTest`** (Mockito on `FSDataOutputStream`). Mockito test deps come from the **root `pom.xml`**; **`imap-storage-file/pom.xml` does not redeclare Mockito**. Dependency tree appendix: https://github.com/apache/seatunnel/pull/12081#issuecomment-7118546746 (Appendix A). **6. Batch sequential wait / shared deadline** `storeAll` / `deleteAll` share one **`deadlineNanos`** from **`operationDeadlineNanos()`** for ring admission and **`batchQueryExecuteFailsStatus`**. Each entry uses **`get(remainingNanos, …)`**, **not** N independent full waits. Timeout budget **Java field**: **`writDataTimeoutMilliseconds`** (historical identifier in `IMapFileStorage` source — not a comment typo). **Configuration property key**: **`writeDataTimeoutMilliseconds`** (`WRITE_DATA_TIMEOUT_MILLISECONDS_KEY` in `FileConstants`). **`IMapFileStorageBatchDeadlineTest`** exercises public entry points with injected `nanoTime`. **7. Method-level Javadoc** **`RequestFuture#get(long, TimeUnit)`** documents **`TimeoutException`** and that expiry means the **caller** stops waiting and should treat the key as failed — timing out does **not** call **`cancel`** or unilaterally stop the in-flight disruptor work. No-arg **`get()`** documented at class/override level (`Future` API requirement). **8. Timeout logging** **By design:** expected client-side timeouts **no longer log a full ERROR stack on every timed-out wait** (noisy for large `storeAll` / `deleteAll`). On **`TimeoutException`**: **WARN** one-liner + stack at **DEBUG** only in **`queryExecuteStatusBeforeDeadline`** and **`batchQueryExecuteFailsStatus`** (batch path comment: avoid ERROR per key). **Non-timeout** wait failures remain **ERROR** with stack. Timeout **return/failure semantics unchanged**. --- ### Your point 1 — does “bounded by design (caller-side)” cover `Error` / never dispatched? **Yes.** Production waits are **only** timed `get(remainingNanos, …)` under **`operationDeadlineNanos()`**. Worker **`Error`** is not caught on the write path; if the worker dies or never completes the future, the **caller** still hits **`TimeoutException`** within the configured budget and **removes the entry from `RequestFutureCache` in the `finally` block** — **not** a hang forever. No-arg **`get()`** is API-required and capped by **`untimedGetTimeoutMillis`**; production does not use it in this module. --- ### Your point 2 — does `WALWorkHandlerSurvivabilityTest` cover timeout+remove race, or only generic `executeResponse` failure? **Both are covered; not only generic exception:** | Test method | What it pins | |-------------|----------------| | **`removedFutureShouldNotKillWorker`** | Caller timeout/eviction: **`requestId` absent from `RequestFutureCache`**; **`onEvent` / `walEvent` must not die**; a **later** append still completes. | | **`throwingDoneShouldNotKillWorker`** | **`future.done(...)` throws**; **`executeResponse` catches `Exception`**; worker survives. | | **`nonIoExceptionFromWriteShouldNotKillWorkerAndWriterStaysPermanentlyFailClosed`** | Non-IO write failure → worker alive + **sticky fail-close**. | | **`flushFailureFromHdfsWriterShouldFailCloseSubsequentAppend`** | **`hsync` failure** after append → same fail-close behavior. | We do **not** unit-test a JVM **`Error`** killing the disruptor thread; that path is bounded on the **caller** side (point 1). --- ### Your point 3 — contract change if point 1 is “yes” Under that assumption: **timed `get` → `TimeoutException`**, capped no-arg **`get()`** for `Future` compliance only, and **`IMapFileStorage` already catches `TimeoutException`**, is the **intended contract**. If your synced-head pass still wants a different surface, please point to the call site. --- **Daniel (FYI):** Test acceptance for ring admission + checkpoint monitor FT is on **`c0a6c38b1d`** (separate thread to @DanielLeens). No production change for your 1–8 from that commit. Ready for your **synced-head** sign-off when convenient. Thanks. -- 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]
