[cache_restore] The metadata version and clean shutdown flags were

swapped.

Reveal by failing --omit-clean-shutdown test
This commit is contained in:
Joe Thornber 2017-08-29 12:33:32 +01:00
parent 61d747b246
commit 4da8d19f29
3 changed files with 12 additions and 5 deletions

View File

@ -60,8 +60,9 @@ namespace {
try { try {
block_manager<>::ptr bm = open_bm(*fs.output, block_manager<>::READ_WRITE); block_manager<>::ptr bm = open_bm(*fs.output, block_manager<>::READ_WRITE);
metadata::ptr md(new metadata(bm, metadata::CREATE)); metadata::ptr md(new metadata(bm, metadata::CREATE));
emitter::ptr restorer = create_restore_emitter(md, fs.clean_shutdown, emitter::ptr restorer = create_restore_emitter(md,
fs.metadata_version); fs.metadata_version,
fs.clean_shutdown ? CLEAN_SHUTDOWN : NO_CLEAN_SHUTDOWN);
check_file_exists(*fs.input); check_file_exists(*fs.input);
ifstream in(fs.input->c_str(), ifstream::in); ifstream in(fs.input->c_str(), ifstream::in);

View File

@ -115,9 +115,9 @@ namespace {
emitter::ptr emitter::ptr
caching::create_restore_emitter(metadata::ptr md, unsigned metadata_version, caching::create_restore_emitter(metadata::ptr md, unsigned metadata_version,
bool clean_shutdown) shutdown_type st)
{ {
return emitter::ptr(new restorer(md, clean_shutdown, metadata_version)); return emitter::ptr(new restorer(md, st == CLEAN_SHUTDOWN, metadata_version));
} }
//---------------------------------------------------------------- //----------------------------------------------------------------

View File

@ -7,9 +7,15 @@
//---------------------------------------------------------------- //----------------------------------------------------------------
namespace caching { namespace caching {
enum shutdown_type {
CLEAN_SHUTDOWN,
NO_CLEAN_SHUTDOWN
};
emitter::ptr create_restore_emitter(metadata::ptr md, emitter::ptr create_restore_emitter(metadata::ptr md,
unsigned metadata_version, unsigned metadata_version,
bool clean_shutdown = true); shutdown_type st = CLEAN_SHUTDOWN);
} }
//---------------------------------------------------------------- //----------------------------------------------------------------