Behavior of subscription batch session

17 views
Skip to first unread message

Georgios Diamantopoulos

unread,
Nov 26, 2021, 6:13:19 AM11/26/21
to RavenDB - an awesome database
Hi!

Could someone kindly elaborate on the behavior of the subscription batch session vs a regular one?

I am opening a session from the batch object to process each item so I can call SaveChanges and isolate changes per item in case of failure.

However, I am seeing a "blittable object has been disposed" exception when the batch contains more than one item.

Can you clarify on the differences and best practices?

I guess at the very least I should only dispose after processing the whole batch?

Thanks
Georgios

Igal Merhavia

unread,
Nov 28, 2021, 4:01:13 AM11/28/21
to rav...@googlegroups.com
Hi,

Can you elaborate?
What do you mean by "regular"?

Best regards,
Igal

--
You received this message because you are subscribed to the Google Groups "RavenDB - an awesome database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ravendb/6307e519-1afe-4518-a0de-a09fb88da6c1n%40googlegroups.com.

Georgios Diamantopoulos

unread,
Nov 28, 2021, 4:25:44 AM11/28/21
to ravendb
Is there a difference between store.OpenSession() and subscriptionBatch.OpenSession()?

I am getting the object disposed exception in a subscription that receives multiple items to process vs ones where I have MaxDocsPerBatch = 1

Before I go looking for bugs, is there a reason why this would be happening?


You received this message because you are subscribed to a topic in the Google Groups "RavenDB - an awesome database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/Z5p_xxEN4jk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ravendb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ravendb/CAADcGS%3DNgV1cwAxU8RZ1txD6XsqsgtLrfc%3DdQvvgTeJ0vGMfBQ%40mail.gmail.com.

Igal Merhavia

unread,
Nov 28, 2021, 5:05:32 AM11/28/21
to rav...@googlegroups.com
Hi,

I am not familiar with your code so it is really hard to say.
But basically the answer is no.
They are the same.
All we do is to register the documents from the subscription to that session but we use regular session.

Best regards,
Igal

Georgios Diamantopoulos

unread,
Nov 28, 2021, 5:23:09 AM11/28/21
to ravendb
Thank you - that's what I wanted to know.

I will see if I can reproduce an issue and revert.

Oren Eini (Ayende Rahien)

unread,
Dec 5, 2021, 5:51:30 AM12/5/21
to rav...@googlegroups.com
To clarify, there are actually two important factors with the session for the batch.

a) All the documents that were loaded in the subscription batch are already loaded into it, so you won't make extra calls, it will handle change tracking, etc.
b) The session will use the _same_ node as the subscription source to write the changes. Even if the actual primary for the database is different.



--
Oren Eini
CEO   /   Hibernating Rhinos LTD
Skype:  ayenderahien
Support:  sup...@ravendb.net
  
Reply all
Reply to author
Forward
0 new messages