karapace icon indicating copy to clipboard operation
karapace copied to clipboard

VersionNotFound on compatibility check

Open nick-zh opened this issue 2 years ago • 6 comments

If the subject does not exits we used to get SubjectNotFound, but with the newest update we get VersionNotFound for compatibility/subjects/my-subject/versions/latest, is that intended?

nick-zh avatar Oct 28 '22 08:10 nick-zh

I am assuming it is due to this change: https://github.com/aiven/karapace/pull/450 This newly maps the SchemasNotFoundException to the same error code as VersionNotFoundException which is VERSION_NOT_FOUND. I think for SchemasNotFoundException we still should get SUBJECT_NOT_FOUND as error code, what do you think @jjaakola-aiven ?

nick-zh avatar Oct 28 '22 12:10 nick-zh

@nick-zh Thank you for the report. Just a fast thought on this. If the subject does not exist, nor there is any version, the API should return that given schema is compatible. As there is no previous schema to be incompatible with.

jjaakola-aiven avatar Oct 28 '22 13:10 jjaakola-aiven

@jjaakola-aiven it depends on what the user wants to know after the request, so the way we handle it is that we catch that exception and set our check to true, others might want to do different things. I would advocate that the more information the better so i can differentiate all the cases:

  • is really compatible (the schema i try to compare for compatibility exists and is compatible or not)
  • version does not exist
  • subject does not exist

nick-zh avatar Oct 28 '22 13:10 nick-zh

It looks that Confluent's Schema Registry returns that given schema is compatible. If one needs to know if a subject or a version in a subject exists, there are other API endpoints for those needs.

tvainika avatar Nov 04 '22 13:11 tvainika

Indeed, so then i think instead of the current VersionNotFoundException Karapace should also return the same as confluent schema registry if the subject does not exist to be consistent (as suggested by @jjaakola-aiven ), what do you think @tvainika ?

nick-zh avatar Nov 04 '22 15:11 nick-zh

Indeed, so then i think instead of the current VersionNotFoundException Karapace should also return the same as confluent schema registry if the subject does not exist to be consistent

Yes, that's the way to do it. Let's see when we can fix this, but should be easy one if anyone wants to take a look. Patches welcome.

tvainika avatar Nov 07 '22 07:11 tvainika