#23187·OpenSearch

[Parquet] Sustained bulk ingest into a composite index with `index.sort.field` fails the shard with a native allocator out-of-memory

Author: linuxpiCreated Sep 30, 2026Updated Sep 30, 2026
Labelsbuguntriaged

Describe the bug

Under sustained, CPU-saturating bulk ingest, a composite index with a Parquet primary and any index.sort.field fails a shard within minutes. The same ingest without index.sort.field completes.

The failing shard logs:

uncaught exception during indexing ... out_of_memory_exception:
Unable to allocate buffer of size 33554432 due to memory limit. Current allocation: 279504896

After that the shard engine is closed, and bulk requests get already_closed_exception.

In _nodes/stats → native_memory, the node's native runtime allocation climbs to 26-33 GB before the failure, on a node with about a 40 GB native memory limit. The unsorted ingest stays at 0.1-0.6 GB. While it climbs, disk writes stay close to zero and CPU is saturated, so the sorted path appears to hold rows in native memory instead of writing them out. Hot threads show write threads in:

RustBridge.finalizeWriter
  <- NativeParquetWriter.flush
  <- RowIdAwareWriter.flush
  <- DataFormatAwareEngine.preIndex

and merge threads in mergeParquetFilesInRust.

The key type doesn't matter: a scalar date sort key fails the same way as LIST long and LIST keyword keys. Lowering client concurrency only delays the failure.

Sort key Bulks in flight Docs indexed before failure Time to failure
scalar date asc 200 ~7M ~12 min
LIST long asc (2 attempts) 200 6-10M 12-15 min
LIST keyword desc 200 ~26M ~28 min
scalar date asc 50 ~86M ~1 h 54 min
none (control) 200 100M, completes -

To reproduce

  1. Use 2 data nodes (8 vCPU, 64 GB RAM each) with the analytics/DataFusion plugin stack installed.
  2. Create an index with 2 primaries and 1 replica, refresh_interval: 30s, the composite settings (index.pluggable.dataformat: composite, index.composite.primary_data_format: parquet, index.composite.secondary_data_formats: ["lucene"]), and index.sort.field: EventTime.
  3. Bulk-load the ClickBench hits dataset (~100M docs) in 1,000-doc bulks from 25 clients, each keeping 8 requests in flight, so both nodes are CPU-bound.
  4. Watch _nodes/stats → native_memory climb until a shard fails with the error above.
  5. Repeat without index.sort.field: the load completes, and native memory stays under 1 GB.

All of these runs also mapped 17 multi-value array fields. The scalar-key run shows the array sort key isn't the cause, but the failure hasn't been tested on a mapping with no array fields.

Expected behavior

Index-sorted ingest should stay within the native memory budget. It should either apply backpressure (reject with 429, or flush earlier) or bound the memory used by the sort buffers and merges. It should not fail the shard. Some throughput cost from sorting is expected; STANDARD (Lucene) with the same array sort key completes at about 22 % below its unsorted rate.

Environment

main-equivalent build with #22900 (LIST merge and sorting) and #22905 applied; Parquet primary + Lucene secondary composite index.

Source: opensearch-project/OpenSearch