Clearing the Expanded Tree Cache on each host when redeploying XML Schemas in MarkLogic Server
16 May 2018 08:12 AM
MarkLogic Server has shipped with full support for the W3C XML Schema specification and schema validation capabilities since version 4.1 (released in 2009).
These features allow for the validation of complete XML documents or elements within documents against an existing XML Schema (or group of Schemas), whose purpose is to define the structure, content, and typing of elements within XML documents.
Caching XML Schema data
In order to ensure the best possible performance at scale, all user created XML Schemas are cached in memory on each individual node within the cluster using a portion of that node's Expanded Tree Cache.
Best practices when making changes to pre-existing XML Schemas: clearing the Expanded Tree Cache
In some cases, when you are redeploying a revised XML Schema to an existing schema database, MarkLogic can sometimes refer to an older, cached version of the schema data associated with a given document.
Therefore, it's important to note that whenever you plan to deploy a new or revised version of a Schema that you maintain, as a best practice, it may be necessary to clear the cache in order to ensure that you have evicted all cached data stored for older versions of your schemas.
If you don't clear the cache, you may sometimes get references to the old, cached schema references and as result, you may get errors like:
You can clear all data stored in the Expanded Tree Cache in two ways:
An example script has been provided that demonstrates the use of XQuery to execute the call to clear the Expanded Tree Cache against each host in the cluster:
Please contact MarkLogic Support if you encounter any issues with this process.
Related KB articles and links: