NRediSearch icon indicating copy to clipboard operation
NRediSearch copied to clipboard

Unable to cast from Raw to long: 'QUEUED' when delete document with 'MULTI'

Open hizliemre opened this issue 6 years ago • 9 comments

When i want delete my documents in MULTI - EXEC blocks is raised this error : Unable to cast from Raw to long: 'QUEUED' in NRedisearch

hizliemre avatar Sep 11 '20 13:09 hizliemre

I fixed my issue with run 'FT.DEL' command manually.

hizliemre avatar Sep 11 '20 14:09 hizliemre

Hi; I'm glad you got a workaround, but is there a minimal repro for what you had originally? That sounds very odd... I'd be very curious about seeing the original code.

On Fri, 11 Sep 2020, 14:46 Emre Hızlı, [email protected] wrote:

When i want delete my documents in MULTI - EXEC blocks is raised this error : Unable to cast from Raw to long: 'QUEUED'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/1569, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEHMAJ64H3FBEPB5MAMYTSFIS2LANCNFSM4RHQWJGA .

mgravell avatar Sep 11 '20 21:09 mgravell

My code's summary is like this;

db.Execute("MULTI"); client.DeleteDocument(doc); db.Execute("EXEC");

this delete command returns 'QUEUED'. But you are try convert to long the result. We need queued delete commands and harvest results after 'EXEC'

hizliemre avatar Sep 12 '20 11:09 hizliemre

K, basically: don't do that. At the moment, SE-Redis is based on a multiplexer implementation, meaning that it is designed such that concurrent callers share the same physical connection. If you start issuing MULTI/EXEC, you have extremely undefined behavior.

There is a managed transaction API for MULTI/EXEC usage - not at a PC, but I want to say "create transaction" or "begin transaction". Use those instead of issuing your own MULTI

mgravell avatar Sep 13 '20 11:09 mgravell

Thank you for your advice. But i couldn't use se-redis transaction api with nredisearch. Can u show an example for me?

hizliemre avatar Sep 13 '20 11:09 hizliemre

Indeed, NRediSearch is not designed with transactions in mind. I'd love to discuss more of what you're actually trying to do here, so that we can see whether this is a problematic gap or not.

Forgetting about implementation details: what is it that you're trying to do atomically here?

On Sun, 13 Sep 2020, 12:21 Emre Hızlı, [email protected] wrote:

Thank you for your advice. But i couldn't use se-redis transaction api with nredisearch. Can u show an example for me?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/1569#issuecomment-691658579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEHMFWM6BL5E3IPW7LF2TSFSTLZANCNFSM4RHQWJGA .

mgravell avatar Sep 13 '20 11:09 mgravell

Thinking aloud: most simple operations should theoretically work fine if they use the async API (which is up to the caller) and we can inject the transaction context into the client (which should just be a constructor thing). So it isn't insurmountable - I just want to make sure I understand the use case.

On Sun, 13 Sep 2020, 12:29 Marc Gravell, [email protected] wrote:

Indeed, NRediSearch is not designed with transactions in mind. I'd love to discuss more of what you're actually trying to do here, so that we can see whether this is a problematic gap or not.

Forgetting about implementation details: what is it that you're trying to do atomically here?

On Sun, 13 Sep 2020, 12:21 Emre Hızlı, [email protected] wrote:

Thank you for your advice. But i couldn't use se-redis transaction api with nredisearch. Can u show an example for me?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/1569#issuecomment-691658579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEHMFWM6BL5E3IPW7LF2TSFSTLZANCNFSM4RHQWJGA .

mgravell avatar Sep 13 '20 11:09 mgravell

I am trying write an orm similar entityframework over nredisearch (without relations). so i tried implement begintransaction and committransaction. You can check my context codes here : redisworkcore.

I have to remove this feature as i understand it from your advices. Is it right?

hizliemre avatar Sep 13 '20 17:09 hizliemre

I'm not saying it can't be done. I'm saying we might need some minor construction changes. Let me review what you have and I'll get back to you.

On Sun, 13 Sep 2020, 18:56 Emre Hızlı, [email protected] wrote:

I am trying write an orm similar entityframework over nredisearch. so i tried implement begintransaction and committransaction. You can check my context codes here : https://github.com/hizliemre/redisworkcore/blob/master/RedisworkCore/RedisContext.cs http://redisworkcore.

I have to remove this feature as i understand it from your advices. Is it right?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/StackExchange/StackExchange.Redis/issues/1569#issuecomment-691703073, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEHMA6EVWM5FJKPTY5LRDSFUBWRANCNFSM4RHQWJGA .

mgravell avatar Sep 13 '20 18:09 mgravell