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:
parent
0250c0f2ec
commit
760bd0f19c
1 changed files with 16 additions and 0 deletions
16
ircd/db.cc
16
ircd/db.cc
|
@ -4426,6 +4426,15 @@ try
|
||||||
name
|
name
|
||||||
};
|
};
|
||||||
#endif
|
#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)
|
catch(const std::exception &e)
|
||||||
{
|
{
|
||||||
|
@ -4954,6 +4963,9 @@ noexcept try
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(!env_opts.allow_fallocate)
|
||||||
|
return Status::NotSupported();
|
||||||
|
|
||||||
_allocate(offset, length);
|
_allocate(offset, length);
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
@ -5073,6 +5085,10 @@ ircd::db::database::env::writable_file::_allocate(const size_t &offset,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
assert(env_opts.allow_fallocate);
|
||||||
|
assert(bool(d.opts));
|
||||||
|
assert(d.opts->allow_fallocate);
|
||||||
|
|
||||||
fs::allocate(fd, allocate_length, wopts);
|
fs::allocate(fd, allocate_length, wopts);
|
||||||
this->preallocation_last_block = last_block;
|
this->preallocation_last_block = last_block;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue