Tuesday, 15 March 2016

Configuration Manager

Hello Friends,

Recently I explored a little about Configuration Manager and initially thought that why we need configuration manage while having admin console.

But in recent project development got the requirement of configuration manager specifically and saw that yes it is helpful and have specific requirement.

In one of my project the development team is big and where we have separate roles for database configuration and creation etc. But as we already discussed that when we are working on Mark Logic there are countless situations when you need to access database configuration but every user can not be granted with access to admin console to avoid any mistakenly or intentionally done negative activity.

At that point of time Configuration manager comes into existence which facilitates database administrator to grant access to developer to view database configuration in read only mode or with the specific restrictions.

Mark Logic configuration manager can be access through 8002 port by default at below URL.

http://localhost:8002/nav/?type=databases

Configuration manager provides the facility to access databases, servers, hosts, forests and groups in read only mode however provides a link to specific object management page on admin console as well (if allowed).

Also it allows to view details of entire configuration and linking of database objects together in view only mode.

The most important and usable option facility provided through configuration manager is import/export option which allows to export entire setting and configuration which can be import in another mark logic server instance on requirement basis.

This allows you to create same environment in your local machine or configure dev to stage environment etc.

Definitely there would be some other benefits of configuration manager but I recently come through with above discussed.

Please do share your findings as well about configuration manager so that it will be helpful to get all required details at same place.

Till the time... Keep exploring and keep sharing :)

Tuesday, 8 March 2016

Forest Level Query Execution

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 :)