Hello Friends,
Today, I am back not to discuss a specific topic of Mark Logic, but to discuss a scenario that I recently faced and the only option we found to resolve that.
Recently I faced a problem of duplicate URI in different forests of same database which creates problem in executing fn:doc() operation with uri which is found duplicate. So I am sharing my observation here for this problem with the thought that this might help someone.
Problem :- There was below warning on database status page for one of our database.
XDMP-FORESTERR:- Error in rebalance of forest [forest-1]: XDMP-DBDUPURI [URI] found in forests [forest-1] and [forest-2]
Reason:- After lots of tracing and try we concluded that this problem may occurs when a forest of a database already contains a specific uri and later we have attached another forest to database which contains same uri in this forest as well where data may be different probably.
Resolution:- Now we see only one resolution to fix this problem that we should process all URI and check if this URI is problematic or duplicate than keep a backup of data and delete data of duplicate URI from one of the forest on the basis of some logic obviously to decide that which uri data should be kept.
In this case there was requirement of executing fn:doc() for problematic uri to get data and save in backup location but on execution on database for duplicate uri we got duplicate uri exception.
So, here forest level query did the magic. Forest level query execution option provided us the facility to run query on specific forest to get data to keep in backup location. And similarly during delete operation as well we needed to execute delete query on forest level only.
xdmp:eval helped to achieve this forest level execution of query through available options of xdmp:eval.
Below is the snippet of query that allows execution of query on specific forest.
xquery version "1.0-ml";
declare namespace html = "http://www.w3.org/1999/xhtml";
let $uri:= "/data/test/abc.xml"
let $forest-name := "forest-1"
let $query := 'declare variable $URI as xs:string external;
let $doc := fn:doc($URI)
return
$doc'
let $options := <options xmlns="xdmp:eval">
<database>{xdmp:forest($forest-name)}</database>
</options>
let $results := xdmp:eval($query,(xs:QName("URI"),$uri),$options)
return $results
As in the above code snippet, we are executing fn:doc($URI) operation on a specific forest (i.e. forest-1) using xdmp:eval query by specifying forest in database option of eval options. This allows us to execute script (ex. Script written in $query in above snippet) on specific forest.
So, using this option we were able to keep backup of duplicate uri from specific forest, also able to delete duplicate uri from specific forest to resolve this problem.
If any of you gone through similar problem and found effective solution for this problem than please do share with me. This might help someone who is facing this problem.
So, see you soon, till the time keep exploring keep sharing :)
Today, I am back not to discuss a specific topic of Mark Logic, but to discuss a scenario that I recently faced and the only option we found to resolve that.
Recently I faced a problem of duplicate URI in different forests of same database which creates problem in executing fn:doc() operation with uri which is found duplicate. So I am sharing my observation here for this problem with the thought that this might help someone.
Problem :- There was below warning on database status page for one of our database.
XDMP-FORESTERR:- Error in rebalance of forest [forest-1]: XDMP-DBDUPURI [URI] found in forests [forest-1] and [forest-2]
Reason:- After lots of tracing and try we concluded that this problem may occurs when a forest of a database already contains a specific uri and later we have attached another forest to database which contains same uri in this forest as well where data may be different probably.
Resolution:- Now we see only one resolution to fix this problem that we should process all URI and check if this URI is problematic or duplicate than keep a backup of data and delete data of duplicate URI from one of the forest on the basis of some logic obviously to decide that which uri data should be kept.
In this case there was requirement of executing fn:doc() for problematic uri to get data and save in backup location but on execution on database for duplicate uri we got duplicate uri exception.
So, here forest level query did the magic. Forest level query execution option provided us the facility to run query on specific forest to get data to keep in backup location. And similarly during delete operation as well we needed to execute delete query on forest level only.
xdmp:eval helped to achieve this forest level execution of query through available options of xdmp:eval.
Below is the snippet of query that allows execution of query on specific forest.
xquery version "1.0-ml";
declare namespace html = "http://www.w3.org/1999/xhtml";
let $uri:= "/data/test/abc.xml"
let $forest-name := "forest-1"
let $query := 'declare variable $URI as xs:string external;
let $doc := fn:doc($URI)
return
$doc'
let $options := <options xmlns="xdmp:eval">
<database>{xdmp:forest($forest-name)}</database>
</options>
let $results := xdmp:eval($query,(xs:QName("URI"),$uri),$options)
return $results
As in the above code snippet, we are executing fn:doc($URI) operation on a specific forest (i.e. forest-1) using xdmp:eval query by specifying forest in database option of eval options. This allows us to execute script (ex. Script written in $query in above snippet) on specific forest.
So, using this option we were able to keep backup of duplicate uri from specific forest, also able to delete duplicate uri from specific forest to resolve this problem.
If any of you gone through similar problem and found effective solution for this problem than please do share with me. This might help someone who is facing this problem.
So, see you soon, till the time keep exploring keep sharing :)
No comments:
Post a Comment