Giter Site home page Giter Site logo

Clarification on transactionality about tape HOT 2 CLOSED

square avatar square commented on July 28, 2024
Clarification on transactionality

from tape.

Comments (2)

f2prateek avatar f2prateek commented on July 28, 2024

fsync (or opening it in rwd mode) doesn't guarantee atomicity, it only guarantees that the data has been written to the file when it returns.

Consider the case when you write a 1MB of data into a file and call fsync, the file system will typically break it down into chunks and writes it to the file one chunk at a time. If an exceptional failure (such as a power failure, process death or system crashes) happens during this, some chunks may have not been written yet.

However, if the file system guarantees atomic segment writes, it assures that as long as you write data smaller than the size of a segment, it's all or nothing operation, even during exceptional failures.

By designing the header to be smaller than the size of a segment, QueueFile can ensure that writing the header (which is much smaller than the size of a segment) is atomic. Even during exceptional failures, the mutating change will simply be aborted since the header isn't changed at all. If the file system doesn't guarantee atomic segment writes, then the header may be written only partially and leave the QueueFile in an invalid state.

from tape.

epsstan avatar epsstan commented on July 28, 2024

Makes sense. Thanks for clarifying.

from tape.

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.