Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Improve handling of RocksDB corruption #7630

Merged
merged 5 commits into from
Jan 19, 2018
Merged

Improve handling of RocksDB corruption #7630

merged 5 commits into from
Jan 19, 2018

Conversation

andresilva
Copy link
Contributor

Fixes #6959.
Maybe fixes #7334.

When writing to RocksDB if it returns a corruption error we create a CORRUPTED file that will trigger a db repair when re-opening the database. Don’t know if the repair process will actually fix the corruption, even if it does it may do so at the cost of losing data and might cause random errors (e.g. we expect some data to exist in the db and it’s not there), if we see any of those in the future we can ask the users if there’s a lost folder in their RocksDB folder which indicates that a DB::Repair was run. Also added detection for corruption like #7623.

@andresilva andresilva added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Jan 19, 2018
@parity-cla-bot
Copy link

It looks like @andresilva signed our Contributor License Agreement. 👍

Many thanks,

Parity Technologies CLA Bot

@andresilva andresilva force-pushed the rocksdb-corruption branch 2 times, most recently from ea5f53f to cef3ddd Compare January 19, 2018 00:31
@5chdn 5chdn added the B0-patch label Jan 19, 2018
@5chdn 5chdn added this to the 1.10 milestone Jan 19, 2018
@debris debris added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jan 19, 2018
@@ -425,7 +454,11 @@ impl Database {
}
}
}
db.write_opt(batch, &self.write_opts)?;

mark_corruption(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename mark_corruption into something like check_for_corruption, otherwise it looks like you're uncondtionnaly marking the db as corrupted here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍

@kirushik kirushik added A6-mustntgrumble 💦 Pull request has areas for improvement. The author need not address them before merging. and removed A8-looksgood 🦄 Pull request is reviewed well. labels Jan 19, 2018
@kirushik kirushik added A8-looksgood 🦄 Pull request is reviewed well. and removed A6-mustntgrumble 💦 Pull request has areas for improvement. The author need not address them before merging. labels Jan 19, 2018
@debris debris merged commit 2af4bd1 into master Jan 19, 2018
@debris debris deleted the rocksdb-corruption branch January 19, 2018 13:33
debris pushed a commit that referenced this pull request Jan 22, 2018
* kvdb-rocksdb: update rust-rocksdb version

* kvdb-rocksdb: mark corruptions and attempt repair on db open

* kvdb-rocksdb: better corruption detection on open

* kvdb-rocksdb: add corruption_file_name const

* kvdb-rocksdb: rename mark_corruption to check_for_corruption
@debris debris mentioned this pull request Jan 22, 2018
debris pushed a commit that referenced this pull request Jan 22, 2018
* kvdb-rocksdb: update rust-rocksdb version

* kvdb-rocksdb: mark corruptions and attempt repair on db open

* kvdb-rocksdb: better corruption detection on open

* kvdb-rocksdb: add corruption_file_name const

* kvdb-rocksdb: rename mark_corruption to check_for_corruption
@debris debris mentioned this pull request Jan 22, 2018
5chdn pushed a commit that referenced this pull request Jan 23, 2018
* Update .gitlab-ci.yml

fix cache:key

* Fixed delegatecall's from/to (#7568)

* Fixed delegatecall's from/to, closes #7166

* added tests for delegatecall traces, #7167

* Fix Temporarily Invalid blocks handling (#7613)

* Handle temporarily invalid blocks in sync.

* Fix tests.

* Improve handling of RocksDB corruption (#7630)

* kvdb-rocksdb: update rust-rocksdb version

* kvdb-rocksdb: mark corruptions and attempt repair on db open

* kvdb-rocksdb: better corruption detection on open

* kvdb-rocksdb: add corruption_file_name const

* kvdb-rocksdb: rename mark_corruption to check_for_corruption
5chdn pushed a commit that referenced this pull request Jan 23, 2018
* Improve handling of RocksDB corruption (#7630)

* kvdb-rocksdb: update rust-rocksdb version

* kvdb-rocksdb: mark corruptions and attempt repair on db open

* kvdb-rocksdb: better corruption detection on open

* kvdb-rocksdb: add corruption_file_name const

* kvdb-rocksdb: rename mark_corruption to check_for_corruption

* Hardening of CSP (#7621)

* Fixed delegatecall's from/to (#7568)

* Fixed delegatecall's from/to, closes #7166

* added tests for delegatecall traces, #7167

* Light client RPCs (#7603)

* Implement registrar.

* Implement eth_getCode

* Don't wait for providers.

* Don't wait for providers.

* Fix linting and wasm tests.

* Problem: AttachedProtocols don't get registered (#7610)

I was investigating issues I am having with Whisper support. I've
enabled Whisper on a custom test network and inserted traces into
Whisper handler implementation (Network<T> and NetworkProtocolHandler
for Network<T>) and I noticed that the handler was never invoked.

After further research on this matter, I found out that
AttachedProtocol's register function does nothing:
https://github.com/paritytech/parity/blob/master/sync/src/api.rs#L172
but there was an implementation originally:
99075ad#diff-5212acb6bcea60e9804ba7b50f6fe6ec and it did the actual
expected logic of registering the protocol in the NetworkService.

However, as of 16d84f8#diff-5212acb6bcea60e9804ba7b50f6fe6ec ("finished
removing ipc") this implementation is gone and only the no-op function
is left.

Which leads me to a conclusion that in fact Whisper's handler never gets
registered in the service and therefore two nodes won't communicate
using it.

Solution: Resurrect original non-empty `AttachedProtocols.register`
implementation

Resolves #7566

* Fix Temporarily Invalid blocks handling (#7613)

* Handle temporarily invalid blocks in sync.

* Fix tests.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
5 participants