1
votes

I am trying to delete a collection in MarkLogic via Query Console using the xdmp:collection-delete function but I am getting a timeout exception:

SVC-EXTIME: xdmp:collection-delete("") -- Time limit exceeded"

The collection contains about 150,000 documents and are small documents. Can someone help?

The time is set to 3600 in the admin console.I tried using the xdmp:spawn-function to delete it in batches,but i am getting a syntax error:

"unexpected Lbrace_, expecting Comma_ or Rpar_": xquery version "0.9-ml" define variable $uriMatch as xs:string {"/sortkey-257-2019*"} let $_ := for $uri in cts:uri-match($uriMatch) return if(doc-available($uri)) then (xdmp:spawn-function(function(){ xdmp:collection-delete(xdmp:document-get-collections($uri)),xdmp:commit()} , update )) else () return $_

PFB, the query that is returning XDMP:MAX-TASKS exception: xquery version "1.0-ml"; let $uriMatch:="/snapshot-257-2019*"

for $uri in cts:uri-match($uriMatch) return if(fn:doc-available($uri)) then let $x:=
xdmp:spawn-function(function(){ xdmp:collection-delete(xdmp:document-get-collections($uri)),xdmp:commit()}, update ) return $x else xdmp:log("No documents in collection")

1

1 Answers

1
votes

There are a couple of different approaches to working around the SVC-EXTIME issue.

  1. Change the time out settings for the transaction or request (depending on how the call is being made).

xdmp:set-request-time-limit(3600)

or:

xdmp:set-transaction-time-limit(3600)

  1. Break the delete up into batches

  2. Use CoRB to perform the delete