And a few other thoughts here:

* make sure the trigger is loaded into the database that is specified as the 
triggers database for your content database (if you look at the db config in 
the Admin Interface, you can see what this is set to)
* make sure the XQuery action module is loaded into the database specified in 
the trigger code
* make sure that the user modifying the document has the needed permissions and 
privileges to run your trigger module (a user with the admin role will always 
be able to run anything, but not so for a user without the admin role)

-Danny
________________________________________
From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] On Behalf Of Danny Sokolsky 
[danny.sokol...@marklogic.com]
Sent: Sunday, September 18, 2011 1:53 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] trigger not getting invoked in a clustered 
environment

Here are a few other debugging ideas:

* In your trigger module, put some xdmp:log statements, logging the URI of the 
document being modified, for example (you can use the external variable 
trgr:uri):

http://docs.marklogic.com/4.2doc/docapp.xqy#display.xqy?fname=http://pubs/4.2doc/xml/dev_guide/triggers.xml%2355340

* try creating a hello world trigger, just to make sure you have the mechanics 
correct.
* make sure your log level is at least at debug
* make sure the task server is set to log uncaught exceptions
* try creating a simple cpf pipeline with a hello world trigger--it will do a 
lot more logging of problems then a straight trigger.
* make sure your trigger is the right data event for what you are doing.  You 
might need to create 2 triggers, 1 for "modify" and one for "create" that point 
to the same action (in case you want the same action when a document is created 
and when it is updated).
* if you find yourself creating a framework to manage your triggers, consider 
using CPF, as that is what it does, and that can be quite complex to write 
yourself, especially for post-commit triggers.

Triggers can be tricky to debug because the actions run in the task server, but 
with a little persistence, you can usually figure out what is going on.

-Danny
________________________________________
From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] On Behalf Of Raghu 
[raghupathy.visweswa...@gmail.com]
Sent: Sunday, September 18, 2011 11:04 AM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] trigger not getting invoked in a clustered 
environment

Hi Danny,

   Thanks once again. I'm not using any content processing framework. Its just 
an xquery. I don't have the luxury of adding  nodes. Any ways it isn't throwing 
up any errors in the logs that is what is keeping me guessing.I will let you 
know if I find something interesting!

Thanks
Raghu

On Sun, Sep 18, 2011 at 3:54 AM, Danny Sokolsky 
<danny.sokol...@marklogic.com<mailto:danny.sokol...@marklogic.com>> wrote:
Raghu,

When you say it works in a single host, but not in a clustered environment, 
let's drill down into what has changed in your scenario.   See if you can find 
the error you are getting when it is not invoking the module.  That might 
provide a clue as to what is not working.  Here is what I would try:

1) Set up a single node cluster and ensure it is working.
2) Add another node to that same cluster and see if it still works against the 
host that it originally worked on.
3) Then try the same test using the other host as the e-node (that is, by 
executing the triggering query against the other node).

That will allow you to debug it.  If your code is in the modules database, then 
it should be accessible from anywhere in the cluster.  If, however, you have 
placed your code under the Modules directory, then you would need to duplicate 
that code in each node in the cluster.

Beyond the code being accessible from each host, I can't think of a particular 
setting that would cause it not to work on one host.  Something perhaps is 
different between your hosts that you have yet to discover.

Once again, if you are using cpf, then there are a few more dubugging 
alternatives.

-Danny
________________________________________
From: 
general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>
 
[general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>]
 On Behalf Of Raghu 
[raghupathy.visweswa...@gmail.com<mailto:raghupathy.visweswa...@gmail.com>]
Sent: Saturday, September 17, 2011 10:41 AM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] trigger not getting invoked in a clustered 
environment

HI Danny,

            Thanks. I've ensured that everything is in place. The same trigger 
works fine in a single host but in a clustered environment it   isn't invoking 
the module. Is there any setting which might cause this kind of behavior?

Thanks
Raghu

On Fri, Sep 16, 2011 at 9:48 PM, Danny Sokolsky 
<danny.sokol...@marklogic.com<mailto:danny.sokol...@marklogic.com><mailto:danny.sokol...@marklogic.com<mailto:danny.sokol...@marklogic.com>>>
 wrote:
Hi Raghu,

Is your trigger module (/userdir/modules/xquery/migrate-helper.xqy based on the 
trigger create code you showed) loaded into the database names "Modules".  To 
check that, run (in cq for example):


fn:doc("/userdir/modules/xquery/migrate-helper.xqy ")


against the Modules database.  It should return the text of the module.


Assuming you are using CPF, in the document that is not being triggered, take a 
look at the properties:


xdmp:document-properties($uri)


where $uri is the URI of the document that did not get updated.

Those are some places to start.

-Danny

From: 
general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com><mailto:general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 
[mailto:general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com><mailto:general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>]
 On Behalf Of Raghu
Sent: Friday, September 16, 2011 5:58 AM
To: General MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] trigger not getting invoked in a clustered 
environment

Hi All,

     I'm having a migrator xquery which I need to invoke when a user does an 
operation and so I've used a trigger on the user's directory with infinity as 
depth. It is working fine in normal environment but it isn't invoking the 
migrator query in a clustered environment. Can somebody help me out?

PFB the trigger

import module namespace trgr="http://marklogic.com/xdmp/triggers";
at "/MarkLogic/triggers.xqy";
trgr:create-trigger("migrate folders", "migrate folders",
trgr:trigger-data-event(
trgr:directory-scope("/userdir/1234/", "infinity"),
trgr:document-content("modify"),
trgr:post-commit()),
trgr:trigger-module(xdmp:database("Modules"), "/userdir/modules/xquery/", 
"migrate-helper.xqy"),
fn:true(), xdmp:default-permissions())



Thanks in advance
Raghu

_______________________________________________
General mailing list
General@developer.marklogic.com<mailto:General@developer.marklogic.com><mailto:General@developer.marklogic.com<mailto:General@developer.marklogic.com>>
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
General@developer.marklogic.com<mailto:General@developer.marklogic.com>
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to