Skip to content

Flaky ITs: async restore 404s on restored children with the Redis cache; IT search pool runs on schema defaults #34058

Closed

Description

@mohityadav766

Affected module

Backend (entity cache) and the backend integration-test harness

Describe the bug

Two integration tests fail intermittently in CI and have been evicting PRs from the merge queue.

1. With the Redis cache on, a restored child can 404 right after an async restore commits.
RestoreHierarchyIT.asyncRestore_returns202AndRestoresFullHierarchy fails in the postgres-elasticsearch-redis, parallel lane with databaseSchema instance for <id> not found.

Since #33866, the restore cascade's children are evicted from Redis only after the transaction commits, in EntityRepository.drainCacheInvalidations. The drain goes one entity at a time, with about ten synchronous Redis calls each. The restored root (the database) is still evicted inline by EntityUpdater, so it reads as restored the moment the transaction commits. Its schemas and tables keep serving their soft-deleted cached copies until the drain reaches them. A client that sees the restored database and then fetches a schema inside that window gets a 404.

Any read in that window also copies the stale Redis entry into the in-JVM L1 cache, and nothing evicts it after the commit. EntityCacheRepair's 500 ms backstop is timed from the in-transaction eviction, so it can fire before a long transaction commits.

In one failing run (merge queue for #33338), the database was re-read as restored at 14:40:43.21 (server log) and the schema GET 404'd about 0.2 s later. The async restore job finished at 14:40:45.91.

These are the postgres-elasticsearch-redis parallel-lane reports from 2026-09-23 06:51 to 2026-09-25 15:57 UTC, split by whether the tested commit contains #33866. This is CI observation, not a controlled run:

Tested commit Reports syncRestore fails asyncRestore fails test_sdkOnlyAsyncOperations fails (unrelated)
without #33866 188 3 0 12
with #33866 86 0 7 8

2. The IT server's search client runs on the schema pool defaults.
SearchResourceIT.testEntityTypeCountsResponseFormat fails in the mysql-elasticsearch, parallel lane with Failed to get entity type counts: error while performing request. The server log shows org.apache.hc.core5.util.DeadlineTimeoutException at StrictConnPool.processPendingRequest. That is a connection-pool lease timeout, which Rest5Client wraps as "error while performing request".

TestSuiteBootstrap never sets maxConnTotal or maxConnPerRoute. The in-process server therefore gets the schema defaults: 10 connections to the single Elasticsearch host and 30 in total. conf/openmetadata.yaml ships 50 and 100. Under the parallel lane's load the pool stays empty for longer than connectionRequestTimeoutSecs (5 s).

To Reproduce

  1. Run with the Redis cache enabled.
  2. Create a database with a few schemas and tables, and soft-delete it recursively.
  3. Read a schema with include=all. This caches the soft-deleted copy.
  4. PUT /api/v1/databases/restore?async=true.
  5. Poll GET /api/v1/databases/{id} until it is no longer deleted, then immediately GET /api/v1/databaseSchemas/{schemaId}. Under load this intermittently returns 404.

Expected behavior

Once a restored entity reads as restored, its restored children do too, and no cache serves a pre-restore copy after the commit. The IT server should run with production's search pool sizes.

OpenMetadata version

main, since #33866 (merged 2026-09-24).

Additional context

On 2026-09-25 the first failure evicted these merge-queue entries: #33338, #33883, #33656.

Pre-submission checklist

  • I searched for duplicate issues.
  • I removed credentials, hostnames, emails, and other sensitive data from logs and config.

Activity

  1. added
    bug
    on Sep 25, 2026
  2. added this to Shipping and removed this from Roadmapon Sep 27, 2026
  3. moved this to In Review / QA 👀 in Shippingon Sep 27, 2026
  4. added a commit that references this issue on Sep 27, 2026
    56df97d
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

    backendbug

    Type

    No type

    Projects

    • Status
      Done ✅

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions