chrisdutz opened a new pull request, #19177:
URL: https://github.com/apache/iotdb/pull/19177

   ## Description
   
   Stopping a node spent several seconds waiting for worker threads to notice 
the stop. This PR wakes them instead:
   
   | Where | Before | Now |
   |---|---|---|
   | `TimeoutExecutorThread.sendStopSignal()` | Empty. The thread sat in its 20 
s `DelayQueue` poll until `StoppableThread.awaitTermination` interrupted it 
after eight 250 ms join rounds: about 2 s for each of the two timeout threads. 
| Queues a stop marker that is due at once. `run()` skips it. |
   | `ProcedureExecutor` worker loop | Slept 1 s after the stopped scheduler 
returned `null`. | Sleeps only while the executor is running. |
   | `WALBuffer`, close signal | Without pending data, the serialize task 
waited out the async fsync delay (1 s) for entries that can no longer come. | 
Ends the batch at once. Pending data and checkpoints are still fsynced. |
   | `TableDiskUsageIndex.close()` | Waited for the worker's 1 s queue poll. | 
Wakes the worker with a no-op operation. |
   | `AbstractPeriodicalServiceWithAdvance.stopService()` | The loop waited for 
its next interval. | Wakes the loop. |
   | `ConfigNodeShutdownHook` | Logged an ERROR on every stop of a single 
ConfigNode, which has nobody to report its shutdown to. | Reports only when 
there are targets. |
   
   It also fixes `ThriftService.startService()`, which set the caller's 
interrupt flag for any start failure. For example, a client port that is in use 
(reported as `IllegalAccessException`) left the starting thread interrupted, so 
the cleanup after the failed start ran on an interrupted thread. Only an 
`InterruptedException` sets the flag now.
   
   ## Results
   
   - `ProcedureExecutorStopTest` (new): stopping and joining an idle 
`ProcedureExecutor` took 4.6 s before and 0.1 s now.
   - Stopping a 1C1D setup running in one JVM went from about 7 s to about 1.1 
s. Most of the rest is the async WAL batch window for data written in the last 
second.
   - Integration tests, which start and stop nodes all the time, should benefit 
as well.
   
   ## Tests
   
   - confignode procedure tests: `TestProcedureExecutor`, `STMProcedureTest`, 
`CompletedProcedureRecyclerTest` and the new test.
   - datanode WAL and disk-usage tests: 122 tests.
   
   All pass.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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