Skip to content

AUTO: Update take-it-for-a-spin.md - #4

Closed
github-actions[bot] wants to merge 1 commit into
docs-workflowfrom
auto-docs-workflow-f4cb44d335ee09cec6876762fa07f62ddc65f6b3
Closed

github-actions[bot] wants to merge 1 commit into
docs-workflowfrom
auto-docs-workflow-f4cb44d335ee09cec6876762fa07f62ddc65f6b3

Conversation

@github-actions

Copy link
Copy Markdown

No description provided.

parthp2107 pushed a commit that referenced this pull request Jul 26, 2022
parthp2107 pushed a commit that referenced this pull request Jul 26, 2022
@parthp2107 parthp2107 closed this Sep 6, 2022
parthp2107 pushed a commit that referenced this pull request Aug 31, 2026
… on any pod size (open-metadata#29833)

* Add a circuit breaker to the embedding provider client

When an embedding provider is persistently unavailable (e.g. Bedrock
AccessDenied when the deployment lacks Bedrock permission, throttling, or an
outage), the vector pipeline previously called the provider for every entity
lifecycle event with no back-off, flooding logs with per-entity stack traces
and burning threads/CPU.

Add a provider-agnostic circuit breaker in EmbeddingClient: after five
consecutive failures (or immediately on a permanent auth/config failure) the
circuit opens and embed() fast-fails with EmbeddingUnavailableException without
a provider call; it half-opens after a cooldown and closes on recovery.
BedrockEmbeddingClient classifies 401/403/404 as permanent and drops its
per-call error stack traces to debug. OpenSearchVectorService skips embedding
work entirely while the circuit is open, so entities are still indexed without
vectors during an outage and enrichment resumes automatically on recovery.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Bound reindex auto-tune in-flight bulk memory to the container limit

Auto-tune sized reindex memory against the JVM heap (Runtime.maxMemory() = -Xmx)
and capped concurrency and payload size independently, but never bounded their
product. Bulk-request payloads are held largely in off-heap direct buffers, so
concurrentRequests x maxPayloadSize could exceed the container cgroup limit while
the heap looked fine, and the pod was OOMKilled (137) -- so auto-tune did not
"just work" on memory-constrained pods.

Cap concurrent bulk requests so concurrentRequests x maxPayloadSize fits half the
pod's off-heap headroom (container limit - max heap), reading the container limit
from com.sun.management.OperatingSystemMXBean.getTotalMemorySize() (container-aware
with UseContainerSupport). Applied to both the metrics-based and conservative-default
paths, plus an off-heap bulk-memory estimate in the recommendation log.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Skip reindex chunk-build when embeddings are down; bound queue by heap

- Gate VectorDocBuilder.fromEntity on embeddingClient.isAvailable(): the reindex
  chunk path (OpenSearchBulkSink -> fromEntity) and updateEntityEmbeddingChunks
  built chunk docs + attempted embeds even while the provider circuit was open.
  embed() already fast-failed via the breaker, but the chunk-building CPU/memory
  ran anyway; skipping at the shared builder covers all three callers.
- Bound the reindex entity queue by bytes, not a flat count: it was capped at
  10000 entities assuming ~10 KB each, but wide tables / large descriptions /
  sampleData run 50 KB-1 MB, so the queue could reach multi-GB heap. Cap queueSize
  so queueSize * ESTIMATED_ENTITY_BYTES stays within 25% of heap, and fix the
  now-honest estimate log. Genuinely huge entities are still caught by the bulk
  sink's runtime backpressure.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Address review: single-probe half-open + non-null circuit cause

- Enforce a single half-open probe: guardCircuit now routes HALF_OPEN callers
  through rejectOrProbe, which pushes the open deadline forward on transition so
  concurrent callers keep fast-failing until the one probe resolves (was letting
  up to maxConcurrentRequests hit the provider per cooldown window).
- Fall back to the exception class name when getMessage() is null so the circuit
  log/exception don't read "... circuit open: null".

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* isAvailable() also fast-fails during the half-open probe window

Mirror guardCircuit: return false while OPEN/HALF_OPEN and the probe deadline
hasn't elapsed, so isAvailable()-gated callers (OpenSearchVectorService) skip
chunk-building during a probe instead of proceeding and hitting the breaker.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Fix broken merge resolution in EmbeddingClient

The main merge left a dangling embed() (unclosed try running into an orphaned
javadoc) plus a duplicate embed() and dropped the circuit breaker from
embedWithLimit. Restore a single embed()/embedQuery() routing through
embedWithLimit, with guardCircuit + record success/failure in that shared path
so both document and query embeds are circuit-protected.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Address PR review: preserve chunk vectors during embedding outage; heap-aware queue sizing

OpenSearchVectorService: guard updateEntityEmbeddingChunks/updateEntityEmbeddings so an entity edit during a provider outage no longer deletes existing chunk vectors (fromEntity returns empty when the circuit is open; replaceChunks would otherwise delete to match). Adds chunksEmptyFromOutage() helper + an outcome test (no _bulk delete while unavailable).

SearchClusterMetrics: log when the 1000-entity queue floor exceeds the heap budget on tiny pods (#3); compute conservativeQueueSize after boundConcurrentRequestsToMemory so it tracks the bounded concurrency (#4).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Bound concurrent audit-log exports to prevent heap OOM

AuditLogResource.exportAuditLogs materialized up to 100K audit entries as one JSON string and sent it inline over the csvExportChannel websocket, on the shared AsyncService executor. Parallel exports (e.g. Playwright shards) piled multi-hundred-MB byte[] onto the heap and OOM'd the server — locally reproduced (heap dump byte[] = the audit export payloads), matching the AUT nightly restarts.

Route audit exports through a dedicated 2-thread executor so at most 2 serialize a payload at once (mirrors the entity/search CSV export path, which already runs on the bounded GenericBackgroundWorker pool). Separate from the open-metadata#29342 CSV-export spool fix, which never covered the audit export.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Stream audit-log export to a spool file instead of inlining it over the websocket

The audit export built the full List<AuditLogEntry> + one JSON String in memory and sent it inline over the csvExportChannel websocket. Concurrent exports OOM'd the server — first on-heap (Java OOM + dump), then off-heap (OOMKilled 137, netty send buffer) once concurrency was merely bounded. Reproduced locally end-to-end.

streamExportAsJson now writes each 1000-row batch straight to a CsvExportSpool file (one batch in heap at a time), and the COMPLETED event carries only a download reference (null data). New GET /v1/audit/logs/export/{jobId}/result streams the spooled result. Verified: the 150-concurrent hammer that previously OOM'd leaves the server running (peak humongous 322, GC'd to ~3) and the 180 MB result downloads correctly.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Address review: single-probe half-open breaker, explicit outage signal, audit export hardening

- EmbeddingClient: make HALF_OPEN a deterministic single-probe state (reject
  concurrent callers by state, not a time deadline), keep isAvailable() false
  while a probe is in flight, and record permit-acquisition failures so a
  promoted probe always resolves. Adds a latch-based single-probe test.
- VectorDocBuilder.fromEntity: throw EmbeddingUnavailableException on outage
  instead of returning an empty list callers cannot distinguish from
  "no chunks" (which would delete existing vectors).
- OpenSearchVectorService: drop the racy chunksEmptyFromOutage guard; catch the
  outage exception so replaceChunks never deletes chunks during a provider outage.
- OpenSearchBulkSink: skip the embedding call during an outage so a transient
  provider outage indexes without embeddings (self-heals next reindex) instead
  of failing every entity in the reindex.
- SearchClusterMetrics.boundConcurrentRequestsToMemory: compute the memory cap
  in long and cast after Math.min so a tiny payload can't overflow to negative
  concurrency. Adds a regression test.
- AuditLogResource: validate the export jobId is a server-generated UUID before
  touching the spool path (path-traversal guard) and delete a partial spool on
  export failure.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Fix reindex-sink tests for the embedding-availability guard

The sink now skips embedding generation when the provider circuit is open, so
the recompute-path happy tests must stub a healthy provider — bare
mock(EmbeddingClient) reports isAvailable()=false by default, which correctly
short-circuits the new guard. Add an availableClient() helper (hoisted to a
local to avoid nested-when UnfinishedStubbing) and a
enrichWithEmbeddingSkipsGenerationWhenProviderUnavailable test asserting an
outage indexes the entity without embeddings and counts it a success rather
than calling the provider or failing the reindex.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant