forked from apache/kudu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
log_block_manager: fix corruption after re-opening compacted metadata
This fixes an issue discovered on a cluster due to the following sequence of events: - a block manager compacts a metadata file while starting up - when it reopens the metadata file after replacing it with the compacted one, it gets a file_cache hit. Thus, the WritablePBContainer continues to write to the _deleted_ file instead of the compacted one. Metadata entries at this point are lost (which could cause block loss in the case of lost CREATE records, or dangling blocks in the case of lost DELETEs) - if the server continues to run for a while, the FD will be evicted from the cache and eventually re-opened. At that point, a further DELETE record could end up writing to an offset past the end of the file, since the write offset was incremented by the "lost" records above. - on the next restart, the metadata file would have a "gap" of zero bytes, which would surface as a checksum failure and failure to start up. The fix is relatively simple: when we replace the metadata file we need to invalidate and evict the cache entry so that when we "reopen", it actually starts appending to the _new_ file and not the old deleted one. The bulk of the changes here are to tests: - the stress test now enforces a minimum number of live blocks before it starts deleting them. It also more aggressively compacts, and has a smaller cache. With these changes, I was sometimes able to reproduce the issue. - A more targeted test issues a canned sequence of block creations and deletions that can reliably reproduce the above issue. Change-Id: I14b2c64685e24d27591258911db4aeb9e8020a4d Reviewed-on: http://gerrit.cloudera.org:8080/7113 Reviewed-by: Adar Dembo <[email protected]> Tested-by: Kudu Jenkins
- Loading branch information
1 parent
8be2a59
commit e77538b
Showing
6 changed files
with
218 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.