GithubHelp home page GithubHelp logo

Comments (4)

dcoutts avatar dcoutts commented on May 25, 2024

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.

dag avatar dag commented on May 25, 2024

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.

lemmih avatar lemmih commented on May 25, 2024

Agreed. Will fix this in the next iteration.

from acid-state.

dcoutts avatar dcoutts commented on May 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.