Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created January 30, 2015 15:24
Show Gist options
  • Save ableasdale/ee1951ce25bc35accad9 to your computer and use it in GitHub Desktop.
Save ableasdale/ee1951ce25bc35accad9 to your computer and use it in GitHub Desktop.
Forest aggregate disk size
xquery version "1.0-ml";
(:
: Example: calculate the on-disk size of each forest
:)
declare default element namespace "http://marklogic.com/xdmp/status/forest";
declare variable $path as xs:string := 'E:\support_qa_60.dmp';
declare variable $support as document-node()* := xdmp:document-get(
$path,
<options xmlns="xdmp:document-get">
<format>xml</format>
<repair>full</repair>
</options>
);
declare function local:get-disk-size-per-forest(){
element cluster {
for $forest in $support/forest-status
order by $forest/host-id, sum(fn:data($forest/stands/stand/memory-size)) descending
return (
element forest{attribute host {$forest/host-id}, $forest/forest-name, element total-disk {sum(fn:data($forest/stands/stand/disk-size))}}
)
}
};
local:get-disk-size-per-forest()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment