Comments (10)
Yes, you are right. I should have read it more carefully. I think your observations are correct:
- Not every RedisServerException is a migration problem.
- Transactions are useless here.
- Delete should not be used.
- For migrations the key should just be overriden.
from orleans.redis.
Also lua script for write command should be loaded again to Redis server when RedisServerException with NOSCRIPT message is received.
The script cache is cleared when Redis server restarts. Lua script for write operation is initialized only in RedisGrainStorage.Init function. This means that application using this library is throwing RedisServerException with NOSCRIPT message until it is also restarted, because RedisGrainStorage.Init is only called when application starts.
Eval command documentation mentions that script cache is cleared in restart:
https://redis.io/commands/eval
Article that explains this issue:
http://www.wjwh.eu/posts/2020-06-15-redis-eval-trick.html
from orleans.redis.
Here is a graph that shows redis key count and how keys are deleted gradually after reboot.
from orleans.redis.
I think this is the default for redis. You have to turn on disk persistence
from orleans.redis.
We have configured RDB persistence for Redis server and also tested that data is restored from snapshot after reboot. If the persistence didn't work we should have lost all keys immediately when server was rebooted. Now keys were deleted gradually after reboot. I'm quite sure that the migration code in RedisGrainStorage.WriteStateAsync function is deleting keys from Redis server.
from orleans.redis.
Are you able to take a look at fixing this, @jarkkojasberg?
from orleans.redis.
@ReubenBond I have been quite busy lately, I can't promise fixing this anytime soon.
from orleans.redis.
Recently our team encountered same issue with permanent receival of exception as @jarkkojasberg mentioned in 1st post until Orleans silo was restarted. Most probably the reason was Redis server restart too (I didn't perform a deep investigation). We have .RDB persistence enabled too. Fortunately, this was a test environment.
May be I will be able to prepare suggested fix. But I did not see any contributing guidelines in this repo. If there are any, please let me know.
from orleans.redis.
Hello again,
As our team uses Orleans in production and we possibly will migrate some grains from ADO.NET/EF storage to Redis next year, we want to be sure in stable work of RedisGrainStorage
. So one of my colleagues is going to fix this bug.
After discussion with him I've checked the code in RedisGrainStorage
more carefully. It seems that migration logic from WriteStateAsync()
can be safely removed because of 2 reasons:
- Every grain at first reads state from storage. So if migration needed, it would be already performed during
ReadStateAsync()
call. - Migration logic in
WriteStateAsync()
, if executed, actually would fail. It uses the same Lua script as regularWriteStateAsync()
operation. This script uses HGET command to retrieve Palyload and ETag. But for old grain storage format HGET would throw (something like "(error) ERR Error running script (call to f_6b1bf486c81ceb7edf3c093f4c48582e38c0e791): ERR Operation against a key holding the wrong kind of value").
So, as part of the bugfix, we are going just to remove migration logic from WriteStateAsync()
.
@ReubenBond @SebastianStehle are you OK with that?
from orleans.redis.
It seems that migration logic from
WriteStateAsync()
can be safely removed
Well, actually after deletion of migration logic from WriteStateAsync()
one test failed. So I decided to fix migration logic in WriteStateAsync()
- do not use Lua script but execute same commands within transaction as migration in ReadStateAsync()
does.
BTW:
Yes, you are right. I should have read it more carefully. I think your observations are correct:
- Not every RedisServerException is a migration problem.
- Transactions are useless here.
- Delete should not be used.
- For migrations the key should just be overriden.
Actually delete MUST be used, because string key in Redis cannot be overwritten by hash. So IMHO it is OK to stick with transactions as of now (other option is to switch to another Lua scripts, but it will bring additional complexity related with handling of NOSCRIPT errors, etc.).
What about 1st point - "Not every RedisServerException is a migration problem." - I've added some checks to decide whether migration is required.
from orleans.redis.
Related Issues (17)
- JSON deserialization of grain states does not bind GrainReferences to runtime HOT 4
- Redis Streaming HOT 1
- Could not find a membership entry for this silo HOT 12
- Does not work with Co-Hosting HOT 2
- Redis Clustering in Docker Swarm, Silo's wont find each other HOT 2
- RedisGrainStorage.ReadStateAsync() should use Array.Length instead of Linq.Enumerable.Count()
- GrainReference not deleted from redis HOT 1
- FLUSHALL required between running different code HOT 1
- [Question] Can it be used on ISiloBuilder? HOT 1
- [Question] intention of redis key format (ServiceId/ClusterId)
- Regular null reference exceptions HOT 1
- Grain multiple states HOT 1
- Orleans 4.0 compatibility
- Unable to resolve service for type Orleans.Runtime.IPersistentState HOT 3
- 'ISiloBuilder' does not contain a definition for 'AddRedisGrainStorage' HOT 5
- Cannot link redis with password HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orleans.redis.