xdmp:merge

xdmp:merge(
   [$options as (element()|map:map)?]
) as empty-sequence()

Summary

Starts merging the forests of the database, subject to specified options.

Parameters
options Options with which to customize this operation. You can specify options in either an XML options element in the "xdmp:merge" namespace, or as a map:map. The options names below are XML element localnames. When using a map, replace any hyphens in an option name with camel casing. For example, "an-option" becomes "anOption" when used as a map:map key. This function supports the following options:
merge-timestamp
Fragments with a timestamp of this or newer are not garbage collected during this merge. A negative value means the timestamp is relative to the time the merge starts, at ten million ticks per second. For example, -6000000000 means ten minutes before the merge. The default is 0, which means not specifying a timestamp.
merge-max-size
The maximum allowable size, in megabytes, of a resultant stand. The default value is taken from the database configuration. A value of 0 means there is no limit. It is possible for a stand larger than the merge-max-size to merge if the stand has enough deleted fragments to trigger the merge min ratio; in this case, MarkLogic will do a single-stand merge, merging out the deleted fragments (even if the resulting stand is larger than the merge-max-size value specified).
merge-priority
The CPU scheduler priority for the merge ("normal" or "lower").
single-stand
If any forests in the database have a single stand and this parameter is false, do not merge them. The default is true.
forests
Specifies the IDs of the forests in which to perform merges. When you express options as an XML option node, specify each forest ID as a forest child element of this option, with a type of xs:unsignedLong. When you express options as a map, the value of this option is a sequence of forest IDs, with a type of xs:unsignedLong. The default is to merge all of the forests in the database.

Required Privileges

This operation requires at least one of the following privileges:

http://marklogic.com/xdmp/privileges/xdmp-merge

http://marklogic.com/xdmp/privileges/xdmp-merge/database/{id}

Example

  xdmp:merge(<options xmlns="xdmp:merge">
               <merge-max-size>500</merge-max-size>
               <merge-timestamp>8273</merge-timestamp>
               <single-stand>false</single-stand>
               <forests>
                 <forest>{xdmp:forest("my-forest")}</forest>
                 <forest>{xdmp:forest("my-other-forest")}</forest>
               </forests>
             </options>)

(: Performs a merge on my-forest and my-other-forest.  If a stand
 : created by this merge would be greater than 500 megabytes, the merge
 : will be limited and not all stands will be merged (as many as can be
 : merged under 500 MB will be merged).  If my-forest or my-other-forest
 : have only one stand, they will not be merged.  Any fragments with
 : timestamp 8273 or newer will not be garbage collected.
:)

Example

xdmp:merge(
  map:map() => map:with("mergeMaxSize", 500)
            => map:with("mergeTimestamp", 8273)
            => map:with("singleStand", fn:false())
            => map:with("forests", 
                        (xdmp:forest("my-forest"),
                         xdmp:forest("my-other-forest")))
)

(: Performs a merge on my-forest and my-other-forest.  If a stand
 : created by this merge would be greater than 500 megabytes, the merge
 : will be limited and not all stands will be merged (as many as can be
 : merged under 500 MB will be merged).  If my-forest or my-other-forest
 : have only one stand, they will not be merged.  Any fragments with
 : timestamp 8273 or newer will not be garbage collected.
:)
Powered by MarkLogic Server | Terms of Use | Privacy Policy