Created
January 30, 2015 15:24
-
-
Save ableasdale/ee1951ce25bc35accad9 to your computer and use it in GitHub Desktop.
Forest aggregate disk size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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