Dispose Trigger: Put attempted on document concurrently - Scripted Index

42 views
Skip to first unread message

Carlos Mendes

unread,
Sep 14, 2014, 10:20:16 PM9/14/14
to rav...@googlegroups.com
Hi, 

I'm using a Scripted Index and getting some errors:

Action: Dispose Trigger, Error: "Put attempted on document X concurrently" errors.

Any ideas? I'm not sure what can be done since here we don't control the concurrency model.

Thanks in advance



Oren Eini (Ayende Rahien)

unread,
Sep 15, 2014, 1:13:49 AM9/15/14
to ravendb
Basically, the issue is that you are modifying the document while it is trying to write the changes from the scripted index.
That is expected, a document should have just one reason to change. In this case, it means that you have to avoid writing to documents created by scripted index, or accept that this is possible.



Oren Eini

CEO


Mobile: + 972-52-548-6969

Office:  + 972-4-622-7811

Fax:      + 972-153-4622-7811




--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carlos Mendes

unread,
Sep 15, 2014, 6:18:33 AM9/15/14
to rav...@googlegroups.com
Hi Ayende,

We are storing a Statistics document for some of our entities:

E.g.: entity/1/statistics

{

"Shares": 0,

"Votes": 0,

"Comments": 15,

"Score": 0,

"Trending": 0,

"Views": 542

}


- Score and Trending are calculated by a Scripted Index.

- Comments and Votes are updated by another Scripted Index.

- Views and Shares are stored in PostgreSQL and updated outside RavenDB, using two different background jobs through the Patching API.


If I understood your comment this is a big no-no…!


My understanding is that there’s no recovery when a Scripted Index update fails due to concurrency errors. So, do we need to keep 4 different statistics documents for each entity?

One to update Score and Trending (first Scripted Index), another for Comments and Votes (second Scripted Index), a third one to store the Views and a fourth one to store the Shares?

Thanks

Carlos Mendes

unread,
Sep 15, 2014, 8:25:24 PM9/15/14
to rav...@googlegroups.com
Ayende, 

I know that I'm not seeing the complete picture but if we had Patching in Scripted Indexes would that help?

Oren Eini (Ayende Rahien)

unread,
Sep 16, 2014, 12:31:45 AM9/16/14
to ravendb
Probably, it would at least give us a way to handle this.




Oren Eini

CEO


Mobile: + 972-52-548-6969

Office:  + 972-4-622-7811

Fax:      + 972-153-4622-7811




Carlos Mendes

unread,
Sep 20, 2014, 5:38:54 PM9/20/14
to rav...@googlegroups.com
Ayende,

Is there a way to log this as a feature suggestion?

Thanks

Kijana Woodard

unread,
Sep 20, 2014, 5:59:18 PM9/20/14
to rav...@googlegroups.com
The best way would to send a pull request. :-D

You try the issue tracker:

Carlos Mendes

unread,
Sep 20, 2014, 7:25:10 PM9/20/14
to rav...@googlegroups.com
I would... but I'm afraid that something like this would take me a month.

For now, I will log it in the issue tracker as a feature suggestion.

Thks
Reply all
Reply to author
Forward
0 new messages