Hi All,
On a slightly related topic, what's the chance of a collision if one
uses something like this to generate a (hopefully) unique URI?
fn:concat("/foo/", xdmp:md5(xdmp:get-original-url()), ".bar")
Best,
Tim
On Wed, 2012-08-29 at 12:00 -0700, Danny Sinang wrote:
> Hi,
>
> ML support suggested we do this to generate a unique ID for our
> documents :
>
> declare function choose-uri() as xs:string
> {
> let $uri := fn:concat("/document-", xdmp:random(), ".xml")
> return if (fn:exists(fn:doc($uri))) then choose-uri() else $uri
> };
>
>
> My question is, will the call to fn:exists(fn:doc($uri)) be fast,
> considering that we now have 8 million documents ?
>
> The fn:exists(fn:doc($uri)) call is needed to obtain a read lock,
> which
> will be upgraded to a write lock when xdmp:document-insert is called.
>
> Regards,
> Danny
>
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general