sapling/eden
Stanislau Hlebik a4b21e589f mononoke: return dummy FilenodesOnlyPublic value if filenodes are disabled
Summary:
In the next diffs we'll make it possible to disable filenodes in Mononoke. See
D21787848 and attached task for more details, but TL;DR is that if xdb is down
we still want to serve "hg update" traffic.

If filenodes are disabled we obviously can't generate filenodes for new
commits. So one option would be to just return an error from
FilenodesOnlyPublic::derive(...) call. But that would mean that any attempt to
call derivation would fail, and e.g. Mononoke servers won't be able to start up
- (see https://fburl.com/diffusion/roau028d). We could change callers to always
process errors from FilenodesOnlyPublic, but I think it would be harder to
enforce and easier to forget.

So this diff changes FilenodesOnlyPublic to be an enum, and
FilenodesOnlyPublic::Disabled is returned immediately if filenodes are
disabled. For callers it means that they can't rely on filenodes being present
in db even after FilenodesOnlyPublic were derived. That's the whole of the
stack, and the next diffs will update the callers to properly deal with missing
filenodes.

One caveat is that when we re-enable filenodes back we might need to derive
them for a lot of commits.
I don't expect it to happen often (i.e. if xdb is down then we probably can't
commit anyway), but if somehow it happened, then we should be a bit more
careful with re-enabling them after the problem was fixed. For example, we can
first derive all the filenodes locally by e.g. running backfill_derived_data,
and only after that has finished successfully we can re-enable them.

Reviewed By: krallin

Differential Revision: D21840328

fbshipit-source-id: ce9594d4a21110a5cb392c3049ccaede064c1e66
2020-06-03 04:21:23 -07:00
..
fs update eden du to look at all mounts by default 2020-06-02 21:12:27 -07:00
integration fix flaky integration tests 2020-05-29 11:49:37 -07:00
locale add a copyright header to glibc_en.po 2019-04-26 14:38:27 -07:00
mononoke mononoke: return dummy FilenodesOnlyPublic value if filenodes are disabled 2020-06-03 04:21:23 -07:00
scm fixcorrupt: remove remaining references 2020-06-02 14:27:04 -07:00
scripts cli: add a startservice.ps1 script 2020-05-19 13:00:54 -07:00
test_support fix a file descriptor leak in the temporary file code 2020-04-28 12:11:51 -07:00
test-data enable treemanifest in snapshots 2019-08-28 18:46:03 -07:00
win add .clang-format 2020-04-28 08:42:03 -07:00
.clang-format Cut FOR_EACH_ENUMERATE 2020-06-01 13:51:19 -07:00
.gitignore eden: wire up mac contbuild 2019-02-05 21:52:30 -08:00
Eden.project.toml Eden.project.toml file for Nuclide 2018-04-26 11:05:23 -07:00