This happens because when loading schemas using find, the already loaded schemas are not provided to load_schema!. With Schema Z being required by schema X itself required by schema Y, and schemas being loaded in alphabetical order, when loading Y, local_schemas_cache is empty when load_schema!(Y) is called.
This makes parsing the schema fails because X is unknown (to load_schema!, even if present in @schemas).
An attempt is made to have X loaded, to local_schemas_cache
This fails because Z is not in local_schemas_cache
Z is loaded, and added to local_schemas_cache
Then, a second attempt is made to load X, but providing @schemas, this time.
Avro fails, because X is already loaded
This change basically provides @schemas.dup when find calls load_schema! to make sure X is found on first try.
This happens because when loading schemas using
find
, the already loaded schemas are not provided toload_schema!
. With Schema Z being required by schema X itself required by schema Y, and schemas being loaded in alphabetical order, when loading Y, local_schemas_cache is empty whenload_schema!(Y)
is called. This makes parsing the schema fails because X is unknown (to load_schema!, even if present in @schemas). An attempt is made to have X loaded, tolocal_schemas_cache
This fails because Z is not inlocal_schemas_cache
Z is loaded, and added tolocal_schemas_cache
Then, a second attempt is made to load X, but providing @schemas, this time. Avro fails, because X is already loadedThis change basically provides @schemas.dup when
find
callsload_schema!
to make sure X is found on first try.Fixes #181