Skip to content

Logical test suite PUT records every test case as removed from tests #38798

Backlog

Description

@ryshinoz

Affected module

Backend

Describe the bug

PUT /api/v1/dataQuality/testSuites (createOrUpdateLogicalTestSuite) on an existing logical test suite records every test case of the suite as removed from tests, although the test cases stay in the suite.

CreateTestSuite has no tests property, so the entity built from the request always has tests empty. TestSuiteUpdater.entitySpecificUpdate then compares the stored test list with the empty one and calls recordChange("tests", origTests, []). Nothing removes the relationships, so the suite keeps its test cases, but the version history says they were all deleted.

The whole list of test case references is written into the suite's changeDescription / incrementalChangeDescription (stored in the entity JSON) and into the change event, on every PUT. With a large logical suite this is several MB per call. A client that calls create_or_update for its logical suite on every run (for example to keep the description in sync) produces a new full-list "removal" each time.

To Reproduce

  1. Create a logical test suite and add a few test cases to it (PUT /api/v1/dataQuality/testCases/logicalTestCases).
  2. Send the same create request again: PUT /api/v1/dataQuality/testSuites with {"name": "<suite>", "description": "..."} (no change, or only a description change). The Python SDK's metadata.create_or_update(CreateTestSuiteRequest(...)) sends this request.
  3. GET /api/v1/dataQuality/testSuites/{id}?fields=tests: all test cases are still listed.
  4. GET /api/v1/dataQuality/testSuites/{id}/versions/{version} (or the response of step 2): changeDescription.fieldsDeleted contains tests with every test case reference, and version was bumped.

Expected behavior

A PUT whose request cannot carry tests should leave tests out of the comparison, as a PATCH that does not touch tests does. No change should be recorded for tests and, if nothing else changed, the version should not change.

OS

N/A (server behavior, not OS-specific)

Python version

N/A (the server is affected; the SDK only sends the request)

OpenMetadata version

2.0.1 (observed). By reading the code, the same behavior is expected on 2.0.10 and main (6c23808).

OpenMetadata Ingestion package version

2.0.1

Additional context

Where it happens (from reading the code)

How we noticed

On 2.0.1 a job called create_or_update for a logical suite of every service on each run. The stored incrementalChangeDescription of one suite reached about 5 MB, all of it the list of removed tests. Together with a second issue (the testSuites field of a test case embeds this incrementalChangeDescription, reported in #38799), every test case result write stored hundreds of KB in change_event, successful_sent_change_events, audit_log_event and entity_extension, and the database grew by about 160 GB in about 20 hours. After we stopped calling PUT on the logical suites, the rows went back to about 6 KB.

Possible fix

In TestSuiteUpdater, compare tests only when the request carries it (for example skip it for Operation.PUT, or copy original.getTests() to updated before the comparison when updated.getTests() is null). Test case membership of a logical suite is managed through /testCases/logicalTestCases anyway.

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

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions