Comments (2)
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.
Makes sense. Thanks for clarifying.
from tape.
Related Issues (20)
- Is it thread safe? HOT 3
- Android module for android specific logic HOT 2
- A question about the evolution of this repository HOT 1
- Read/Write Benchmarks HOT 1
- Application not responding after adding an entry to the queue HOT 2
- Batched remove() - Using remove() less frequently than peek() HOT 6
- Remove java.io.OutputStream and the like from API?
- BlockingQueue implementation and other interfaces HOT 5
- Wrap QueueFile around an existing File? HOT 6
- Support addAll(Collection<byte[]>) for better performance with small records HOT 2
- Windows non-sync writes HOT 1
- Fail to read queue.
- Leak of file descriptor when creating QueueFile from corrupted queue file. HOT 1
- Not compatible with Gradle 5.1.1 HOT 6
- Why so slow?
- QueueFileTest.testSaturatedFileExpansionMovesElements hanged HOT 3
- Issues while writing and reading from different daemons with flock
- Consider DequeFile HOT 1
- Fail to Remove from FileObjectQueue
- Time to mark as deprecated? HOT 6
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 tape.