Apicurio / apicurio-registry

An API/Schema registry - stores APIs and Schemas.
https://www.apicur.io/registry/
Apache License 2.0
608 stars 269 forks source link

Artifact transits to disabled state after last version is being disabled #5114

Open dpilin opened 2 months ago

dpilin commented 2 months ago

Description

Registry Version: 2.6.2.Final Persistence type: SQL

Environment

Kubernetes 1.26

Steps to Reproduce

  1. Create a new artifact in schema registry
  2. Add two more versions of its schema
  3. Make sure that all three versions are available in both Apicurio and Confluent-compatible APIs:

    http:///apis/registry/v2/groups/default/artifacts//versions http:///apis/ccompat/v7/subjects//versions

  4. Also make sure that a respective subject is availble in the Confluent-compatible API:

    http:///apis/ccompat/v7/subjects

  5. Disable the last version of the artifact:

    curl --location --request PUT 'http:///apis/registry/v2/groups/default/artifacts//versions/3/state' \
    -H "Content-Type: application/json" \ --data '{"state": "DISABLED"}'

  6. Make sure that subject disappeared from Confluent-compatible API, even though there are two enabled versions of it available:

    http:///apis/ccompat/v7/subjects

Expected vs Actual Behaviour

Expected behaviour here is that the subject should be available while there is still at least one enabled schema version available.

But for some reason artifact itself transits to disabled state after its last version is being disabled. At the same time it is possible to get all the information regarding its versions from the APIs (both Apicurio and Confluent-compatible).

Confluent-compatible API, for example, returns the latest (second) version of schema in this case with no problem from this endpoint (works fine in UI as well):

http://:8080/apis/ccompat/v7/subjects//versions/latest

EricWittmann commented 2 months ago

Thank you for the report. This does sound like a bug in 2.6.

It's worth noting that this should not be a problem in 3.0, because we have simplified the core API. Artifacts in 3.0 no longer have status. Only versions have status. So you can still disable a version, and you can disable all versions. That will have an impact on which version is returned when getting the latest. But since artifacts no longer have the concept of status, it shouldn't be a problem.

That said, we Will continue to support V2 of the core API in 3.0. so this will likely need to be fixed in any case. I just wanted to add some context.