deniskuzZ opened a new pull request, #550:
URL: https://github.com/apache/tez/pull/550
With `tez.runtime.enable.final-merge.in.output=false` (and pipelined shuffle
off), each spill's callback
(`SpillCallback.onSuccess` -> `mayBeSendEventsForSpill`) adds the spill's
`CompositeDataMovementEvent` to `finalEvents`
on its spill thread, and `close()` returns that list. When spills finish at
the same time:
- `finalEvents` is a plain `LinkedList`, and two `addAll`s at once can
corrupt it. If a node is lost but the size is
kept, `close()` returns a `null` and `TezEvent` fails the attempt
("Unknown event"). If the node and the size
increment are both lost, the list is one event short and the consumer
waits forever for that spill: a silent hang.
- The spill pool hands its tasks over through a `SynchronousQueue`. A
callback releases its `availableSlots` permit while
it still runs on its pool thread, and the `maxThreads - 1` permits leave
room for one such thread, not several. When
every thread is busy, `scheduleSpill` gets a `RejectedExecutionException`
and the task fails.
- The pool's core thread never times out, so a writer that is never closed
keeps it: we counted 125 idle
`UnorderedOutSpiller` threads, 1 to 2.6 hours old, in an LLAP daemon.
Two spills in flight are routine: in Hive on Tez (LLAP), TPC-DS 10 TB, one
q78 run had 218 of 1,377 writers of a map
vertex with two pool spills in flight, as `close()` schedules a spill of the
filled buffers while a mid-task one runs.
A corruption needs two appends to overlap, so it is rare per writer.
The patch:
- makes `finalEvents` a synchronized list. `close()` already waits for every
pending spill under `spillLock` before it
reads the list.
- gives the pool core = max = `maxThreads`, a `LinkedBlockingQueue` and
`allowCoreThreadTimeOut(true)`.
`availableSlots` still bounds the spills in flight; the queue only absorbs
the moment between a callback releasing
its permit and its thread returning to the pool. Idle threads exit after
60 s.
Test: `testConcurrentSpillsWithFinalMergeDisabled` runs 40 writers, 4 at a
time, each with 64 buffers of 4 KiB (32
spill threads), 16 partitions and 200,000 records, final merge off. It
checks that no spill is rejected, that `close()`
returns no `null`, and that it returns one spill event per spill. It is a
stress test, so it can pass on a broken
writer: on master it failed 6 of 6 runs (5 `RejectedExecutionException`, 1
`null` event), and with other sizes it also
caught the silent case (`spill events ==> expected: <316> but was: <315>`).
With the patch it passed 8 of 8 runs, ~28 s
each (14-core laptop). `TestUnorderedPartitionedKVWriter`: 371 run, 0
failures; tez-runtime-library: 824 run, 0 failures (2 async-http tests error
with a netty `NoSuchFieldError` in my local build, on master too).
--
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]