0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::db: Workaround allow_fallocate options issue.

This commit is contained in:
Jason Volk 2018-12-03 14:28:49 -08:00
parent 0250c0f2ec
commit 760bd0f19c

View file

@ -4426,6 +4426,15 @@ try
name
};
#endif
// Workaround a RocksDB bug which doesn't propagate EnvOptions properly
// on some constructions of WritableFile early on during db open. We'll
// get an env_opts.allow_fallocate==true here while it should be false
// from the DBOptions at d->opts. We use &= so it's not set to true when
// the caller specifically wants it false just for them.
assert(d && d->opts);
this->env_opts.allow_fallocate &= d->opts->allow_fallocate;
//assert(env_opts.allow_fallocate == d->opts->allow_fallocate);
}
catch(const std::exception &e)
{
@ -4954,6 +4963,9 @@ noexcept try
};
#endif
if(!env_opts.allow_fallocate)
return Status::NotSupported();
_allocate(offset, length);
return Status::OK();
}
@ -5073,6 +5085,10 @@ ircd::db::database::env::writable_file::_allocate(const size_t &offset,
};
#endif
assert(env_opts.allow_fallocate);
assert(bool(d.opts));
assert(d.opts->allow_fallocate);
fs::allocate(fd, allocate_length, wopts);
this->preallocation_last_block = last_block;
}