Skip to content

buffer_pool_size buys no decode-ahead, contrary to the javadoc #133

Backlog

Description

@ideoma

buffer_pool_size buys no decode-ahead, contrary to the javadoc

Repository: questdb/java-questdb-client. Found while reviewing questdb/questdb#7768 with #105 (client head 564542a, base 58e556f). Probe sources and logs: /tmp/review-pr-FxgkGl/probes/F6/.

  • Problem: the I/O thread never decodes ahead, whatever buffer_pool_size is set to.
  • Net impact: a larger pool only costs memory (64 KiB per buffer).
  • Location:
    • java-questdb-client QwpEgressIoThread.handleResultBatch L732-758 (the park after each published batch).
    • The javadoc: QwpQueryClient L62-63, L788-789 and L1269-1271; QwpEgressIoThread L43-49; QwpBatchBuffer L41-42.
  • Symptom:
    • The I/O thread waits after each published batch until onBatch returns. It therefore never reads or decodes batch N+1 while onBatch(N) runs.
    • The javadoc says the opposite: the I/O thread reads and decodes ahead, up to the buffer-pool depth.
    • Users who raise buffer_pool_size or call withBufferPoolSize get no overlap, only more native memory.
  • Origin: pre-existing. The behaviour is identical at client base 58e556ff and dates from the first client commit 666e2346.
  • Reachability: any result with more than one batch.
    • A probe ran at base and head with pool sizes 1, 4, 8 and 16. While a batch was held, only one buffer was out of the pool and no further event was published.
    • A positive control with the park removed published 3 batches ahead, so the probe can see decode-ahead when it happens.
  • Suggested fix: correct the javadoc, and drop or repurpose buffer_pool_size. The park itself is needed: it protects the in-place decode from use-after-free, which QwpInPlaceDecodeAliasingTest pins. Real decode-ahead would need owned decode buffers.
  • Severity if filed standalone: Moderate.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions