ImFlog / schema-registry-plugin

Gradle plugin to interact with Confluent Schema-Registry.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More information on incompatibility error?

tomasAlabes opened this issue Β· comments

Hi, 1st thank you so much for your work on the plugin πŸ₯‡

I was wondering if the output of the testSchemasTask is correct or if it's missing something, as it gives no information on the incompatibility found:

* What went wrong:
1 schemas not compatible, see logs for details.
> java.lang.Throwable (no error message)

The logs don't say anything. I tried with -i, --debug, --stacktrace.

Is the confluent plugin output like this too? Or is this plugin missing to output something?

Thanks!

Hello, thank you for the interest in this plugin and sorry for the late answer, I was on holidays :)
I've just checked the code and It seems that we do not log properly the error response from the schema registry:

val compatible = try {
                client.testCompatibility(subject, parsedSchema)
            } catch (ex: RestClientException) {
                ex.errorCode == Errors.SUBJECT_NOT_FOUND_ERROR_CODE
            }
            if (compatible) {
                logger.info("Schema $path is compatible with subject($subject)")
            } else {
                logger.error("Schema $path is not compatible with subject($subject)")
                errorCount++
            }

I think we could log the schema registry exception message in the catch block instead of checking the error code only.

I will improve this by the end of the week and get back to you so you can try with your use case before releasing a new version.

I just took a look at this issue, @tomasAlabes can you try the code in the branch feature/compatibility_errors on your use case see if something better is logged ?
I fear that it won't help you that much as the schema registry library that's used returns a boolean, which means that if the schemas are not compatible, we won't know why (except for special cases where an exception is raised).
Maybe the Schema registry logs something on it's side when a check fails but I'm not sure...

Thanks for the work @ImFlog! It's ok, if the registry doesn't tell you the reason then you can't do much. I'll check it as soon as I can and let you know.

I pulled the branch, built & published to maven local, changed the ref to 0.10.0-SNAPSHOT and tried with incompatible change, and same log 😞

Schema X.avsc is not compatible with subject(some.id)

Has i expected 😞
After some deeper research It turns out that the reason is not available for Avro in all cases, for JSON or Protobuf It would be possible to retrieve the error in a better way (not only by looking at logs on the server).
I created an issue on confluent side : confluentinc/schema-registry#1551
I think I will not be able to fix your issue @tomasAlabes.

I still keep It active while I finish the exception / error handling.