Comments (5)
I don't know about tolerance of hard shutdown during write. In fact, one of the initial design goals was sacrificing some level of tolerance to gain performance - but - only if that tolerance resulted in an unusable database (explicit, not implicit). There is some level of tolerance (write transactions, write block header, write references to map) that if earlier writes fail, it may be recoverable (but not really a goal). No, the database should always shut down cleanly, if not, you should have to re-download the blockchain.
The hot backup is interesting. Because if you can get a snapshot of the database memory mapped files, then you should be able to copy them because technically data is only added. Unlike a LevelDB store, no previous existing data is modified in theory (I'd need to check this assumption).
However I don't know whether this desirable property is worth spending time over, since the blockchain is widely available and duplicatable. If I wanted a backup, I'd run another instance.
from libbitcoin-database.
I took these design goals from some early documentation. This issue is just to caution people who may consider these features of the system.
The hot backup problem is the same problem as hard shutdown. The snapshot may occur in the middle of a write, or after an unflushed write, resulting in inconsistent data.
I have looked at mitigation and I agree that this is not worth trying to "fix". This is a reasonable trade-off for other significant benefits. I do have plans to provide incomplete write detection across restarts. This will mitigate the uncertainty associated with managing the server.
We have had a material number of reported issues from production server hosts (including Airbitz and OpenBazaar) on this issue. Preventing hard shutdown prevents the failures, but it is tedious from a management standpoint. The errors can be delayed for long periods of time, making it currently necessary to rebuild the blockchain database after any uncontrolled shutdown. Practically writes are rare, so this can be significantly improved with detection.
from libbitcoin-database.
Agreed.
from libbitcoin-database.
Master (v3) now includes robust hard shutdown detection, including forced flush at configurable points. This allows a hard shutdown to succeed as long as the write sentinel file is not detected. Similarly a hot backup will succeed as long as a write sentinel does not intervene, although one would have to monitor for the creation of the sentinel during the copy.
from libbitcoin-database.
Version4 splits headers and bodies, and eliminates updates in bodies, so that files are truly append-only. A transactor object is used to isolate writes during hot flush (backup) of headers. Corruption is detected (as in v3) using a flush lock file. Backup and recovery are atomic based on a file system directory rename in each direction. A headers backup can be restored against a set of body files, logically truncating the bodies at the size indicated by the headers. As such a process termination is recoverable to the most recent backup. Backups constitute about 2% of the store size and can be performed while running (which pauses writes).
from libbitcoin-database.
Related Issues (20)
- Make block query asynchronous by tx. HOT 1
- Flush lock slows block out protocol noticeably. HOT 1
- Set file growth rate automatically if configured (default). HOT 1
- array_index is 32 bit, will require expansion. HOT 3
- call end_write before return HOT 1
- History store row allocator requires concurrency guard. HOT 14
- Rename history database to address database. HOT 1
- Hash tables not safe for read while conflict delete.
- Port resolution to issues #150 and #159 to master. HOT 1
- Changes to std::hash template for db keys limits portability. HOT 1
- Primitives require file_offset and array_index type parameterization. HOT 1
- Store tx offset vs. point in address row file. HOT 2
- [master] Header storage exceedingly slow. HOT 2
- Use tx link instead of tx hash for input_point. HOT 2
- Support unconfirmed tx as output spender. HOT 2
- [master] flush_lock must be file-specific for parallel write flushing. HOT 2
- Remove hash from block_database::unindex or check that hash matches HOT 2
- What is the expected behavior for hash_table_multimap::find(Link link) behaviour with non existing link argument? HOT 7
- Add configurable operational file size minimums. HOT 1
- [master] Build warnings. HOT 3
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 libbitcoin-database.