[BUG] SQL returns HTTP 200 with silently partial results when a PIT hits search.max_open_pit_context

Aperta
#5,946 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
53/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java
Ambito
api, backend

Direzione di ricerca

Start by tracing OpenSearchRequestBuilder.createPit and the SQL response path, then compare how #5807 reports partial results in PPL. Check the existing tests for PIT creation and SQL responses. Done means a PIT that omits shards causes SQL to fail clearly or report partial results, with a regression test covering the reproducer.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug error-experience

What is the bug?
When a SQL query opens a point-in-time (PIT) over more shards than search.max_open_pit_context allows, SQL returns HTTP 200 with only some of the rows and no warning.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Lower the PIT cap (default 300, dynamic) so this fits on one laptop, and turn index pruning off.
curl -s -X PUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' \
  -d '{"transient":{"search.max_open_pit_context":5,"plugins.query.pruning.enabled":false}}' | jq .acknowledged
# true
  1. Create 10 single-shard indices with one doc each.
for i in $(seq -w 1 10); do
  curl -s -X PUT localhost:9200/pitdemo_$i -H 'Content-Type: application/json' \
    -d '{"settings":{"number_of_shards":1,"number_of_replicas":0},"mappings":{"properties":{"day":{"type":"integer"}}}}' >/dev/null
  curl -s -X POST localhost:9200/pitdemo_$i/_doc -H 'Content-Type: application/json' -d "{\"day\":$((10#$i))}" >/dev/null
done
curl -s -X POST 'localhost:9200/pitdemo_*/_refresh' >/dev/null
curl -s 'localhost:9200/pitdemo_*/_count' | jq .count
# 10
  1. Run a SQL row query over the pattern. Half the rows are gone, with status 200 and no warning.
curl -s -X POST localhost:9200/_plugins/_sql -H 'Content-Type: application/json' \
  -d '{"query":"SELECT day FROM pitdemo_* ORDER BY day"}' | jq -c '{status, total, datarows, warnings}'
# {"status":200,"total":5,"datarows":[[1],[2],[3],[4],[5]],"warnings":null}
  1. Run the same query in PPL. It returns all 10 rows.
curl -s -X POST localhost:9200/_plugins/_ppl -H 'Content-Type: application/json' \
  -d '{"query":"source=pitdemo_* | sort day | fields day"}' | jq .total
# 10

What is the expected behavior?
SQL returns all 10 rows. If the PIT can't cover every shard, SQL should fail the query or return the same partial-results warning PPL does, not return a short answer with HTTP 200.

What is your host/environment?

  • mainline (3.10.0-SNAPSHOT), single node

Do you have any screenshots?
N/A

Do you have any additional context?

  • OpenSearchRequestBuilder.createPit passes allowPartialPitCreation=true. Shards past the cap are left out of the PIT, so the search that follows sees _shards.failed: 0, and nothing appears in the response or the node log. With the cap back at 300, the same query returns 10 rows.
  • SQL uses a PIT here even without fetch_size (_explain shows a pitId).
  • At default settings it takes more than 300 shards in one query, e.g. ~750 daily single-shard indices with pruning off, which is where this was first seen.
  • #5807 added a partial-results warning for PPL only. It skips the V2 fallback, and SQL responses have no warnings field, so SQL shard failures are silent too (not reproduced here). #5687 was the PPL version of this bug. #5808 is the same symptom from pruning dropping an index.
  • Possible fix: pass the PIT's missing-shard count into the SQL response as a warning, or create the PIT with allowPartialPitCreation=false and fail with a clear error.
Lingua principale
Java
Stelle
176
Fork
237
Merge medio
2g 12h
PR unite (30g)
34

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di opensearch-project/sql

Tutte le issue di opensearch-project/sql

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.