Class StreamingParallelParsingCoordinator

java.lang.Object
org.elasticsearch.xpack.esql.datasources.StreamingParallelParsingCoordinator

public final class StreamingParallelParsingCoordinator extends Object
Coordinates parallel parsing of a sequential (non-seekable) decompressed stream by chunking it at record boundaries and dispatching each chunk to a parser thread.

This is the streaming counterpart to ParallelParsingCoordinator, designed for stream-only compression codecs (gzip, zstd without seekable frames) where the decompressed data is only available as a sequential InputStream.

Architecture:

  1. A segmentator thread reads the decompressed stream into byte buffers from a pool
  2. Each buffer is split at the last record boundary to form a complete chunk
  3. Chunks are dispatched to parser threads via a bounded queue
  4. Parser threads parse each chunk independently using the format reader
  5. Results are yielded in chunk order via per-slot page queues

Shutdown blocking sites: when the iterator's close() is invoked the segmentator may be parked on (a) the upstream InputStream.read(byte[], int, int), (b) bufferPool.take(), (c) chunkQueue.put(), or (d) dispatchPermits.acquire(). Close sets closed=true, releases one permit on dispatchPermits (covers (d)), and drains both the chunk queue and page queues (covers (b) and (c) by freeing slots so put/take either succeeds or completes after the post-acquire closed re-check). Case (a) is the responsibility of the upstream stream wrapper — most stream-only codecs return on close; if the upstream blocks indefinitely on read, close will time out after the iterator's close-timeout and log a warning.