Urgent : Changelog xsd lookup

Hi,
Needed a confirmation regarding the xsd lookup from changelog file.
Using version 3.6.2 of liquibase.

What is the default mechanism used by liquibase to load the xsd?
Is it the network lookup first? Or does it try to find it in the included liquibase jar first?

Also, is there any other resource for which liquibase does a network lookup as fallback?

I am from an enterprise company and we would prefer if the network lookups are avoided completely in our applications using liquibase to prevent sudden outages.

Thanks!

The logic liquibase uses is:

  1. Try to look up the requested file locally
  2. If the file doesn’t exist locally, load it from the network

To find it locally, we strip the http(s):// from the name and then search all the jars in the liquibase classpath for that file. For example, http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.6.xsd gets searched for as /www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.6.xsd in the classpath.

We ship all our xsd files as part of Liquibase, so the only time you’d hit #2 is if you purposefully referencing a custom XSD file of your own, which is something only you have control over. We don’t block you from doing that if you’d like, but we don’t ever require you to do that. And even if you do have a custom XSD file, you can package it in a jar file using the local lookup pattern like /example.com/my-file.xsd to avoid the network lookup for that as well.

NOTE: There have been a scattering of Liquibase versions with a bug in that lookup logic. I don’t remember if 3.6.2 was one of those versions or not, but if you upgrade to the current version you’ll be good for sure.

Nathan

So, network lookup is still the ultimate fallback mechanism by entity resolver.
Can you confirm the same?

And if we want to avoid network lookup altogether, what will be the best way to do it?
From what I understood, to maintain the local xsd file in the jar and referencing that using local lookup pattern.

Hi Nathan,

Have created a PR : [XSDLookUp] Updated entity resolver to not fallback to network lookup when xsd is not found by kavya-shastri · Pull Request #2558 · liquibase/liquibase · GitHub for the mentioned problem.
Please take a look at it and let me know if there is any other way to solve this problem.

Thanks,
Kavya Shastri

Hey @KavyaShastri my apologies for not putting this post together with your PR when I suggested on your PR that you ask here! It’s nice to “meet” you!

Yes, @KavyaShastri , the entity resolver is the final spot and that will fall back to the network.

I’ll follow up with more in the PR.

Nathan

1 Like