Comments (4)
For other users: in the meantime a workaround would be to create a checkpoint manually after opening the db, though it'd be best to optimise this so you only create the checkpoint if the db didn't exist previously.
from acid-state.
I think this is a subtly important issue. Since transactions need to be pure, the only way to do things like, say, UUID-4, is to put a seed in the initial state. Now if you don't checkpoint all your IDs will change every time you replay the transaction log (ie. restart your application), assuming you randomize the initial seed.
from acid-state.
Agreed. Will fix this in the next iteration.
from acid-state.
I just bumped into this issue again, but now in regards to migrations. With complex migrations it's sometimes useful to insert a flag into the state and then in the application logic check that flag and perform some complex one off transaction. So suppose we originally had:
data OurState = OurState { theRealData :: Map This That }
And now we introduce this new flag
data OurState = OurState { theRealData :: Map This That, doneTheTrickyMigration :: Bool }
Obviously the safe-copy migration will set this flag to be False, but now what do we use for the initialOurState
value we use for openLocalState
? We would want in newly created dbs for it to be True, but if we do use:
initialOurState = OurState Map.empty True
then when there's no checkpoint yet we would end up with the flag being True which is obviously wrong. This can be even worse if some of the transactions themselves need to consult the flag.
The basic problem is that by changing the initialOurState
value we're actually changing the past; changing the initial state on which we replay all the old transactions. So for correctness, a newly initialised acid state component really must create a checkpoint with that original initial value, so that it's not affected by subsequent code changes to the initial value for new dbs.
from acid-state.
Related Issues (20)
- Get size of acid-state? HOT 3
- Failed to build acid-state-0.15.1 HOT 8
- acid-state fails to build with GHC 8.8.1 HOT 1
- Changelog entry for 0.16 is missing HOT 1
- Test suite fails on macOS HOT 8
- build fails on ghc 9.0.1 HOT 1
- Hackage release needed for GHC 9.0.2 support HOT 2
- Benchmark `loading-benchmark` fails to build with GHC 7.10 HOT 3
- GHC versions covered by AppVeyor CI HOT 3
- acid-state on cluster HOT 1
- Haddocks for Data.Acid.Memory.Pure.AcidState are misleading HOT 1
- Database seems empty after ctrl+c HOT 4
- Build failures with mtl-2.3
- Support GHC 9.4 HOT 1
- README: possibly outdated irc link
- Build failure with unix-2.8 (GHC 9.6)
- Support GHC 9.6
- Build failure with template-haskell-2.21 (GHC 9.8)
- Benchmarks fail to build on GHC 9.8 due to `system-filepath`
- Unnecessary use of strict bytestrings in Data.Acid.Log 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 acid-state.