Giter Club home page Giter Club logo

Comments (6)

meteficha avatar meteficha commented on June 15, 2024

IIUC, currently acid-state will refuse to start if the log is corrupt. So going the Redis way of fsyncing every second seems a bad idea.

I like the option of continuing user code before data is written to the disk. It looked like scheduleUpdate could help me here but it doesn't work for my use case: a query after a scheduleUpdate may not see the update at all. What I wanted was for querys to see the updated state but to avoid waiting the update to be flushed to the disk.

from acid-state.

lemmih avatar lemmih commented on June 15, 2024

We could add a 'reallyUnsafeUpdate' function which would make the result immediately available without waiting for serialization. This wouldn't work for the Remote backend, obviously. And God have mercy on your soul (and your data) if you use the function carelessly.

from acid-state.

meteficha avatar meteficha commented on June 15, 2024

Well, it's not "really unsafe", depends on the context.

My test code above implements a storage backend for server-side sessions. On most websites it will be no big deal if the session data from the last few seconds is lost forever. However, adding hundreds on milliseconds per request due to fsync is a big no.

What about, instead of providing a different update function, adding an option that could be set when opening the Local backend? The option could be named "really unsafe" without hurting the legibility of every bit of code that updates something.

from acid-state.

lemmih avatar lemmih commented on June 15, 2024

Permanently losing data doesn't qualify as "really unsafe"? I hope you're not working in banking. :)

I would be willing to downgrade it from "reallyUnsafe" to just "unsafe". At first I was against adding an option to make this behavior the default but actually that's the only approach that makes sense. An 'unsafeUpdate' function would taint your entire application, not just the thread that used it. So, we want an option for the Local backend to return results immediately without waiting for fsync, and we want a 'waitUntilMyDataIsSafe :: AcidState -> IO ()' function as well.

from acid-state.

meteficha avatar meteficha commented on June 15, 2024

Well, even on banking I imagine losing session data would be harmless. You could log out some logged in users, or forget that some users had asked to be logged out. Doesn't look that bad :).

from acid-state.

meteficha avatar meteficha commented on June 15, 2024

BTW, I like your suggestion.

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.