Introduction: When you may need to change the state of forests
In most cases, all forests in your MarkLogic cluster will be configured to allow all (any) updates to be made.
If we consider running the following example in Query Console:
In the majority of cases, calling the above function should return "all", indicating that the forest is in a state to allow incoming queries to read data from the forest and to allow queries to update content (and to add new content) into that forest.
At any given time, a forest can be configured to be in one of four different states:
You may want to change the state of the forests in a given database for several reasons
- To run your application in maintenance mode where data can be read but no data on-disk can be changed
- In a situation where you are migrating data from a legacy database or removing data from a given forest
- In a situation where you need to quiesce all forests in a given database for long enough to allow you to make a file level backup of the forest data.
Forest states explained
Sample state management module
Below is an example template for modifying the state of all forests in a given database:
- Forest States
- Setting Forests to "read only"
- Setting Forests to "delete only"