StackExchange / NRediSearch

Other
31 stars 9 forks source link

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

Open hizliemre opened 4 years ago

hizliemre commented 4 years ago

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 commented 4 years ago

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

mgravell commented 4 years ago

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ı, notifications@github.com 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 .

hizliemre commented 4 years ago

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'

mgravell commented 4 years ago

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

hizliemre commented 4 years ago

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

mgravell commented 4 years ago

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ı, notifications@github.com 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 commented 4 years ago

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, marc.gravell@gmail.com 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ı, notifications@github.com 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 .

hizliemre commented 4 years ago

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?

mgravell commented 4 years ago

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ı, notifications@github.com 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 .