Knowledgebase: MarkLogic Server
Unclosed/Obsolete Stands
16 March 2022 03:38 PM

Summary

Obsolete stands (also referred to as "unclosed-stands") occur during the normal operation of MarkLogic Server. Stands in a forest are marked as obsolete so that MarkLogic Server can recover the forest from an unexpected outage. There are many reasons a stand can be marked as obsolete:

  • It is the output stand of a merge that has not yet completed. Once the merge finishes, the stand is unmarked and is available to the forest;
  • It is an in-memory stand that has not yet been completely saved on disk. Once the in-memory stand is completely saved to disk, the stand is unmarked and is available to the forest;
  • It has been replaced by a merge but is still in use by a query. Once the last query that is using the stand completes, the stand is deleted.
  • It has been replaced by a merge but is still in use by a forest or database backup. Once all backups that are using the stand completes, the stand is deleted.

NOTE: An obsolete stand will not be deleted as long as there is any query or transaction running that has a handle to a node within that stand. This means that we should avoid server fields that store any kind of database node in the value parameter.

If you must store document nodes in a server field, then the server-field backup documents should either reside in a separate database, or you should use xdmp:quote() to store a string representation of the node into the server-field, and then use xdmp:unquote() to turn the value back into a node when you are ready to use it. Be sure to add some error handling around the xdmp:unquote() in case the base-uri for that node no longer exists.

Forest Startup

When a forest is enabled, any stand in the forest that is marked as obsolete will be deleted. 

Obsolete stands should only exist at startup in the situation where the stand is disabled unexpectedly.  This may occur:

  • If MarkLogic Server was stopped unexpectedly
  • If the stand resides on a network attached device and the device became unreachable.
  • There were in flight queries or backups when MarkLogic Server was stopped.

A forest can be started by:

  • (Re)starting MarkLogic Server
  • (Re)starting (Disabling and Enabling) the Forest

Detecting Obsolete Stands

The files that make up a stand reside under a directory on the file system. The directory for a stand that has been marked as obsolete contains a file with the name Obsolete.

Additionally, a forest's status will indicate that when “unclosed-stand” exists for that forest.  xdmp:forest-status() will include an 'unclosed-stand' element that gives an indication of the query reference timelines.  The results will include an element that looks something like:

<unclosed-stand>
      <stand-id>539300098042005337</stand-id>
      <path>/data/Forests/forest-name/000127ee</path>
      <disk-size>51478</disk-size>
      <memory-size>2786</memory-size>
   <reference>
      <count>1</count>
      <earliest>2017-02-24T02:17:25-05:00</earliest>
      <latest>2017-02-26T23:17:30-05:00</latest>
   </reference>
</unclosed-stand>

(2 vote(s))
Helpful
Not helpful

Comments (0)