Commit Graph

20295 Commits

Author SHA1 Message Date
Mateusz Kwapich
35d04fb79f add --no-merge flag
Summary:
This flag allows the repo import to progress through all the steps
but bail before actually merging in the repos.

Currently the repo_import tool is so slow that all the pre-merge steps
can take hours. This makes it really hard to control when the actual merge
commit will happen. This flag will allow us to prepare all those steps
ahead-of-time and then resume with just merge in mind.

I don't think it's a proper long-term fix but I found it useful when working
wath whatsapp/biz and would use it again util we properly optimize repo_import
tool.

Differential Revision: D46802952

fbshipit-source-id: 2e8185482c4ba9c04fed20013efcc80d75e80bad
2023-06-22 10:31:22 -07:00
Zhaolong Zhu
0d05f5fcdb tests: fix test-sparse-merges.t by disable rust status
Summary:
D45510982 enabled rust status for debugruntest, but this test is not
ready yet. This diff disable rust status explicitly in the test.

Reviewed By: quark-zju

Differential Revision: D46938285

fbshipit-source-id: b9cb514d8721328a65ac88229aeff8f85dbaf922
2023-06-22 09:43:50 -07:00
Egor Tkachenko
6daec5ad8d non-oss work 84/n
Differential Revision: D46901370

fbshipit-source-id: 45e8549191975ba143194e0de32f3c3948ebb36f
2023-06-22 07:46:20 -07:00
Egor Tkachenko
cd679ea8ec non-oss work 83/n
Differential Revision: D46860120

fbshipit-source-id: 21a71f785bc2261db654b0f72890668c12c3d30b
2023-06-22 07:46:20 -07:00
Haitao Mei
773bd915e7 new admin tool unlink keys after doing a sanitising check
Summary: This diff allows the new admin tool to double check if the key is really we wanted to delete, before doing the actual deletion.

Reviewed By: mitrandir77

Differential Revision: D46901306

fbshipit-source-id: 58904c5272d22b696dd22b3c83a9caf33fa3a0b2
2023-06-22 02:16:25 -07:00
Mateusz Kwapich
c79fc047d3 improve repo_create_commit docs
Summary:
Similarly named method in scmquery pushes commits onto some branch.
Let's make the description very clear.

Reviewed By: malmond77

Differential Revision: D46916234

fbshipit-source-id: 6137f42df97be80fff2775638f766f05c1113488
2023-06-21 18:33:21 -07:00
Jun Wu
43e78592f0 udsipc: add a simple connection pool
Summary:
Add "connection pool" logic that emulates a pool using a directory.
This can be useful on Windows where `fork()` is unavailable.

Reviewed By: zzl0

Differential Revision: D46885307

fbshipit-source-id: 26c85f6836fc7a9437ccaef0aaf4a7f0a6e8561f
2023-06-21 14:49:59 -07:00
Jun Wu
788c7c9f2a udsipc: integration with nodeipc
Summary:
Provide APIs to obtain the `NodeIpc` instance instead of raw sockets.
This makes it possible to use `NodeIpc` features like sending the
file descriptors, node channel, etc.

Reviewed By: muirdm

Differential Revision: D46812533

fbshipit-source-id: 7b3d51a6027c9dbacffcf74476f9b8a4a3440313
2023-06-21 14:49:59 -07:00
Jun Wu
00d183b934 udsipc: crate for unix-domain-socket communication
Summary:
Add a crate to make it easier to use UDS (unix-domain-socket) communication.

For now, it only contains the low-level bind, and connect functions.

Reviewed By: muirdm

Differential Revision: D46812534

fbshipit-source-id: efbf31dbb1286ae64051b570c20ca6f41c736afa
2023-06-21 14:49:59 -07:00
Jun Wu
d9334ee302 nodeipc: avoid closing underlying fd multiple times
Summary:
The `FileDescriptor` type will close the underlying fd on drop. In our
use-cases `r` and `w` refer to the same fd so we only need to close it
once. Note the reason we use separate `Mutex`es for r and w is that we
want `recv()` and `send()` running from different threads to not block
by each other.

Reviewed By: zzl0

Differential Revision: D46885308

fbshipit-source-id: b2a5644251ac4773581a995ae8c3d955b0b36861
2023-06-21 14:49:59 -07:00
Jun Wu
8a46d73b6e nodeipc: remove unused once_cell dep
Summary: The crate is no longer used.

Reviewed By: muirdm

Differential Revision: D46812535

fbshipit-source-id: 659b73a563bf14cc17cb1b09e9a57422d21a6377
2023-06-21 14:49:59 -07:00
Jun Wu
60ae5c218a nodeipc: test send/recv stdio
Summary:
Tested variations mentioned in the added README, especially the
nodejs -> parent -> child case:

Windows:

  $ node hello_parent.js
  [Parent] Got message from child: HELLO FROM CHILD
  [Child] Got message from parent: String("HELLO FROM PARENT 1")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 1' ]
  [Child] Got message from parent: String("HELLO FROM PARENT 2")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 2' ]
  [Child] Got message from parent: String("BYE")
  [Parent] Child process has exited

  $ cargo run --example spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending a.txt file descriptor
  Parent: sending stdio
  Parent: waiting for child to exit
  Child: started with IPC handle 100
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { pid: 41528, raw_fds: [0x118] }
  Child: writing "something\n" to fd 0x118
  Child: got stdio
  Child: write to stderr
  Child: no IPC singleton

  $ node hello_parent.js spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending a.txt file descriptor
  Parent: sending stdio
  Parent: waiting for child to exit
  Child: started with IPC handle 100
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { pid: 49952, raw_fds: [0x118] }
  Child: writing "something\n" to fd 0x118
  Child: got stdio
  Child: write to stderr
  Child: has IPC singleton
  [Parent] Got message from child: HELLO FROM CHILD
  Child: Got message: String("HELLO FROM PARENT 1")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 1' ]
  Child: Got message: String("HELLO FROM PARENT 2")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 2' ]
  Child: Got message: String("BYE")
  [Parent] Child process has exited

Linux:

  % node hello_parent.js
  [Parent] Got message from child: HELLO FROM CHILD
  [Child] Got message from parent: String("HELLO FROM PARENT 1")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 1' ]
  [Child] Got message from parent: String("HELLO FROM PARENT 2")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 2' ]
  [Child] Got message from parent: String("BYE")
  [Parent] Child process has exited

  % cargo run --example spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending a.txt file descriptor
  Parent: sending stdio
  Parent: waiting for child to exit
  Child: started with IPC handle 4
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { raw_fds: [3] }
  Child: writing "something\n" to fd 3
  Child: got stdio
  Child: write to stderr
  Child: no IPC singleton

  % node hello_parent.js spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending a.txt file descriptor
  Parent: sending stdio
  Parent: waiting for child to exit
  Child: started with IPC handle 5
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { raw_fds: [4] }
  Child: writing "something\n" to fd 4
  Child: got stdio
  Child: write to stderr
  Child: has IPC singleton
  [Parent] Got message from child: HELLO FROM CHILD
  Child: Got message: String("HELLO FROM PARENT 1")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 1' ]
  Child: Got message: String("HELLO FROM PARENT 2")
  [Parent] Got message from child: [ 'Echo from child', 'HELLO FROM PARENT 2' ]
  Child: Got message: String("BYE")
  [Parent] Child process has exited

Reviewed By: muirdm

Differential Revision: D46811170

fbshipit-source-id: 96b2d4a7a3c5f8599058faea949ea3ee7be962be
2023-06-21 14:49:59 -07:00
Jun Wu
633dfd6ab6 nodeipc: move Windows AttachConsole from recv_fd_vec to recv_stdio
Summary: `recv_stdio` seems a better place for the logic.

Reviewed By: muirdm

Differential Revision: D46811171

fbshipit-source-id: ddd91489610fcf6a148897bbd4f35b1e404cbd0b
2023-06-21 14:49:59 -07:00
Jun Wu
08698d715f nodeipc: implement send/recv stdio
Summary:
This makes it easier to use. In addition, the "singleton" IPC initially decided
by NODE_CHANNEL_FD is handled internally so the callsite is less error-prone,
since it does not need to care about maintaining the NODE_CHANNEL_FD env var,
or the initialization order of the singleton.

Reviewed By: muirdm

Differential Revision: D46811166

fbshipit-source-id: a2a8a7a36986422a8d7c967d6fb5b820bedce0c9
2023-06-21 14:49:59 -07:00
Jun Wu
2eb8cc5a82 nodeipc: remove unnecessary non-blocking side effect
Summary:
Remove the side effect when constructing the NodeIpc. It does not seem
necessary. This allows us to construct NodeIpc without checking the underlying
fd until first send/recv.

Reviewed By: muirdm

Differential Revision: D46811162

fbshipit-source-id: 4fc7941a1e9d6b9a9c47daa699de4283bfcec5c3
2023-06-21 14:49:59 -07:00
Jun Wu
d02c4ecc35 nodeipc: make singleton mutable by crate
Summary:
This allows us to update it dynamically, without going through the
`NODE_CHANNEL_FD` environment variable.

Reviewed By: muirdm

Differential Revision: D46811169

fbshipit-source-id: bf52b5597fcf69291da81675d2917dc0dc010904
2023-06-21 14:49:59 -07:00
Jun Wu
71a5ee65ab nodeipc: move singleton to a method
Summary: This makes it more flexible so we can replace the singleton if we want.

Reviewed By: muirdm

Differential Revision: D46811160

fbshipit-source-id: 902b7ff05a4fb3f8a7d7218afd3d07e0f3a89a9f
2023-06-21 14:49:59 -07:00
Jun Wu
b4f645285c nodeipc: implement fd sending on POSIX
Summary:
Make it possible to send fds on POSIX. This is similar to what chg
(hgclient.c:attachio and osutil.c:recvfds) does. Note the `sendfd`
crate seems to have a solid implementation but its public API is
on the `std::os::unix::net::UnixStream` type, which is incompatible
with our struct that uses the `FileDescriptor`.

Example:

  % cargo run --example spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending stdio and a.txt file descriptors
  Parent: waiting for child to exit
  Child: started with IPC handle 4
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { raw_fds: [3, 5, 6, 7] }
  Child: writing "something\n" to fd 3
  something
  Child: writing "something\n" to fd 5
  something
  Child: writing "something\n" to fd 6
  something
  Child: writing "something\n" to fd 7
  % cat a.txt
  something

Reviewed By: muirdm

Differential Revision: D46811163

fbshipit-source-id: 37686327f02a7fa0b0e8768d025094a7fcb0e2b5
2023-06-21 14:49:59 -07:00
Jun Wu
4b87bff93d nodeipc: use message header to prevent over-read
Summary:
This avoids over reading which might drop special messages from sendmsg(),
on POSIX systems.

The behavior disables itself if we need libuv compatibility on POSIX.

Reviewed By: muirdm

Differential Revision: D46811164

fbshipit-source-id: 3aed4bb4d63ad10ecc6a7bf76007cc7263c1c580
2023-06-21 14:49:59 -07:00
Jun Wu
3a4d26c5af nodeipc: use unbuffered read if we know the message size
Summary:
This avoids over reading which might drop special messages (like file descriptors)
from sendmsg(). Buffered reader might turn those special messages into regular
messages and will lose the file descriptors.

Reviewed By: muirdm

Differential Revision: D46811158

fbshipit-source-id: 2294c5c2b132c25c21950f26e9f0d44094743fe0
2023-06-21 14:49:59 -07:00
Jun Wu
c372790323 nodeipc: implement fd sending on Windows
Summary:
On Windows, we can send handles via DuplicateHandle and AttachConsole.

Example (running in mingw):

When stdio is not redirected:

  $ cargo run --example spawn_sendfd
  Parent: spawning child
  Parent: sending hello
  Parent: sending stdio and a.txt file descriptors
  Parent: waiting for child to exit
  Child: started with IPC handle 11c
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { message: "sendfd_message", pid: 1640, raw_fds: [0x0, 0x0, 0x0, 0x104] }
  Child: writing "something\n" to fd 0x104

When stdout is redirected:

  $ rm a.txt
  $ cargo run --example spawn_sendfd > b.txt
  $ cat b.txt
  Parent: spawning child
  Parent: sending hello
  Parent: sending stdio and a.txt file descriptors
  Parent: waiting for child to exit
  Child: started with IPC handle 100
  Child: got message Some("hello")
  Child: got sendfd payload SendFdPayload { message: "sendfd_message", pid: 34536, raw_fds: [0x0, 0x130, 0x0, 0x134] }
  Child: writing "something\n" to fd 0x130
  something
  Child: writing "something\n" to fd 0x134

  $ cat a.txt
  something

When stdio is fully redirected:

  $ cargo run --example spawn_sendfd >b.txt 2>c.txt <a.txt
  $ cat b.txt
  ...
  Child: got sendfd payload SendFdPayload { message: "sendfd_message", pid: 29728, raw_fds: [0x10c, 0x110, 0x114, 0x11c] }
  ...

Reviewed By: muirdm

Differential Revision: D46811159

fbshipit-source-id: 23e132ae460f61830d2240a3e6b2d5d57e80b30a
2023-06-21 14:49:59 -07:00
Jun Wu
5bd252bc31 nodeipc: add winapi
Summary:
We're going to use winapi to implement sending and receiving file descriptors
on Windows.

Reviewed By: muirdm

Differential Revision: D46811161

fbshipit-source-id: dca85722da9f96e15f1ec8bb4676058487c51872
2023-06-21 14:49:59 -07:00
Jun Wu
af56ab93cb nodeipc: make some items public
Summary: They will be used by upcoming changes.

Reviewed By: muirdm

Differential Revision: D46811168

fbshipit-source-id: fdd60a2aa96b979dd2dc5bb2d016189435bbf695
2023-06-21 14:49:59 -07:00
Jun Wu
13d31903ff nodeipc: add NodeIpc::from_socket
Summary: This makes it a bit easier to use in upcoming changes.

Reviewed By: zzl0

Differential Revision: D46811157

fbshipit-source-id: 333e17415d4a67fcb58bec61153b15e4cad03d23
2023-06-21 14:49:59 -07:00
Jun Wu
acf9c13edb nodeipc: add NodeIpc::from_raw_file_descriptor
Summary:
Exposes the ability to construct `NodeIpc` from a Windows HANDLE, not a
msvcrt/ucrt's fd.

Reviewed By: zzl0

Differential Revision: D46811167

fbshipit-source-id: 94f48dc0d059bca109c1792dceb0b733e4737adf
2023-06-21 14:49:59 -07:00
Jun Wu
d027cea337 nodeipc: rename raw_fd to libc_fd
Summary:
In the next change I'm adding "raw ..." concept. Let's rename `raw_fd` to
`libc_fd` to make it obvious that the raw something is different from the raw
"HANDLE" on Windows.

Reviewed By: zzl0

Differential Revision: D46811165

fbshipit-source-id: e0fe48633fd8d928ce7d7ae0652f041a90aec922
2023-06-21 14:49:59 -07:00
Jeremy Braun
e24f2bf601 format operations in the tracefs log that have two associated paths
Summary:
While most PrjFS operations only communicate about the filesystem object they're modifying via the [`PRJ_CALLBACK_DATA->FilePathName`](https://learn.microsoft.com/en-us/windows/win32/api/projectedfslib/ns-projectedfslib-prj_callback_data) member, notifications via the [`PRJ_NOTIFICATION_CB`](https://learn.microsoft.com/en-us/windows/win32/api/projectedfslib/nc-projectedfslib-prj_notification_cb) have a `destinationFileName` argument as well.

This is documented as:
> If notification is PRJ_NOTIFICATION_PRE_RENAME or PRJ_NOTIFICATION_PRE_SET_HARDLINK, this points to a null-terminated Unicode string specifying the path, relative to the virtualization root, of the target of the rename or set-hardlink operation.

While the individual STRACE `NotificationArgRenderer` functions handled the extra path, `PrjfsLiveRequest::formatTraceEventString` does not.

This forwards the string to that object, allowing it to be rendered if needed, so that it shows up in the `eden trace fs` output.

Reviewed By: xavierd

Differential Revision: D46809287

fbshipit-source-id: 781db1d911a975902d0b27d9ba4f553cc3b85299
2023-06-21 11:48:17 -07:00
Egor Tkachenko
0c0282221b non-oss work 82/n
Differential Revision: D46836985

fbshipit-source-id: da87e06165fe72044c2944f45fcac045c8a40286
2023-06-21 10:04:36 -07:00
Muir Manders
2ddb02440c RepoPath: validate \r as invalid byte
Summary: We were forbidding \n but not \r. A couple Python spots validate against "\r" and "\n" in filenames (scmutil.checkfilename and manifest._checkforbidden), so let's do it in Rust as well.

Reviewed By: zzl0

Differential Revision: D46646011

fbshipit-source-id: 41b5cbad057e2b966e3c00011d75cd6cd6e804fc
2023-06-21 08:29:03 -07:00
Muir Manders
3bf46e3cd8 tests: use Rust status in test-audit-path.t
Summary:
This test needed significant changes to use remotefilelog (unrelated to Rust status).

In particular:
- "hg cat" doesn't report "no such file" for non-existing files. Previously that came from py manifest, but Rust manifest walk doesn't support.
- Kill tampered bundle check. I tried for a while to get this working, but everything fails really early with the Rust manifest since bad paths are immediately rejected by the RepoPath type.
- Various update-over-symlink tests now work since the Rust vfs will remove symlinks in order to write the new file (thus avoiding the "xxx traverses symbolic link yyy" audit error).

Also this test revealed the need to process directories in the Rust status to catch a file being replaced by a directory. I changed the (Watchman) code path to no longer skip directories returned from watchman.

Reviewed By: zzl0

Differential Revision: D46646010

fbshipit-source-id: a2f8a92e85a97611212d917b2a6118f0dd1f5eed
2023-06-21 08:29:03 -07:00
Muir Manders
b4a36a0221 tests: remove test-advice-header.t
Summary:
The x2p auth advice header is handled/displayed by the network doctor in practice now.

I'm making tests support the Rust status, and opting to remove this one instead of update it.

Reviewed By: zzl0

Differential Revision: D46646012

fbshipit-source-id: 72bd074b0e8d76ecbc4206920f6c8867d6d794cd
2023-06-21 08:29:03 -07:00
Muir Manders
b4986423d1 status: use Rust status in test-casecollision.t
Summary: I had to tweak the case collision auditor to exclude untracked files. The Rust status (using Watchman) seem so to add untracked files to the dirstate earlier than Python, which was causing extra "possible case-folding" warnings.

Reviewed By: quark-zju

Differential Revision: D46832704

fbshipit-source-id: fa0e30df757804804ca437df94a4fb4b56dcbeda
2023-06-21 08:29:03 -07:00
Muir Manders
6a017d0f75 status: support match.bad() for Rust status
Summary:
Some Python commands depend on the "bad" matcher callback getting called by dirstate.status(). Tweak things so this happens when we use the Rust status as well. This also adds support for the "clean" option when using the Rust status since clean files and "bad" are somewhat coupled.

I moved invalid file type detection from filesystem.py into dirstate.py so it covers Rust status as well.

Reviewed By: quark-zju

Differential Revision: D46646006

fbshipit-source-id: 28278af15e02e0f794aefc7bde850ce58b319ac6
2023-06-21 08:29:03 -07:00
Muir Manders
0313941fa6 status: enable workingcopy.ruststatus for some tests
Summary: It aleady passes for these, so turn it on.

Reviewed By: quark-zju

Differential Revision: D45510980

fbshipit-source-id: f45a2dbe11186411adc259863b88c6ff5ee1914e
2023-06-21 08:29:03 -07:00
Muir Manders
aeb54654a3 tests: enable workingcopy.ruststatus for debugruntest
Summary: It's annoying to have to remember when this setting is and isn't enabled by default.

Reviewed By: quark-zju

Differential Revision: D45510982

fbshipit-source-id: 7d54c0c95d7edf61f358692b1a7c487e5889b5fa
2023-06-21 08:29:03 -07:00
Liubov Dmitrieva
0e7419f010 add option for consistent routing of single tree requests and single
Summary:
add option for consistent routing of single tree requests and single blob requests

Meta:

Background:

We are having a lot of traffic for single tree blob or single file blob:
https://fburl.com/scuba/mononoke_test_perf/0eainxd3
https://fburl.com/scuba/mononoke_test_perf/0ye4eduq
Let's route them consistently!

Reviewed By: quark-zju

Differential Revision: D46860178

fbshipit-source-id: 50298c583d82585b3345ec4c4ca6b7ab4ab57ab1
2023-06-21 04:14:20 -07:00
Genevieve (Genna) Helsel
68fac5cd33 explicity copy stats in lambda in LocalStore
Summary: Followup from D46706164

Reviewed By: xavierd

Differential Revision: D46877765

fbshipit-source-id: 4a5ea4676c55d13e6292472d26089e2b0f653788
2023-06-20 17:22:09 -07:00
Mateusz Kwapich
0ee50a92c3 pushrebase - allow exemptions from casefolding check
Summary:
The casefolding pushrebase check is blocking the sync of www commits causing
problems. Let's exempt www/ dir from it.

We'll also have to modify commit hooks - but that's a separate thing.

Reviewed By: markbt

Differential Revision: D46860559

fbshipit-source-id: 87db959e0d025c0c1fc5c6cfecbdcf96af9e0f81
2023-06-20 16:48:55 -07:00
Zhaolong Zhu
e662d3f7cd bisect: skip the sparseskip logic for Eden repo
Summary: skip the unnecessary sparseskip logic for Eden repo.

Reviewed By: quark-zju

Differential Revision: D46865714

fbshipit-source-id: 660ccc8e1ed740ad6db9aeff350fd5e87089816d
2023-06-20 15:26:46 -07:00
Haitao Mei
a66a40a339 new admin tool bulk unlinking refactoring
Summary:
This diff does the following refactoring:
* Remove redundent  key checking when parsing blobstore key, and repo_id from it
* Replace all the `writeln!` with `println!`
* Print errors using `eprintln!`
* Remove misuse of verbose

Differential Revision: D46857681

fbshipit-source-id: 1b065756eb91d8b4b67422ef49ded2783660992f
2023-06-20 10:39:12 -07:00
Haitao Mei
4d25e33775 new admin tool print how long does it take to delete all the keys from a file
Summary: This diffs allows the new admin tool to print out how long it takes to process each file during bulk blobstore key unlinking.

Differential Revision: D46838088

fbshipit-source-id: 92fa57edcce5b171a1d4f6be6d7a57571fdb618b
2023-06-20 09:07:49 -07:00
Haitao Mei
39d3400de2 new admin tool uses HashMap to cache the blobstores regarding a given repo_id
Summary:
This diff:
* Adds a new HashMap to store the blobstres, regarding a given repo_id, to avoid duplicated computation
* Removes some debugging output

Differential Revision: D46802649

fbshipit-source-id: 8ddf0243b192b5684af2d4a430cdb8873a78246d
2023-06-20 09:07:49 -07:00
Haitao Mei
29d634f146 new admin tool does the actual deletion for the bulk key unlinking
Summary:
This diff allows the new admin tool to actually delete the content from the blobstore.

When the key is not present, there is nothing happening.

Differential Revision: D46802651

fbshipit-source-id: ac1d9aabcb4fd17455263c29b1348f5d1619868b
2023-06-20 09:07:49 -07:00
Pierre Chevalier
6ed7f57fcc non-oss work 80/n
Summary:
[plan_deletion] Add subcommand to redact relevant blobs

To make it easy to use in the context of plan deletion, we take the provisional deletion plan issued from the `propose-deletion-plan` subcommand in and we output the redaction id to a file.

In the real world, one would use this redaction id to make a diff to the mononoke config in configerator and restart the mononoke servers to make sure that the redaction actually takes effect before moving on to the next step.

Reviewed By: markbt

Differential Revision: D46768075

fbshipit-source-id: 368dafd485a02d677f3a74c6ede59a80cbe931d4
2023-06-20 07:15:08 -07:00
Pierre Chevalier
f377936c00 Expose fetch-key-list through the API and the CLI
Summary:
The current interface relies on the assumption that redacted content only relates to file contents.
`list`, which is the way to read what was redacted discovers the blobs for filecontents by walking the fsnodes manifests.

For a feature I'm working on, I need to be able to redact arbitrary blobs, so I need a way to identify what was redacted
without relying on some derived data blobs being available.

Reviewed By: markbt

Differential Revision: D46806525

fbshipit-source-id: 78b5470d4dd741538e3e85353c0b1634f3b83b1c
2023-06-20 07:15:08 -07:00
Pierre Chevalier
14bbdd45bf Make the API to the redaction crate more minimal
Summary: Instead of taking in the full context of a `MononokeApp`, only take the two blobstores that we need.

Reviewed By: markbt

Differential Revision: D46768087

fbshipit-source-id: 773f0f31e12c58ee0cc8341e638fcbcedde8bab9
2023-06-20 07:15:08 -07:00
Pierre Chevalier
2fe77034e8 Extract redaction feature to its own crate
Summary:
The crux of the redaction process is this `create_key_list` function which appends each key to the redaction blobstores and provides instruction to generate the correct redaction config.

I will need to re-use this mechanism, so extract it to an accessible crate.

Reviewed By: markbt

Differential Revision: D46763714

fbshipit-source-id: 8f06a12c6348bc49d0ca4fe65155818a216c5b88
2023-06-20 07:15:08 -07:00
Muir Manders
e809d770f9 tests: fix test-status-mlog.t on Windows
Summary:
The blackbox was reporting a mode mismatch. The cause was the filesysytem walk yielding a mode with permission bits set (e.g. 0666), but os.lstat within dirstate.normal() yields a mode without permission bits set (e.g. 0000). Fix by only reporting a mode change when the executable bit changes (which seems like the intention of the code).

I don't think this is a recent change in behavior, so I'm not going to look further into it. Hopefully the Python filesystem code will go away soon with the Rust status.

Reviewed By: zzl0

Differential Revision: D46848722

fbshipit-source-id: cdd73137ae891bc8038d7d7ddcd09d8c95170051
2023-06-20 06:19:16 -07:00
Rajiv Sharma
6da90296c8 Clippy Fixes
Summary: As in title

Reviewed By: mitrandir77

Differential Revision: D46855503

fbshipit-source-id: 715548f1a138e950bc2ae00e9b83a47a13944109
2023-06-20 05:19:24 -07:00
Haitao Mei
c8968599aa new admin tool extract the blobstore key from the given key
Summary:
This diff allows the new admin tool to extract the blobstore key from a given key.

For example, `flat/repo2122.blame.fileunode.blake2.2e58d897760aa5927c7ca1b0755992c9109be6048a9dc1deab1c86a4619f5839` will give `repo2122.blame.fileunode.blake2.2e58d897760aa5927c7ca1b0755992c9109be6048a9dc1deab1c86a4619f5839`.

Differential Revision: D46802650

fbshipit-source-id: bec63353b1ca50eeeab73cd84b5e3d8fb967c694
2023-06-20 05:17:23 -07:00
Haitao Mei
0b7b932ef6 Implement getting blobstores for a given repo id
Summary:
This diff adds
* a new function to extract repo id from a given key
* a new function to construct all the blobstores given a repo id

Differential Revision: D46763054

fbshipit-source-id: 64bb1ab4fd8bcae8ab414dd03e78f0a7c2dd5639
2023-06-20 05:17:23 -07:00
Youssef Ibrahim
034dc93e70 commit_graph: use fetch_edges_required and fetch_many_edges_required everywhere except in exists, changeset_parents and changeset_generation
Summary: Some of the usages of the commit graph (e.g. in pushrebase) query very recent commits that might not have been fully replicated in xdb yet. This diff switches to using fetch_edges_required and fetch_many_edges_required everywhere except in exists, changeset_parents and changeset_generation, to avoid any errors caused by replication lag. This shouldn't cause any performance degredation as we always use the normal read connection first and only query master in the rare case that a commit is missing from replicas.

Reviewed By: mitrandir77

Differential Revision: D46842804

fbshipit-source-id: 3822d883b079447d0af90c9169cd3db7600f9b25
2023-06-19 14:20:27 -07:00
Youssef Ibrahim
0b9254b329 commit_graph: use fetch_edges_required in changeset_generation_required and changeset_parents_required
Summary: The SQL implementation of fetch_edges_required first tries fetching the changeset edges using the normal read connection, then tries to fetch any missing changesets using the master connection. This can sometimes be the desired behavior when working with very recent commits so let's expose it through changeset_generation_required and changeset_parents_required.

Reviewed By: markbt

Differential Revision: D46796193

fbshipit-source-id: 38b3d79dd88ca4b8b98f36705ca1a215379a87b3
2023-06-19 08:30:20 -07:00
Youssef Ibrahim
1afff25d5b newadmin: add the missing blobstore fetch decodings
Summary: Added the missing blobstore fetch encoding except RedactionKeyList as that require creating a separate config and already has its own newadmin command.

Differential Revision: D46491769

fbshipit-source-id: 82208ac9dcb1acb5370ff7904c285e843be4f18f
2023-06-19 07:08:40 -07:00
Mateusz Kwapich
fbea1eb670 change the megarepo tool to not use commiter date
Summary:
This makes commits created by megarepo tools roundtrippable through bonsais (so far they were not).
D27852341 shows that it's not a problem for actual backup job but.. it's a
problem for example for mirror_hg_commits binary so let's make thos commits
nice and tidy.

Reviewed By: mzr

Differential Revision: D46489608

fbshipit-source-id: d15ba6f6622f51189a1ba9e76efd68faf1bf2b71
2023-06-19 06:28:57 -07:00
Mateusz Kwapich
e058be184f new, faster verification
Summary:
Verification is used to verify if given megarepo mapping configuration can be cleanly applied to given pair of small repo and large repo commits. It's used when we want to change current config and we want to check if according to the new config the mapping is still sound.

The previous *fast path* verification worked by limiting the amount of visited entries to `O(small repo)`

The new fast path verification doesn't walk every file in the repository, instead it leverages FSNodes to compare hashes of entire directories. This was if the repository verifies OK the verification is very fast. The amount of entries visited is `O(differences to report + number of config entries)`. When the configuration is simple and the repository is intact (usual case) it's almost instant. In case of more complex configurations (like ovrsource one) it's still **much** faster than current one.

WARNING: The implementation is a bit hacky due to the path mover functions being orignally designed with moving file paths not, directory paths. The hack is mostly contained to wrap_mover_result functiton.

Differential Revision: D45864549

fbshipit-source-id: 2fad0ed29a5718e655fa4a69b28306ca3db31dda
2023-06-19 03:38:35 -07:00
Mateusz Kwapich
6dc96eaecf add committer date and time support
Summary:
I want to test for some bug in megarepotooling and I'd like to use that
feature.

Differential Revision: D46440647

fbshipit-source-id: 1f4bb0d937f6e681a02f9843a7241fde4ae9b774
2023-06-19 03:33:58 -07:00
Mateusz Kwapich
b15dc88eb6 add author_date
Summary: For completeness it would be great to have it.

Differential Revision: D46440646

fbshipit-source-id: 0c57ab1a5b865ba3a93cc46ac92c9345e2a39d86
2023-06-19 03:33:58 -07:00
Mateusz Kwapich
b203146f0f add committer and committer date to test commits
Summary:
Some of our commits have those fields set so let's allow setting them on test
commits.

Differential Revision: D46440648

fbshipit-source-id: 393d9fcb616ddee5481f239264ab87bf5c8315e9
2023-06-19 03:33:58 -07:00
generatedunixname89002005320047
34e5d05ffe Migrate "eden/testlib" from LLVM-12 to LLVM-15
Summary:
fbcode is migrating to LLVM-15 for safer and more up-to-date code and new compiler features. All contbuilds in your directory have passed our build test with LLVM-15, and your directory does not host any packages. This diff will migrate it to LLVM-15.

If you approve of this diff, please use the "Accept & Ship" button. If you have a reason for why it should not build with LLVM 15, please make a comment and send it back to author. Otherwise we will land this on Thursday 06/15/2023.

See the [FAQ post](https://fb.workplace.com/groups/llvm15platform010/posts/749154386769776/)! Please also direct any questions to [this group](https://fb.workplace.com/groups/llvm15platform010).

 - If you approve of this diff, please use the "Accept & Ship" button :-)

Build directives:

Reviewed By: meyering, zzl0

Differential Revision: D46662743

fbshipit-source-id: 1af43eea7bb103d29f3b409634f1b7a60ae84c88
2023-06-17 22:06:53 -07:00
Chad Austin
d110d684f2 hooks: allow other nocommit spellings
Reviewed By: mzr

Differential Revision: D46464575

fbshipit-source-id: d2cf8059062ea68f465a5db40185f0faec3b89e3
2023-06-16 14:53:10 -07:00
Shayne Fletcher
ca860fbcef Update autocargo component on FBS:master
Reviewed By: zertosh

Differential Revision: D46811187

fbshipit-source-id: 5d4e3993ccbc3871bf56495822d15de8d73f832c
2023-06-16 14:06:54 -07:00
Mateusz Kwapich
f7e8639689 option to rewrite dates in forward syncer
Summary:
We need that for current catchup to avoid confusing clients with backdated
commits.

Reviewed By: markbt

Differential Revision: D46743487

fbshipit-source-id: a71ee30eada63dab7c64cbe43a4495662fe04371
2023-06-16 04:08:02 -07:00
Mark Juggurnauth-Thomas
8eed042d80 cmdlib_caching: remove deprecated cachelib options
Summary: Remove the deprecated `--skip-caching`, `--blobstore-cachelib-only` and `--cachelib-only-blobstore` options.

Reviewed By: clara-9

Differential Revision: D45089767

fbshipit-source-id: 52707ce00865bfd9ed7e09f0df4f6ce190ac7481
2023-06-16 03:21:13 -07:00
Mark Juggurnauth-Thomas
32d13cc799 walker: specify cache-mode default
Summary: Walker previously specified a default for the deprecated `cachelib-only-blobstore` argument.  Switch to `cache-mode`, allowing us to specify local caching for all types, not just the blobstore.

Differential Revision: D45089769

fbshipit-source-id: 978ac545590935be5a825669db9df58f0281c41a
2023-06-16 03:21:13 -07:00
Jan Mazur
f34aeb993a show the path used when cert is not found
Summary: This is useful for debugging

Reviewed By: zzl0

Differential Revision: D46736892

fbshipit-source-id: cd8521b46c650888ec75ed0782f2792ae8ffdcff
2023-06-15 22:22:54 -07:00
Muir Manders
33e1d136d6 tests: enable rust status for test-commit.t
Reviewed By: sggutier

Differential Revision: D45510006

fbshipit-source-id: d7c8768762a0131be3cf1aebfddec6454d58f308
2023-06-15 19:48:34 -07:00
Muir Manders
2b6c27c219 workingcopy: ignore Git submodules in "status"
Summary: To avoid showing a bunch of "?" files, we need to ignore things within submodules. For watchman, we do similar to Python and add submodules to the ignored dirs list. For the manual walker, we similarly skip directories in the ignore list. Note that the walker already skipped the submodules due to the presence of the "dot dir" (e.g. ".sl") in the submodules, but I piped through the ignored dirs skipping to be consistent.

Reviewed By: quark-zju

Differential Revision: D46547238

fbshipit-source-id: b001dc02a3c73f69d74fe36615a812f9ac983944
2023-06-15 19:48:34 -07:00
Muir Manders
ae180addae status: fallback to Python for Git repos
Summary: Python status for Git has submodule aware logic we don't have in Rust, so we need to defer to Python. However, Python will still be able to use the internal Rust status API.

Reviewed By: zzl0

Differential Revision: D46547239

fbshipit-source-id: 2caf1436819219cea007307f602627fd1a38ef51
2023-06-15 19:48:34 -07:00
Muir Manders
9c2de6e351 workingcopy: kill SingleWalker fs walker
Summary: It wasn't used from Rust (only MultiWalker(threads=8) was used), and Rust walker is not enabled from Python. It's annoying to have to make changes twice, so let's kill the non-parallel walker.

Reviewed By: zzl0

Differential Revision: D46547240

fbshipit-source-id: 4a57222ec705059acbc6865f8e1a9701ae584ccc
2023-06-15 19:48:34 -07:00
Muir Manders
1648d2a0a6 filesystem: remove rust walker support
Summary: This wasn't enabled in production, and the parallel walker doesn't currently work from Python due to matcher GIL deadlock. Anyway, I'm working to make Python use the Rust status directly, so this intermediate optimization of using the Rust walker in the Python status won't buy us anything.

Reviewed By: zzl0

Differential Revision: D46646007

fbshipit-source-id: 645d88adb85700062c3edf2483fb5a5ffb76cca2
2023-06-15 19:48:34 -07:00
Muir Manders
c620498ea3 repo: add storage format type/methods
Summary: These make it more convenient to conditionalize logic based on storage format.

Reviewed By: zzl0

Differential Revision: D46547242

fbshipit-source-id: ef833c954090f5cb2b1c2c6e616d5d67a442886d
2023-06-15 19:48:34 -07:00
Muir Manders
d8a436f3f5 git: move ".gitmodules" parsing to Rust
Summary: I'm going to use this to skip submodules in the Rust status implemenation.

Reviewed By: zzl0

Differential Revision: D46547241

fbshipit-source-id: e5cf5dc5ee77aa3e8927ab3cf5922f3e29a25ae5
2023-06-15 19:48:34 -07:00
Eddie Shen
5db8c486ab Replace remaining atty usages with stdlib
Summary:
`std::io::IsTerminal` was stabilized in 1.70. It is intended to be a drop in replacement for `atty::is(Stdout)`.

This codemod removes all remaining instances of atty

`arc f` was ran twice, followed by two invocations of `arc lint -e extra --take RUSTFIXDEPS`. `arc autocargo` was also ran

This script was a little naive though, and as a result, I had to manually move the newly added imports to the correct line. I ran lints again afterwards.

Reviewed By: dbxfb

Differential Revision: D46736264

fbshipit-source-id: a686b96b1fa0aa4389f65487ed426f226c86e8e9
2023-06-15 18:42:33 -07:00
Mateusz Kwapich
e7b8e8b8b5 option to skip syncing empty commits
Summary: www has lots of empty commits that are being synced to all small repos. Until we fix that problem let's refrain from backsyncing any empty commits. I'm making it a tunable for easy on-off

Reviewed By: liubov-dmitrieva

Differential Revision: D46727657

fbshipit-source-id: 5f204cc8231fec3e6a4eaf25b6575c0d637d67a3
2023-06-15 08:46:20 -07:00
Pierre Chevalier
1017a247d0 non-oss work 79/n
Summary:
[plan_deletion] Implement `commit-deletion-plan-to-deletion-log-db` subcommand

This is the last necessary step before enacting the deletion.
As the outcome of this step, the deletion_log db is populated and we can start taking the necessary steps to safely proceed with the actual deletion of changesets and blobs.

We still need to document and potentially write tools to help with the whole process, including blobs redaction.

Differential Revision: D46724273

fbshipit-source-id: bc60209a28e2ee8a50ac0371f78c0b3be234781b
2023-06-15 07:57:35 -07:00
Haitao Mei
c27e9a8576 new admin tool creates a new struct to implement all features of bulk unlink
Summary: This diff moves all the bulb unlinking functions into a struct.

Reviewed By: mitrandir77

Differential Revision: D46759318

fbshipit-source-id: 143171706485ec6a56152bdfea6202221d88fe03
2023-06-15 07:51:33 -07:00
Haitao Mei
61bcdc04d4 new admin tool making the geting blobstores function for unlinking a key to be public
Summary: This diff makes the `get_blobstores` function to be public, so that we can use it to get blobstores. These blobstores are going to be used to unlink keys in a bulk.

Reviewed By: mitrandir77

Differential Revision: D46729000

fbshipit-source-id: 11d7ddc5f90527ebdb79141f61f1671997108ac5
2023-06-15 07:51:33 -07:00
Haitao Mei
f76eb1f9c6 new admin tool bulk unlink keys subcommand read keys from all files
Summary:
This diff allows the new admin tool to do the following for the new bulk unlking keys subcommand:
* Read the key list from the files
* Print all the keys extracted when running in dry-run mode
* Report the progress
* Fix the argument to take a boolean value

Reviewed By: mitrandir77

Differential Revision: D46725312

fbshipit-source-id: c039b89e00a9ffbbbee41e20617f45543ef147ce
2023-06-15 07:51:33 -07:00
Haitao Mei
b556d7cc08 Adding a new command to bulk unlink keys into new admin tool
Summary: This diff adds a new subcommand for our new admin tool, so that we can delete keys bulkly. The input is the directory that contains a list of files, each file contains a list of *Manifold* keys to remove.

Reviewed By: mitrandir77

Differential Revision: D46689957

fbshipit-source-id: 077b6a4c76872ef01bc7f0eab7096abeb87d7047
2023-06-15 04:17:16 -07:00
Eddie Shen
842b985bd4 Replace atty::is(Stdout) with stdlib
Summary:
`std::io::IsTerminal` was stabilized in 1.70. It is intended to be a drop in replacement for `atty::is(Stdout)`.

This codemod replaces all usages of `atty::is(Stdout)` with `stdout().is_terminal()`, importing the necessary paths.

It used this script (generated with assistance from Metamate):
```
#!/bin/bash

files=$(fbgs -sl "atty::is(atty::Stream::Stdout)" | arc linttool debugfilterpaths --take RUSTFMT)

for file in $files; do
  sed -i 's/atty::is(atty::Stream::Stdout)/stdout().is_terminal()/g' $file
done

for file in $files; do
  sed -i '1i use std::io::{stdout, IsTerminal};' $file
done
```

`arc f` was ran twice, followed by two invocations of `arc lint -e extra --take RUSTFIXDEPS`.

This script was a little naive though, and as a result, I had to manually move the newly added imports to the correct line. I ran lints again afterwards.

Reviewed By: danielocfb

Differential Revision: D46601191

fbshipit-source-id: 3f2269c518e36241ab0e995b87976323d7da9cc6
2023-06-14 15:29:14 -07:00
Eddie Shen
39b6073961 Replace atty::is(Stderr) with stdlib
Summary:
`std::io::IsTerminal` was stabilized in 1.70. It is intended to be a drop in replacement for `atty::is(Stderr)`.

This codemod replaces all usages of `atty::is(Stderr)` with `stderr().is_terminal()`, importing the necessary paths.

It used this script (generated with assistance from Metamate):
```
#!/bin/bash

files=$(fbgs -sl "atty::is(atty::Stream::Stderr)" | arc linttool debugfilterpaths --take RUSTFMT)

for file in $files; do
  sed -i 's/atty::is(atty::Stream::Stderr)/stderr().is_terminal()/g' $file
done

for file in $files; do
  sed -i '1i use std::io::{stderr, IsTerminal};' $file
done
```

`arc f` was ran twice, followed by two invocations of `arc lint -e extra --take RUSTFIXDEPS`.

This script was a little naive though, and as a result, I had to manually move the newly added imports to the correct line. I ran lints again afterwards.

Reviewed By: Imxset21

Differential Revision: D46601192

fbshipit-source-id: 18ef53a9fa25cbd733ca81f16b2c13ce8c5ddb98
2023-06-14 15:29:14 -07:00
Rajiv Sharma
c81071e34e Allow bypassing read-only status in gitimport
Summary: `gitimport` is typically used for mirror repos which by definition are locked. Creating or moving bookmarks on locked repos is disallowed by default. This behaviour can be overriden by passing the bypass flag. This diff adds argument support for bypassing the read-only check.

Differential Revision: D46722005

fbshipit-source-id: 9defcbc159a55d0e7ff197d8d732e3d5a208a998
2023-06-14 12:32:56 -07:00
Mark Shroyer
440f9da305 Use EDEN_TRY macro in FileUtils
Summary: Use the EDEN_TRY macro to reduce error-handling line noise.

Reviewed By: genevievehelsel

Differential Revision: D46668011

fbshipit-source-id: bb54ff710928b3a5c394b6e79474c25ef4775895
2023-06-14 12:16:45 -07:00
Mark Shroyer
46dde446e4 EDEN_TRY macro
Summary: Adds a macro to simplify bailing out of Try-returning functions, sort of like with Rust's question mark operator.

Reviewed By: chadaustin

Differential Revision: D46567326

fbshipit-source-id: f13eec678a101e423a99ba469a20d6de5513d73c
2023-06-14 12:16:45 -07:00
Zhaolong Zhu
ca12e2a75b bisect: optimize the check against skip revset
Summary: optimize the check against skip revset by reusing the unskipped result.

Reviewed By: muirdm

Differential Revision: D46687070

fbshipit-source-id: 01e5be4499daaa9e24437ddb16e2cc04f0436211
2023-06-14 12:08:24 -07:00
Zhaolong Zhu
a7e82b1613 bisect: support lazy evaluation for 'skip' option
Summary:
Currently, the 'skip' option is too slow when users want to use it to bisect on
a file or folder like below:

    sl bisect --skip "!( file('path:foo') & file('path:bar') )"

Since it tries to eval the skip revset upfront, which takes a long time for
current `file` implementation. This diff make it lazy evaluated.

Reviewed By: muirdm

Differential Revision: D46643574

fbshipit-source-id: c063fbea2bc0703772e07d5167adc8fbf989a68f
2023-06-14 11:07:02 -07:00
Zhaolong Zhu
38c190a35a bisect: add test for skipping revset
Summary: as title

Reviewed By: muirdm, sggutier

Differential Revision: D46643573

fbshipit-source-id: 1c1a46760667fc2b10623b709762eb1cbd9ba53e
2023-06-14 11:07:02 -07:00
Zhaolong Zhu
d0eff8a035 bisect: check bisect kind earlier
Summary:
move the bisect kind check earlier, so that it will not do unnecessary
node lookup

Reviewed By: sggutier

Differential Revision: D46643576

fbshipit-source-id: 624c6410aaf95f82a993093df4e24add6c5e48ea
2023-06-14 11:07:02 -07:00
Zhaolong Zhu
1c6609998e bisect: make state file format support 'revset' string
Summary: this will be needed for making 'skip' lazy evaluated

Reviewed By: muirdm

Differential Revision: D46643575

fbshipit-source-id: 53cfe2395d320d85582fbf707f62d69a5088bea2
2023-06-14 11:07:02 -07:00
Zhaolong Zhu
9772bf3c76 bisect: abstract a separate for updating state
Summary: we will update this function in the following diffs, abstract it to a separate function will avoid making the main function too complex

Reviewed By: muirdm

Differential Revision: D46643577

fbshipit-source-id: 227e0b60fe2efa1d6d00fa409ea95a30cc972747
2023-06-14 11:07:02 -07:00
Haitao Mei
354da6c438 newadmin tool now deletes keys from all the related blobstores II
Summary: We handle the error gracefully, when deleting a key from the underlying blobstores.

Reviewed By: RajivTS

Differential Revision: D46684795

fbshipit-source-id: 45349aab01e56b11fd1ab455aec2bb69d72c497b
2023-06-14 04:27:47 -07:00
Barys Skarabahaty
6e0743ebfc treat a failed blob metadata parse as missing cache
Summary:
If there's corruption in the cache, it should be considered a miss,
rather than failing.

Reviewed By: chadaustin

Differential Revision: D46577606

fbshipit-source-id: 4cc99e743e869422a149a073b726722896d971d4
2023-06-14 04:17:43 -07:00
Zhaolong Zhu
d3eaf5a42f copytrace: disable dagcopytrace for source missing files
Summary:
The dagcopytrace was enabled for source missing file in D46315431.

It's too slow if there are many files deleted in the source commit. I will debug the root cause tomorrow, let's disable it for hg repo first. We are not disabling it for git repo, because there is not alternative for git repos.

Reviewed By: muirdm

Differential Revision: D46711460

fbshipit-source-id: 4e20bbb34be126c13af081475953b83df61872df
2023-06-13 22:00:44 -07:00
Genevieve (Genna) Helsel
bcdb3c926f add Counters for failed local store lookups
Summary: Adding to track possible corruption issues we've been getting user reports about

Reviewed By: chadaustin

Differential Revision: D46706164

fbshipit-source-id: 6a868d9f9ffd3f72303123486bbb8312f2002072
2023-06-13 18:05:20 -07:00
Jan Mazur
5da5975071 import async-fcgi and http-body; add stream feature to hyper
Summary: Importing into third-party

Reviewed By: zertosh

Differential Revision: D46639634

fbshipit-source-id: c9eb7d056e75ae2c5d9a8bb9bcc781d419f65f4c
2023-06-13 17:56:22 -07:00
Haitao Mei
5f58f37936 newadmin tool now deletes keys from all the related blobstores
Summary: This diff allows the new admin tool to delete keys from all the related blobs (either the single blobstore specified by the id, or all the underlying blobstore given a repo)

Differential Revision: D46564415

fbshipit-source-id: d0299262a82acb4e1a9f4cedd5510418f270d527
2023-06-13 09:33:07 -07:00
Haitao Mei
8941996184 newadmin tool: adding a new func to construct all the underlying blobstores for multiplexed blobstre
Summary:
This diff adds a new function to construct multiple blobstores from a given repo.

The finaly step is to refactoring the existing `get_blobstore` function.

Reviewed By: RajivTS

Differential Revision: D46559402

fbshipit-source-id: 9b9901d00566556614264831f8643f7c6d4ee20f
2023-06-13 09:06:56 -07:00
Rajiv Sharma
eb70d07aeb Make statistics_collector job honor cancellation requests
Summary: Running a job in sharded setting requires it to support pre-emption in case ShardManager decides to move the repo around. This diff adds support for that pre-emption.

Differential Revision: D46514772

fbshipit-source-id: fb086e74a9c56e0ced5921877de49401bc426170
2023-06-13 04:01:12 -07:00
Rajiv Sharma
67a3a25555 Shard statistics_collector command
Summary: As in title. This tool is currently run as 5-6 different TW jobs that compute and publish data for specific repos. Instead of having multiple jobs, if we manage to shard this job across set of available tasks, it becomes much more easier to manage.

Differential Revision: D46483039

fbshipit-source-id: d7d879dee088c8f431c22915bd7ef9602b83aa00
2023-06-13 04:01:12 -07:00
Andres Suarez
af0f829543 Update strum and enable the derive feature
Reviewed By: diliop

Differential Revision: D46672815

fbshipit-source-id: e372ab53fd8f71b1011f8e1065c7d0ba38485c7a
2023-06-13 03:32:44 -07:00
Mark Shroyer
df148d223e Hostname normalization Python implementation
Reviewed By: xavierd

Differential Revision: D46503425

fbshipit-source-id: dae33a377a656d14c55f6095aea38b208d3e8c8d
2023-06-12 16:59:17 -07:00
Mark Shroyer
bd8b347dc7 Hostname normalization C++ implementation and test cases
Reviewed By: xavierd

Differential Revision: D46300186

fbshipit-source-id: f4784e03eb8d2f055db2015ee326ae24bc63de26
2023-06-12 16:59:17 -07:00
Mark Shroyer
056e016af7 Return correctly-sized string from win32 readFile
Summary:
In the win32 implementation of `readFile`, the ret string wasn't being resized
to the number of bytes actually read, which may be smaller than given in
`num_bytes`. This change makes it match the behavior of folly's readFile.

Reviewed By: xavierd

Differential Revision: D46532796

fbshipit-source-id: 1da3e4ff4190673796731610ae8a798b953d0c96
2023-06-12 11:11:55 -07:00
Haitao Mei
f98f3e94e6 newadmin tool: adding a new func of constructing a single blobstore from config and inner_id
Summary:
This diff adds a new function of constructing a single blobstore from config and inner_id.

Next step is to add a new function to construct multiple blobstores from a given repo.

The finaly step is to refactoring the existing `get_blobstore` function.

Reviewed By: RajivTS

Differential Revision: D46559565

fbshipit-source-id: b59e77e13fbe76ba013caa62bfeb9f56cbcf31d2
2023-06-12 07:50:08 -07:00
Haitao Mei
1a8a6bb35b newadmin tool: Construct blobstore inner ids from a multiplexed blobstore
Summary: This diff added a function to retrieve all the inner blobstore ids from a given multiplexed blobstore.

Reviewed By: RajivTS

Differential Revision: D46523044

fbshipit-source-id: e4c3b02e1672bc2eea3208bac4f23d879c004515
2023-06-12 07:50:08 -07:00
Youssef Ibrahim
49693566a4 remove mention of skiplist in comment
Summary: What are skiplists?

Reviewed By: mitrandir77

Differential Revision: D46640446

fbshipit-source-id: 485d3615a8344b3c217a3a378d37c231603c51a6
2023-06-12 05:13:04 -07:00
Rajiv Sharma
f65ed93617 Migrate statistics_collector to new Mononoke App
Summary: Now that the `blob_repo` dependency has been removed from `statistics_collector`, this diff migrates the tool from old Mononoke App to new Mononoke App getting rid of the old clap dependency.

Differential Revision: D46478775

fbshipit-source-id: dd713eef2175fa01934508445866d64ef01657f0
2023-06-12 03:41:37 -07:00
Barys Skarabahaty
429d9a6655 Add data integrity checks
Summary: In order to better understand what happens in cases described in https://fb.workplace.com/groups/edenfswindows/permalink/1315557692693439/ adding better logging and some data integrity checks.

Reviewed By: chadaustin

Differential Revision: D46605682

fbshipit-source-id: 485c5c83834cdde9ccfea9cfa94323cf03df7002
2023-06-09 14:29:55 -07:00
Katie Mancini
f4da0e5eb5 Add missing inodes in windows doctor
Summary:
eden doctor can discover when an inode is missing for a file, but can't
remediate the issue. restart usually remediates the issue, but it would be
better to have doctor remediate since restart can be very slow.

We could do something similar to our remediation for phantom inodes (performing
a filesystem operation). However, messing with the filesystem leaves us open to
races with concurrent modifications. The point of the filesystem io is to make
eden see a notification about a certain path and match it's state to the
filesystem. So we can directly do that instead.

We can more directly do this by introducing a thrift call to make eden match
it's internal state to the filesystem.

We could replace the other remediation with this thrift call. I'll leave that
for a follow up.

Reviewed By: xavierd

Differential Revision: D46243633

fbshipit-source-id: a1df5929428dc4f6c8fd71d826fe1e7371ebf283
2023-06-09 11:52:50 -07:00
Katie Mancini
5512c63552 gather all prjfs integration test basics
Summary:
We've got a couple sets of prjfs tests now and they have some utility functions.
Let's move this all into a base class so it can easily be reused.

Reviewed By: xavierd

Differential Revision: D46379827

fbshipit-source-id: c4b708a1effebe5f11c97a63519295be625c8018
2023-06-09 11:52:50 -07:00
Zhaolong Zhu
f570a5fe68 fbscmquery: optimize expensive repo scan
Summary:
`subset.filter(lambda r: False)` triggers an expensive repo scan. This
diff optimize that with an explicit empty smartset.

Reviewed By: quark-zju

Differential Revision: D46266771

fbshipit-source-id: bb6c8b4842369d3e165183bef0e22c3cb524111a
2023-06-09 09:05:58 -07:00
Liubov Dmitrieva
e753758d9f eliminate completely unnecessary traffic to commit graph endpoint
Summary:
eliminate completely unnecessary traffic to commit graph endpoint for
main bookmark (for segmented changelog supported repos, they use pull_fast_forward_master edenapi endpoint)

After the fast path pull being completed, the filtration of what is already
present wasn't working correctly. It could easily skip (not to be able to
filter out) what was just fetched via the fast path.

That resulted in completely unnecessary traffic to commit graph (which is
slower, especially for large bits of the master branch).

During the SEV that traffic was super expensive due to the www merge commit, but even without SEV this traffic leads to unnecessary load on our services especially if the repo is significantly behind master.

The solution is to invalidate caches.

Differential Revision: D46590498

fbshipit-source-id: c8d920f4ffd3411297ca7cd01368b731f3c2236e
2023-06-09 06:55:36 -07:00
Liubov Dmitrieva
ed5e7f19fe fix incorrect logging to scuba number of slow path heads
Summary:
fix incorrect logging to scuba number of slow path heads

it makes more sense to log after the filter I think because in this case it
would mean how many we need to pull via commit graph (slower) path

Reviewed By: zzl0

Differential Revision: D46559984

fbshipit-source-id: 4059c189afbb6ecc1dea69f0726af7b00e576f74
2023-06-09 02:52:25 -07:00
Zhaolong Zhu
3063e1e9c6 http-client: fix compiler warning
Summary:
```
warning: use of deprecated associated function `openssl::pkcs12::Pkcs12Builder::build`: Use Self::{name, pkey, cert, build2} instead.
   --> /data/users/zhaolong/fbsource/fbcode/eden/scm/lib/http-client/src/request.rs:885:36
    |
885 |     let pkcs12 = Pkcs12::builder().build("", "", &key, &cert)?;
    |                                    ^^^^^
    |
    = note: `#[warn(deprecated)]` on by default
```

Reviewed By: sggutier

Differential Revision: D46570706

fbshipit-source-id: 8999ed3119f9dd6fc8721110758c4f18ddf04fd7
2023-06-08 18:15:14 -07:00
Zhaolong Zhu
9e1948bc40 copytrace: add test for git to prevent regression
Summary: add test for testing missing files in destination

Reviewed By: quark-zju

Differential Revision: D46570174

fbshipit-source-id: b0284b2df34301e90a0c1761f9de6866f69e8a54
2023-06-08 18:11:52 -07:00
Zhaolong Zhu
84aff19dd7 debugcopytrace: use repo._dagcopytrace instead of creating one explicitly
Summary:
we have added repo._dagcopytrace property in a previous diff, let's
use it in the debugcopytrace command

Reviewed By: quark-zju

Differential Revision: D46570173

fbshipit-source-id: 729c12160e8f0ce89ae07a5c94ca98852bbaf68f
2023-06-08 18:11:52 -07:00
Jun Wu
e6c079025d hgcommands: do not collect process tree information on Windows
Summary: Profiling shows the overhead is too much.

Reviewed By: zzl0

Differential Revision: D46569345

fbshipit-source-id: 1676dde7418fff720837a381a7bbffa46734a839
2023-06-08 14:36:13 -07:00
Liubov Dmitrieva
19b1645eae update master bookmark on pull
Summary:
update master bookmark on pull

update of the master bookmark normally uses fast path for most of the repos

pulling of bookmarks is the first thing the repo.pull implementation does, if
after that the commit is present in the repo, slow path pull won't be called

otherwise, we are calling slow path pull for fetching a chunk of main branch

if the clone is old, it is a long chunk, if there are merges, it gets even
more complicated for the slow path pull

the current version seems to have the issue with phases as well, then you restore snapshot from old clone, you got enormous smartlog.

Differential Revision: D46556754

fbshipit-source-id: a771a856813d513cd34b207ea76f1a410dc0b1c0
2023-06-08 07:39:08 -07:00
Muir Manders
4fb979aefa fix test-checkoutidentifier-commitinfo.t
Summary: Failing after D46432233.

Reviewed By: sggutier

Differential Revision: D46546195

fbshipit-source-id: 933b4121e5c2a417248ea07e33d671a9ac23e0ec
2023-06-07 19:53:17 -07:00
Muir Manders
26bb24a141 pager: fix pager shutdown on ctrl-c
Summary:
After previous commit D46473305, ctrl-c is no longer handled by streampager in "direct" mode since streampager isn't polling for user input. This leaves the terminal in a funny state since streampager doesn't clean up.

Fix by waiting up to 10ms for streampager to shut down after we send it the "quit" action. I had to make the "direct" mode in streampager actually handle the "quit" action.

Reviewed By: quark-zju

Differential Revision: D46474536

fbshipit-source-id: 11df5849ea13ac530e169bdba33d5061a77647e0
2023-06-07 18:58:45 -07:00
Muir Manders
8c6d17f047 streampager: use recv_timeout instead of try_recv+sleep
Summary: Tweak the "direct" mode run loop to use recv_timeout on the event channel instead of a try_recv+sleep. This allows it to respond faster to events (in particular, I'm going to make it support "quit" in following commit).

Reviewed By: zzl0

Differential Revision: D46508080

fbshipit-source-id: efb1261324b2720baaa1960fae60a3b09f4d82ce
2023-06-07 18:58:45 -07:00
Muir Manders
7930ea96a8 streampager: don't consume input in direct mode
Summary:
Command line users commonly type their next command before the current command has finished (or, they paste in a series of commands all at once). Previously if one of the commands invoked the streampager, all remaining pending input to the terminal would get lost. This was because streampager would always put the terminal into raw mode, which loses pending input AFAICT. Raw mode also disables terminal echo, which is also undesirable for streampager "direct" mode.

Fix by deferring enablement of raw mode until it is needed. I also disabled the startup_poll_input option since that requires raw mode in order to poll for user input. This means a user can't type "q" or "h" anymore in direct mode, but I think that is a worthwhile tradeoff since users probably don't even know they are in a pager. This makes streampager behave more like "less -F".

Reviewed By: zzl0

Differential Revision: D46473305

fbshipit-source-id: 4523050bc6c8b96d0f37e2b6078555aa23ae2b28
2023-06-07 18:58:45 -07:00
Youssef Ibrahim
ca5bec76d0 commit graph: gate disabling memcache when prefetching behind a tunable
Summary: Makes it easier to disable

Differential Revision: D46525777

fbshipit-source-id: 5ba4df213de8aba7b427ccb1db7bdbc99ae58532
2023-06-07 12:34:07 -07:00
Muir Manders
103e652069 commit_info: log repo name as well
Summary: Log repo name as well as commit hash and other commit info.

Differential Revision: D46432233

fbshipit-source-id: dff22dd00297d3d5694f09a2b64ef7d6c4b7c87e
2023-06-06 20:35:16 -07:00
Ilia Medianikov
b5a891a003 mononoke/vpn_less: add new AuthorizationContext type to replace ad-hoc checks scattered across push code
Summary: This is a refactor aimed to retain the same behavior while consolidating the code and improving it's resilience to future changes.

Reviewed By: mitrandir77

Differential Revision: D46190582

fbshipit-source-id: a956f5df1044c52346a712e271c75baf298b481d
2023-06-06 13:20:30 -07:00
Xavier Deguillard
1b2abb2006 prjfs: move PrjfsChannel::start onto PrjfsChannel::initialize
Summary:
In the case where PrjfsChannel::start failed to initialized, EdenFS would crash
due to the stopPromise_ not being fulfilled. That promise is being set in the
PrjfsChannel::stop method, but unfortunately, when start throws, the caller
wouldn't catch the exception.

To fix this, we can simply move all the code in the initialize method, which if
it throws, the caller already properly tears down the mount thus solving the
crash mentioned above.

Reviewed By: genevievehelsel

Differential Revision: D46210460

fbshipit-source-id: 1524e8e0fc74ce3119b1b6dcd35b5419efcebdf3
2023-06-06 12:36:24 -07:00
Jun Wu
b1893b6b35 smartset: optimize 'generatorset & set' by applying a cutoff
Summary: See the previous commit for context.

Reviewed By: muirdm

Differential Revision: D45959185

fbshipit-source-id: ff60352111d175fa9dfd9609e0a1bb2a15dd776e
2023-06-06 11:13:25 -07:00
Jun Wu
f94acf4425 smartset: add a test case about slow 'generatorset & set' behavior
Summary: See the added test for context.

Reviewed By: muirdm

Differential Revision: D45959186

fbshipit-source-id: e437d8dc51b3730504528ee836632ed0b5ebe088
2023-06-06 11:13:25 -07:00
Jun Wu
b397acb61d smartset: add comment about generatorset iteration order
Summary: It's not obvious until reading the code.

Reviewed By: muirdm

Differential Revision: D45959182

fbshipit-source-id: ce34e070611a01b59c6bbcc8d2c4b9548b30f0f2
2023-06-06 11:13:25 -07:00
Jun Wu
8491b19eda smartset: implement fastmin, fastmax for nameset
Summary:
The Rust `NameSet` tracks O(1) `min`, `max` in its `Hints` structure.
Use it to implement `fastmin`, `fastmax`. This is used by the next change.

Reviewed By: muirdm

Differential Revision: D45959181

fbshipit-source-id: a0a506243610914c879978715c59e1277863508d
2023-06-06 11:13:25 -07:00
Jun Wu
0accc73395 smartset: add fastmin, fastmax methods
Summary:
Similar to `fastlen`, these methods return `None` if the information cannot be
computed quickly.

Reviewed By: muirdm

Differential Revision: D45959183

fbshipit-source-id: 4c693eab2122c12bad40d8c9e9ab228f6d1f5057
2023-06-06 11:13:25 -07:00
Jun Wu
e5a2d8d634 fastlog: optimize set intersection
Summary:
Optimize fastlog follow() revset to avoid iterating on the slow `subset` for
both ASC and DESC order.

Reviewed By: muirdm

Differential Revision: D45936985

fbshipit-source-id: 951af6d82376d0256c25b03af531a49d45a01559
2023-06-06 11:13:25 -07:00
Jun Wu
cd6d9856ab log: attempt to use follow() even without -f
Summary:
For commands like:

    hg log -r SOMETHING PATH

Use `follow(PATH,heads(SOMETHING))` instead of `_matchfiles(...)` as an optimization.

Reviewed By: muirdm

Differential Revision: D45936986

fbshipit-source-id: 0922fff697b38278f4c33a11f8c9ec66246ae0d9
2023-06-06 11:13:25 -07:00
Jun Wu
16be4f07ad remotefilelog: do not set --removed flag to the log command
Summary:
The behavior was added by D2634918. It sets `--removed` with the intention of
forcing the "slow path", in other words, "do not use filelog() path". It does
not really care about the `--removed` behavior.

Note: tweakdefaults might add the `--follow` flag, depending on whether
tweakdefaults or remotefilelog runs first, the `--removed` flag might be added
undesirably if tweakdefaults is going to add `--follow` next.

Anyway, with D45936982, the `filelog()` code path knows to disable itself
for remotefilelog repos. So there is no need for remotefilelog to use
`--removed` to disable the `filelog()` code path. Let's remove it so we can
get the true `--removed` flag decided by the user.

Reviewed By: muirdm

Differential Revision: D45936984

fbshipit-source-id: e800c09d0489e84e01a7d0b499a6d31963c73bf6
2023-06-06 11:13:25 -07:00
Jun Wu
8b4d7bf1f4 log: further rewrite _makelogrevset to be less cryptic
Summary:
The `_makelogrevset` feels cryptic due to the intertwined deeply nested
conditions about what strategy it uses to generate the revset.

This diff makes the strategies more explicit by using dedicated functions to
make the code (and future changes) easier to reason about.

Reviewed By: muirdm

Differential Revision: D45936982

fbshipit-source-id: 531464a1dc16e2e0b4aa61eda49a6c87488ae23b
2023-06-06 11:13:25 -07:00
Jun Wu
e0afcd18bd log: partically rewrite _makelogrevset to be less cryptic
Summary:
The `_makelogrevset` feels cryptic, partially because its use of `opt2revset`
and related logic for adhoc revset expression calculation.

This diff removes `opt2revset` and related logic, so:
- `opts` is no longer both input and output. It's only input. The output is a
  different variable.
- Use `revsetlang` APIs to format revset strings directly, without going
  through an indirection via `opts`. Avoid `repr` or `a % b` formatting.
  Note: `%d` is formatted as `_intlist(v)` instead of `rev(v)`.

The new code generates slightly simpler revset expressions with less `()`s
(or "group" in revsetlang AST).

Reviewed By: zzl0

Differential Revision: D45936983

fbshipit-source-id: 3155016a85fa9ea61f9334a2d1fc82eac5450fec
2023-06-06 11:13:25 -07:00
Jun Wu
b49ad5cac6 revset: kill _firstdescendants
Summary:
It's already the same as `descendants` in our current implementation.
It's non-trivial to implement efficiently and is rarely used. So let's just
remove it for now.

Note the order of children of a commit is undefined, unlike parents. If we want
to provide a "meaningful" order and implement this in the future we might want
to use commit date etc to sort children.

Reviewed By: zzl0

Differential Revision: D45936979

fbshipit-source-id: bff72a130a5ffb7c573f06374da8f9c02791049f
2023-06-06 11:13:25 -07:00
Jun Wu
1064ae23d4 revsetlang: add %v format for variadic args
Summary: Used by the next change.

Reviewed By: zzl0

Differential Revision: D45936988

fbshipit-source-id: f2edee33bfefe3e5dd90a3cd7bc157d3b537cc0f
2023-06-06 11:13:25 -07:00
Jun Wu
aa8409d980 revsetlang: add "formatlist"
Summary: Useful to chain a list of revset together.

Reviewed By: zzl0

Differential Revision: D45936980

fbshipit-source-id: 1775cd472e239f56971d0b441aae3e416852ea3f
2023-06-06 11:13:25 -07:00
Jun Wu
6ec291990b log: mark "--branch" as deprecated
Summary: Named branches are removed in our implementation. Clean them up in the log command.

Reviewed By: zzl0

Differential Revision: D45936987

fbshipit-source-id: 98d3df01b1f3db53861f886289cb720dccf0535a
2023-06-06 11:13:25 -07:00
Jun Wu
5020be072f log: drop "cannot follow nonexistent file" message
Summary: It's not used anywhere. This removes a dependency on the legacy filelog.

Reviewed By: zzl0

Differential Revision: D45936981

fbshipit-source-id: 1c3af8dc792454d1bf893e922c1c37c80fa0a79b
2023-06-06 11:13:25 -07:00
Jun Wu
e8d0a21746 repo: add storage_format API
Summary: This can simplify logic that checks a bunch of repo requirements.

Reviewed By: zzl0

Differential Revision: D45936978

fbshipit-source-id: eec8ca0035642bf2324782b7fb7e97cb740cc02d
2023-06-06 11:13:25 -07:00
Mateusz Kwapich
28c9cdda53 add make unlink command support more blobstores
Summary: We need that for optimizing our storage.

Reviewed By: RajivTS

Differential Revision: D46362446

fbshipit-source-id: d81973cd05cffdc78ad84da867fa4791efea877c
2023-06-06 08:32:15 -07:00
Rajiv Sharma
17c0fe0da2 Mirgrate away from BlobRepo in StatisticsCollector tool
Summary: As in title. Once `BlobRepo` has been removed from this tool, I will also migrate it to the new `Mononoke Admin`

Reviewed By: mitrandir77

Differential Revision: D46444744

fbshipit-source-id: 059623d32d608f852254f16f811bcaf4e6bf3b4a
2023-06-06 02:48:35 -07:00
Jeremy Fitzhardinge
86c075fca5 third-party/rust: update to text_placeholder 0.5
Summary: This includes PR 7 so drops the patch.

Reviewed By: zertosh

Differential Revision: D46451758

fbshipit-source-id: 5df8ccbfa610eab470744e28b5bffe411a983996
2023-06-06 00:44:17 -07:00
Barys Skarabahaty
0a29c16672 Remove default ctor from BlobMetadata
Summary: Removing the previous default ctor to ensure that we always compute and pass blake3.

Reviewed By: chadaustin

Differential Revision: D46268716

fbshipit-source-id: d9bfbc7bfd07b61dbb2e915c3fe72d7526d919e1
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
8099af29e0 Add getBlake3 method to eden service
Summary: Adding a method to retrieve blake3 hash for a list of files.

Reviewed By: chadaustin

Differential Revision: D46268718

fbshipit-source-id: 59cb3d25a1d059a7e9b6a4da784a820945ffbd32
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
7dba15317f Expose blake3 via file attributes
Summary: Expose blake3 via file attributes and changing some integration tests accordingly. Added blake3_sum so that it could be used to verify blake3 hashes and updated the tests to work with blake3.

Reviewed By: chadaustin

Differential Revision: D46307686

fbshipit-source-id: 6f2a4e8e25757862ef17d56f92b90a95c7f5a474
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
25b673f8d0 Integrate with virtualInode
Summary: Integrating blake3 with virtual inode.

Reviewed By: chadaustin

Differential Revision: D46268717

fbshipit-source-id: c513a71e81691c43b0eada26aa5f1325a79db07b
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
fd3ab81bd3 Add blake3_sum
Summary: This utility binary could be used from the integration tests to compute blake3 hashes as it is easier to have it than adding the python pypi package with native dependencies.

Reviewed By: chadaustin

Differential Revision: D46307685

fbshipit-source-id: 1c48c689312cd9a04a19a62ad02ae3e9185041e5
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
d6dd01b37a Make LocalCachedBackingStore being able to compute blake3
Summary: If backing store doesn't provide a blake3 hash then we should be able to compute and cache it on demand.

Reviewed By: chadaustin

Differential Revision: D46316187

fbshipit-source-id: 9b77368ac5bb351d0edd80274b280692f8e1f774
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
4fca53249d ThriftUtil to support blake3
Summary: Adding some util functions to ThriftUtil to support blake3

Reviewed By: chadaustin

Differential Revision: D46268709

fbshipit-source-id: 1bc7b7b02ecb121e10e4b15036aa645466e7f762
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
6dc04add37 Integrate with TreeEntry and stores
Summary:
Adding blake3 support into TreeEntry and backing stores.

Note: Http and RE CAS stores don't provide blake3 hash so far. While it would be pretty easy to add support for RE, not sure how hard it would be for the http store.

Reviewed By: chadaustin

Differential Revision: D46268715

fbshipit-source-id: db66e63fe0348eb582a8050f22cdc0ff720ccf85
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
087566da69 Expose blake3 via aux and tree structures
Summary: Exposing blake3 from hg to eden

Reviewed By: chadaustin

Differential Revision: D46268710

fbshipit-source-id: 5f34b5f9586cc8c9507cc987378dc172959b4079
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
32a9f5eac5 Adding blake3 support
Summary:
Adding blake3 into the `Entry` and `Info` objects to make it possible to retrieve blake3 hashes.

The FileNode part will be integrated in the next diff

Reviewed By: chadaustin

Differential Revision: D46268719

fbshipit-source-id: b787b583e5abb3ed306fd1870f96bbdbc9fc0711
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
c663f1d624 Add blake3 support to FileHash utils
Summary: Adding blake3 support to the FileHash util that is used to compute hashes on Windows.

Reviewed By: chadaustin

Differential Revision: D46268714

fbshipit-source-id: cdca3dced494b1f37841121df09351acfdd6c745
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
66dee790bd Make it easier to use blake3
Summary: Frequently we will be operating with the blake3 key that is represented as `std::optional` so making it is easier to initialize blake3 appropriately.

Reviewed By: chadaustin

Differential Revision: D46268711

fbshipit-source-id: 2b9882683e79de2325d23353a4ca7260f3853f47
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
6cbc51fa1c Add Blake3 support to ObjectStore
Summary: Adding blake3 support to the Object store.

Reviewed By: chadaustin

Differential Revision: D44503947

fbshipit-source-id: 5112856576375a6fc0e697fa022506406844700a
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
3ae264c71c Add blake3 support to Serialized blob metadata
Summary:
Adding blake3 support to SerializedBlobMetadata.

* The serialized data is stored as:
   * - version (1 byte, big endian)
   * - blob_size (up to 10 bytes, big endian)
   * - used_hashes (1 byte, big-endian)
   * - hashes stored in order of their type values e.g. from less significant
   to more significant
   * - hash (N bytes)
   ...
   * - hash (M bytes)

Reviewed By: chadaustin

Differential Revision: D44500908

fbshipit-source-id: d64081db8591f85be5cdf3fd98ff9839c028d5fb
2023-06-05 23:41:35 -07:00
Barys Skarabahaty
306c59197a Add blake3 to blob metadata
Summary: Adding blake3 to the blob metadata

Reviewed By: chadaustin

Differential Revision: D44500745

fbshipit-source-id: 41809051b1d45b1512427f5fa830af3a9941148a
2023-06-05 23:41:35 -07:00
Muir Manders
716f8162d4 fix test-rename-merge2.t
Summary: Byte offset in error depends on environment.

Reviewed By: sggutier

Differential Revision: D46468819

fbshipit-source-id: 971f0655d88a9b76f1250e87d85d97a7d5be8828
2023-06-05 20:23:59 -07:00
Zhaolong Zhu
0ca377ce38 revset: add '-' for old working copy parent
Summary: Use `-` for old working copy parent, so we can easily go back to the previous working copy parent with `hg go -`. This is similar to `cd -` to go back to the previous folder.

Reviewed By: quark-zju

Differential Revision: D46368217

fbshipit-source-id: ab51992f8dde66a7535ba673892bbb6c0f01ecec
2023-06-05 18:47:04 -07:00
Shayne Fletcher
906e591ec8 codemods to remove lazy static 1/N
Summary:
first in a set of diffs with the intent of removing `lazy_static!` from fbcode.

this diff changes `std::sync::Mutex` and `parking_lot::Mutex` to plain `static` initializations where possible.

Reviewed By: zertosh

Differential Revision: D46335784

fbshipit-source-id: 105848f38dcb8083be77a4ad4db267058081fe53
2023-06-05 17:01:50 -07:00
Michael Christensen
1ffac63e6d debugnamecomplete: show 9 digits for autocompleted rev numbers
Summary: Show 9 characters for autocompleted revs, to match rev numbers shown in e.g. `hg sl`. This makes it a little easier to verify the rev that was autocompleted for you matches the one you were looking at in the smart log (i.e. if you're looking at the end of the rev rather than the beginning).

Reviewed By: zzl0

Differential Revision: D46398818

fbshipit-source-id: 70f19d60df7aa85371e1c1838b362b621da5b493
2023-06-05 11:12:48 -07:00
Saul Gutierrez
9b36c19d6d delete unused shutil import
Summary: This library doesn't seem to be used anymore in that file, so seems to be safe to delete it

Reviewed By: zzl0

Differential Revision: D46433066

fbshipit-source-id: 7c522b99048130f2ecd996e6ba901b5e5cccad2b
2023-06-05 10:54:44 -07:00
Andres Suarez
bef7ae79d2 Update openssl from 0.10.35 to 10.10.54
Reviewed By: dtolnay

Differential Revision: D46432065

fbshipit-source-id: 6a6c20e8b82accd9fe0dd4fc04d1d85a30dfa3e5
2023-06-05 06:35:30 -07:00
Youssef Ibrahim
40e9993707 delete reachabilityindex directory
Summary: saintelmosfire

Reviewed By: liubov-dmitrieva

Differential Revision: D46109912

fbshipit-source-id: 2c2f6a65164471b5fc7c1668e4577fb39ef58091
2023-06-04 23:27:57 -07:00
Youssef Ibrahim
448eafe8fb commit_graph: delete RangeNodeStream
Summary:
saintelmosfire
Will only land this after D45356044 is landed and tested.

Differential Revision: D45356043

fbshipit-source-id: 068aa45e1edd954b8ba5dc3355f9392ab06419b5
2023-06-04 23:27:57 -07:00
Youssef Ibrahim
1960074205 delete DifferenceOfUnionsOfAncestorsNodeStream
Summary: :)

Reviewed By: Croohand

Differential Revision: D45607812

fbshipit-source-id: ff65cc7850d2d538d014a414e43ef54b51d265e2
2023-06-04 23:27:57 -07:00
Youssef Ibrahim
8a8519f5d2 remove DifferenceOfUnionsOfAncestorsNodeStream from getbundle_response
Summary: :)

Reviewed By: liubov-dmitrieva

Differential Revision: D45607811

fbshipit-source-id: 2f6fbe6975b1ba3592a80268f41cbe2181c11c13
2023-06-04 23:27:57 -07:00
Youssef Ibrahim
ba0a8baf2e remove usages of DifferenceOfUnionsOfAncestorsNodeStream (except in getbundle_response)
Summary: :)

Reviewed By: markbt

Differential Revision: D45053470

fbshipit-source-id: 9e4dc4f92183b5369444e4e861a19614ba945fe3
2023-06-04 23:27:57 -07:00
Muir Manders
3f3bb6df3e filemerge: integrate merge tool script into tool selection
Summary:
Now we interpret merge tool specifications as "merge tool scripts" and evaluate them in the context of each conflicting file. This allows the merge tool script to use a different underlying tool depending on the type of conflict. For now, the only test the script can do is whether the file was deleted on one side.

In particular, we evaluate merge tools specified via "--tool", "HGMERGE", "ui:merge" config, and "merge-patterns" config.

Note that some existing valid inputs are invalid merge tool script (e.g. "--tool '/bin/sh do_something'"). It's invalid because of the space, among other potential reasons. I don't think this is common, but to work around it we let the input through un-intrepreted if it doesn't contain "if(" (i.e. doesn't look like a merge tool script that needs evaluating).

Reviewed By: quark-zju

Differential Revision: D46163268

fbshipit-source-id: 8a3d4b799e7f8d1d36bcc21035d7310de3d30ddb
2023-06-04 22:40:24 -07:00
Muir Manders
ac8e8b1813 filemerge: add wrapper for merge args
Summary:
Add a wrapper that contains the three file contexts. This will be used in next commit to simplify integration of "merge tool script" tool selection.

I tweaked the debugpickmergetool to allow specifying whether the local or other fctx is absent rather than the less specific "changedelete".

Reviewed By: quark-zju

Differential Revision: D46163269

fbshipit-source-id: 184ca01ca9dc3bdf80d2ec23f2e0a3f1d745f581
2023-06-04 22:40:24 -07:00
Muir Manders
e955a5eda2 filemerge: add start of simple merge tool DSL
Summary:
A user wants to use a different merge tool for delete+modified conflicts. The current merge tools are not flexible or composable enough to handle this. For example, even if we added a ":delete-keep-local" tool, there is no way to specify the fallback merge tool to use for other kinds of conflicts.

In this diff I introduce a simple DSL to solve the above problem. I called it "merge tool script". It only supports the "if" function, and "isabsent" to test of the "local" or "other" file context is absent/deleted.

Reviewed By: zzl0

Differential Revision: D46163270

fbshipit-source-id: 28f2579e665dc9dd66ab816b10e0b7a758e772f5
2023-06-04 22:40:24 -07:00
Muir Manders
67ef3afc23 parser: factor out string parsing
Summary: Move string parsing code from revsetlang.py into the parser so other langs can use it.

Reviewed By: zzl0

Differential Revision: D46194125

fbshipit-source-id: cb8c829ceb52a829a831a33b4265410ef704fef9
2023-06-04 22:40:24 -07:00
Muir Manders
1fd96b9a1d merge: remove v1 merge state
Summary: v1 and v2 have both been written out forever, so I think we can drop the v1 format.

Reviewed By: zzl0

Differential Revision: D46075828

fbshipit-source-id: 373dae9cf6a53534489022716986aa85b5de5552
2023-06-04 21:54:48 -07:00
Shayne Fletcher
4ea1ce14a8 upgrade to parking_lot-0.12.1
Summary: upgrade parking_lot from version 0.11.2 to version 0.12.1

Reviewed By: zertosh, diliop, dtolnay

Differential Revision: D46398501

fbshipit-source-id: ffae0ea188abad5253f1524216dd18ce9a53a74c
2023-06-02 18:45:03 -07:00
Rajiv Sharma
0443bba2cf Migrate check_git_wc command to new Mononoke App
Summary: As in title

Reviewed By: mitrandir77

Differential Revision: D46354685

fbshipit-source-id: 2a3e7e86772c71aed18cc6c83c31767c7454d65c
2023-06-02 12:00:47 -07:00
Andres Suarez
51fc649c56 unfork and update toml-5
Reviewed By: jsgf

Differential Revision: D46369474

fbshipit-source-id: 2905c96f24f3a6963c69ed89572ce36e564443d6
2023-06-02 08:04:49 -07:00
Rajiv Sharma
11982fe8da Log create_bookmark error in gitimport
Summary:
In D41769964, we decided not to stop `gitimport` simply because `create-bookmark` fails cause that could be due to the fact that the bookmark being created already exists. If that is indeed the case, we try to resolve the bookmark and move it to the new value. However, there could be other unrelated reasons for `create_bookmark` to fail in which case we would still try to resolve the bookmark and end up in unexpected situations (e.g. Luibov trying to import `paws` repo faced this problem). This diff does two things:
- Performs an early check to determine if the bookmark exists by resolving it. If it does exist, it executes the move bookmark branch of code
- If the bookmark doesn't exist, then it creates it.

If there are any errors during bookmark creation or movement, they get logged for the user.

Reviewed By: mitrandir77

Differential Revision: D46071703

fbshipit-source-id: 446b0bc720d13b9e9314feccdb147b2bab0b7cd9
2023-06-02 06:52:56 -07:00
Jeremy Fitzhardinge
1ae4f69513 third-party/rust: update text_placeholder with https://github.com/bernardoamc/text-placeholder/pull/7
Summary: Added `fill_from_function` which makes it much more useful

Reviewed By: fanzeyi

Differential Revision: D46342378

fbshipit-source-id: 9bc8c01dcb10806a03f1eab628f9763c4e5edc81
2023-06-02 03:29:24 -07:00
Pierre Chevalier
c7c032c6fb non-oss work 67/n
Differential Revision: D46326058

fbshipit-source-id: 70db644c1badfcefddea80ce9961b9f547388192
2023-06-02 02:52:32 -07:00
Xavier Deguillard
b26ca0d334 store: properly time ObjectStore::getBlobMetadata
Summary:
Our telemetry was showing that starting mid-April the cost of
ObjectStore::getBlobmetadata went down significantly but investigating the root
cause of the improvement didn't seem to yield any results. It turns out the
root cause was that the code no longer timed the cost of the future.

Reviewed By: kmancini

Differential Revision: D46369667

fbshipit-source-id: 0c7d997c93d94498384e27b3447a9c736dcce3b2
2023-06-01 15:51:45 -07:00
Zhaolong Zhu
ccec2d4263 copytrace: exclude files that are not in the dest manifest
Summary:
the previous change broke `test-fb-ext-copytrace.t` tests, but somehow the failure didn't show up in the CI, this is to fix the that.

The issue happened when rebasing 8f852f229 (mv a b) to 046961699 (del a), and file `a` doesn't in the dest commit. The old logic is to keep b in the final commit, and my previous abort with an error that a is not in dest. I think a better way is to report a conflict and ask users to resolve it. But for now, I will keep the old behevior.

```
  @  046961699  72 seconds ago  zhaolong
  │  del a
  │
  │ o  8f852f229  107 seconds ago  zhaolong
  ├─╯  mv a b
  │
  o  7a737d7e6  2 minutes ago  zhaolong
╭─╯  add a
```

Reviewed By: sggutier

Differential Revision: D46357844

fbshipit-source-id: f5860c0037b909e2dd1a62700775dba505b88849
2023-06-01 10:32:04 -07:00
Saul Gutierrez
d430d13cb5 tests: move environment related utils to their own crate
Summary: The `lock_env` function from `scm/lib/config/loader/src/test_util.rs` was way too useful to leave in its own crate, since it could be useful for Rust unit tests that modified environment variables

Reviewed By: quark-zju

Differential Revision: D46133861

fbshipit-source-id: b32842c55bd7279490f69601fbb22201da7a0767
2023-06-01 05:52:37 -07:00
Saul Gutierrez
8de3e9d5d8 io: add an IOInput trait
Summary: Adds a trait similar to `IOOutput`, which can be used for determining whether the input object held by `IO` is in a tty

Reviewed By: zzl0

Differential Revision: D46129268

fbshipit-source-id: 2fe2b19baf85d6ba361e515cd9e017bda628cc60
2023-06-01 05:52:37 -07:00
Saul Gutierrez
50d51ee002 configfile: move steps for obtaining default user config file to its own function
Summary: This function will be used in later diffs for determining the default user config file

Reviewed By: muirdm

Differential Revision: D46005612

fbshipit-source-id: 52a0fcba6fbb3d47d24c759d3ff946301ccaa922
2023-06-01 05:52:37 -07:00
Zhaolong Zhu
6a94e0c7f8 copytrace: use dagcopytrace to trace renames for src missing files
Summary:
Currently, the `_forwardcopies` doesn't support git format repo, which
means copytrace can not find the renames on the source side.  So let's use
`dagcopytrace` for it as well. It also benefits hg format repos as well, since
`dagcopytrace` support content similarity based rename finder.

Reviewed By: quark-zju

Differential Revision: D46315431

fbshipit-source-id: 5f9ba4a9346f1dbd7e96731b9559dfe686ff028c
2023-05-31 21:42:03 -07:00
Zhaolong Zhu
f276a73c2e copytrace: add .t test for testing missing files in source side
Summary:
Currently, the `_forwardcopies` doesn't support git format repo, which
means copytrace can not find the renames on the source side. Add a test to
reproduce this issue.

Reviewed By: quark-zju

Differential Revision: D46315430

fbshipit-source-id: c25f8db6da121a7baa02045720b867c08845f169
2023-05-31 21:42:03 -07:00
Zhaolong Zhu
46b2feabcb copytrace: remove unnecessary pub(crate)
Summary: remove unnecessary pub(crate)

Reviewed By: quark-zju

Differential Revision: D46315432

fbshipit-source-id: 239150866b721818fa7816ac505ed3d56e4ae719
2023-05-31 21:42:03 -07:00
Xavier Deguillard
1c20e574cc telemetry: fix typo in counter name
Summary:
Both the getBlobMetadata and fetchBlobMetadata were publishing to the same counter, making them indistinguishable.

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: genevievehelsel

Differential Revision: D46343472

fbshipit-source-id: 04e09372c21dd5cb09336259ff34a5394d10d3b4
2023-05-31 20:38:26 -07:00
Liubov Dmitrieva
45565b3045 add new ods logging for bookmark fetching from phases crate
Summary:
add new ods logging for bookmark fetching from phases crate

This would help with investigation sevs like S344849, also having this info we
can setup alerts.

Reviewed By: YousefSalama

Differential Revision: D46314640

fbshipit-source-id: 66e72da19ad4eb528c78d0783c297746f57cd4f1
2023-05-31 13:57:24 -07:00
Xavier Deguillard
61b02f8f86 Back out "linearize control flow in EdenServer::mount"
Summary:
We've seen crashes on Windows when the mount is initialized but a later step at
mount time fails. In between these 2 events, if a write to the working copy
happens the ProjectedFS code assumes that the InodeMap is initialized and thus
tries to access the rootInode. This assumption is unfortunately broken by the
call to mountFinished and the code should instead follow the regular unmount
code path to make sure that no pending notifications are inflight.

I suspect NFS and FUSE also would exhibit the same issue.

Reviewed By: kmancini

Differential Revision: D46169999

fbshipit-source-id: ed1eb17dc2f084acb7e2d88c555150b3b8c6662e
2023-05-31 12:15:03 -07:00
Pierre Chevalier
2db9d7227d Enable shard manager to load unredacted repos
Summary:
This offers a  new interface for Shard Manager managed repos to be able to load redacted content.

The new API entry point: `open_managed_repos_unredacted` is analogous to `open_repo_unredacted`, but supports a Shard Manager based workflow.

Reviewed By: RajivTS

Differential Revision: D46280863

fbshipit-source-id: e2e4aebcb08d01f3be97d11d6fe8da2822ba6f29
2023-05-31 04:50:12 -07:00
Pierre Chevalier
4c8b8f43b6 non-oss work 61/n
Differential Revision: D46228970

fbshipit-source-id: 81a0b823ef88e27c324f16de412fce0d10bf7633
2023-05-31 04:50:12 -07:00
Barys Skarabahaty
cecd3a9582 Adding a possibility to configure the blake3 key
Summary: Adding a way to configure the blake3 key for blake3 hashing

Reviewed By: chadaustin

Differential Revision: D44499469

fbshipit-source-id: 344edd91cfc867c8a49d0db9369dfe2132e86c77
2023-05-30 23:10:10 -07:00
Zhaolong Zhu
3bc3732b8d copytrace: add metrics for content similarity fallback result
Summary: I am planning to enable `copytrace.fallback-to-content-similarity=True` for hg repos, and will use this metric to monitor how useful the content similarity fallback is

Reviewed By: muirdm

Differential Revision: D46163311

fbshipit-source-id: d21b0288965f8ec4da7c6c80e37d1b557b357ea6
2023-05-30 20:32:55 -07:00
Zhaolong Zhu
19d7f8214c copytrace: make dagcopytrace instance a singleton
Summary: Our cache is in the dagcopytrace instance, so let's make it a singleton.

Reviewed By: quark-zju

Differential Revision: D46105882

fbshipit-source-id: 0984015e7b052482b27f950fc05563c432aa23b1
2023-05-30 20:32:55 -07:00
Zhaolong Zhu
d9171bcf51 copytrace: add batch move candidates cache for rename finders
Summary: Optimization for directory move caused renames.

Reviewed By: muirdm

Differential Revision: D46105883

fbshipit-source-id: 69aee540b14cde9112f6327b6c782714109cac04
2023-05-30 20:32:55 -07:00
Zhaolong Zhu
875c353d48 copytrace: add test for batch move
Summary: Add tests for dir move

Reviewed By: muirdm

Differential Revision: D46149478

fbshipit-source-id: 28d98a33ac2f1c47e407f744ecfa496e4376e4bd
2023-05-30 20:32:55 -07:00
Zhaolong Zhu
96f993dcae copytrace: add batch move detection
Summary: this function will be used in the following diff

Reviewed By: quark-zju

Differential Revision: D46105885

fbshipit-source-id: 9d02fb62a44b1e5bd18eba5236522e297fae0f64
2023-05-30 20:32:55 -07:00
Rajiv Sharma
af2314d831 Using BonsaiTagMapping in GitImport and RemoteGitImport
Summary:
This diff modifies the behavior of `gitimport` and `remote-gitimport` when importing `annotated-tags`. In addition to:
- storing the raw tag
- converting the tag to a bookmark
- storing the metadata of the tag as changeset
this diff maintains a mapping between the tag-name and the changeset representing the metadata of the tag. This mapping would be useful to answer queries about the tag metadata when queried through Git and also enable going back to Git from Mononoke without losing data.

Differential Revision: D46067809

fbshipit-source-id: e2463160cdf647b50fa4ecfe4674d079016b4adc
2023-05-30 12:20:40 -07:00
Youssef Ibrahim
79fd5fd16a mononoke_api: implement an alternative to ChangesetPathHistoryContext::history using the new commit graph
Summary: Implement an alternative to ChangesetPathHistory::history using the new commit graph. This is almost identical to the skiplist implementation except that an (incorrect) optimization was removed that was trying to minimize the number of is_ancestor queries which should no longer be needed as they are a lot faster with the new commit graph.

Differential Revision: D46109911

fbshipit-source-id: 3e8f0c36a48084116673dda3741de87e0741f1a2
2023-05-30 11:47:19 -07:00
Youssef Ibrahim
81063c4c9d mononoke_api: implement an alternative to ChangesetContext::history using the new commit graph
Summary: Implement an alternative to ChangesetContext::history using the new commit graph by using AncestorsStreamBuilder. Also made the tests not depend on the exact output history order but instead accept any topological order.

Differential Revision: D46109910

fbshipit-source-id: 31f3e219e9addf04b49fc500ad245d541f110887
2023-05-30 11:47:19 -07:00
Youssef Ibrahim
899a3aed12 commit_graph: implement AncestorsStreamBuilder
Summary:
Factors out the logic of creating an ancestors stream to a builder to allow for more customizability (required for ChangesetContext::history) and reduce code duplication.
Additionally this optimizes range_stream to only traverse changesets that are descendants of start_id. Ancestry checks are kept to a minimum (worst case O(merges)) by only checking on parents of changesets that have a skip tree parent with generation lower than the generation of start_id.

Reviewed By: liubov-dmitrieva

Differential Revision: D46276429

fbshipit-source-id: 65c4f2892c92baaab0fef4f5041f06095ec49e05
2023-05-30 11:47:19 -07:00
Egor Tkachenko
7ee654f3e8 Add facet to interact with deletion log db
Summary: Facet and related boilerplate to construct it

Differential Revision: D46153855

fbshipit-source-id: 480d69deb4ff714541970e63df775a500e2cbb33
2023-05-30 02:01:31 -07:00
Genevieve (Genna) Helsel
d3ae451c74 allow using SqliteOverlay on non-Windows
Summary: allow using `SqliteOverlay` on non-Windows, since  OverlayChecker has now been updated to work with it.

Reviewed By: chadaustin

Differential Revision: D44105360

fbshipit-source-id: 5f78e6c9b5323faeee394da4a51d7e84f8d44a2f
2023-05-29 22:38:14 -07:00
Xavier Deguillard
71eebd2356 store: fix a nullptr derefence in LocalStoreCachedBackingStore
Summary:
In the rare case where fetching both the BlobMetadata and the Blob failed, the
LocalStoreCachedBackingStore would still try to dereference the nullptr Blob,
leading to a crash.

Reviewed By: chadaustin

Differential Revision: D46211469

fbshipit-source-id: f98dd215dbda432507f3823439d354d3d662dc6f
2023-05-26 09:16:16 -07:00
Youssef Ibrahim
3febd2a8eb commit_graph: add a newadmin command for finding children of a commit
Summary: We didn't have a way to do this before so let's add it.

Reviewed By: mitrandir77

Differential Revision: D46190481

fbshipit-source-id: 84544f0226ef3a4ef4d8ac9b4bf66551e4671793
2023-05-26 04:38:42 -07:00
Jan Mazur
79a82015aa remove dependency on MononokeApp
Summary: It's not ideal that we pull mononoke_app and even instantiate MononokeApp here. This is an attempt to decouple Mononoke from Metagit.

Reviewed By: mitrandir77

Differential Revision: D45862434

fbshipit-source-id: 6eab3577743810461f22535d89cf9a00dc1cbb65
2023-05-26 04:22:23 -07:00
Youssef Ibrahim
4634db2c84 commit_graph: asyncify closures in _with methods
Summary: Most of the useful ways to use these methods requires providing an async closure so let's asyncify them.

Reviewed By: RajivTS

Differential Revision: D45607981

fbshipit-source-id: ee7b471cc5d60a793a79928f6c15c48c0da1d08e
2023-05-26 02:12:44 -07:00
Zhaolong Zhu
37913dc1a8 fbscmquery: avoid scanning the repo when revision translation is failed
Summary: Currently, the code scans the repo when revision translation is failed, which is very slow.

Reviewed By: muirdm

Differential Revision: D46200075

fbshipit-source-id: 31eaca43582b480a0b3abd7af0b27ec8d6406195
2023-05-25 18:37:50 -07:00
Zhaolong Zhu
5af2319270 copytrace: abstract generate_candidates
Summary:
We get both `added` and `deleted` files in the function, this will be
needed for directory move detection.

Reviewed By: muirdm

Differential Revision: D46105884

fbshipit-source-id: d0081f8afaf27ef4ab105ab7c58b3f5cc694debc
2023-05-25 15:58:54 -07:00
Xavier Deguillard
fdbf7eadfb store: add telemetry for LocalStore operations
Summary:
We've seen a case where a large `hg update` was taking an absurdly long time in
`ObjectStore::getTree` but the telemetry was showing us that most of the time
wasn't spent fetching trees from Mercurial! The suspicion is that most of the
time was spent in the LocalStore but with no evidence to prove it.

Let's thus add some timing telemetry to various LocalStore read requests to
fill this gap.

Reviewed By: mshroyer

Differential Revision: D46154456

fbshipit-source-id: b439ac48889ed3db71db136ff6c1cc91f48c926a
2023-05-25 15:48:11 -07:00
Genevieve (Genna) Helsel
006d26a094 extend FsckTest to test SqliteOverlay
Summary:
Extends `FsckTest` to test `SqliteOverlay`. Two major changes were made to non-test files:
1) `loadInodeInfo` was moved from `OverlayChecker` into `InodeCatalog`
2) `getAllParentInodeNumbers` was added to facilitate `OverlayChecker::readInodes`

Reviewed By: chadaustin

Differential Revision: D45447172

fbshipit-source-id: 9ad291a0c4c34f1e44e1f05c1fdbf2ac7ea7d309
2023-05-25 13:50:56 -07:00
Youssef Ibrahim
84661b9dd0 commit_graph: add a sleep in update-preloaded command to prevent exiting before writing to all inner blobstores
Summary: In the case of a multiplexed blobstore, the put operation can exit after it succeeds in one inner blobstore before finishing in all, and leave the rest running in the background. This sleep tries to prevent exiting early before they all finish.

Reviewed By: mitrandir77

Differential Revision: D46190037

fbshipit-source-id: ac2ae0d1453ebdc923170b9da7ca98df7519bf52
2023-05-25 11:00:34 -07:00
Genevieve (Genna) Helsel
e95b17e5a6 move OverlayChecker into eden/fs/inodes/overlay
Summary: This will no longer be tied to the fscatalog, so it makes more sense to live in a more general location

Reviewed By: chadaustin

Differential Revision: D44980396

fbshipit-source-id: 3cabf00d87df7eb00671c2b82b04c8f12283e394
2023-05-25 10:10:08 -07:00
Youssef Ibrahim
8427780527 commit_graph: implement fetching children of a changeset
Summary: Implements a public method changeset_children in CommitGraph that fetches the changeset ids of the children of a given changeset.

Differential Revision: D46185434

fbshipit-source-id: f0b2e2ee53c7a34fe94ee5ef1f74f6e31429d056
2023-05-25 09:32:10 -07:00
Liubov Dmitrieva
8a3498edfa used cached version of API
Summary: used cached version of API

Reviewed By: YousefSalama

Differential Revision: D46184380

fbshipit-source-id: 5deb8c455ad682afcf1f0cad822d34fdd632b88b
2023-05-25 06:40:27 -07:00
Xavier Deguillard
e73ab91be0 store: add telemetry for where Tree were obtained from
Summary:
Telemetry exist for where Blob and BlobMetadata are coming from, but not for
Tree. Let's bring the Tree telemetry up to par.

Reviewed By: genevievehelsel

Differential Revision: D46154455

fbshipit-source-id: ab3c31d55b6a91009289b3b07853fa574bbaa137
2023-05-24 17:08:42 -07:00
Katie Mancini
5dac894df8 remove debugGetScmBlobMetadata
Summary:
I migrated the last caller of debugGetScmBlobMetadata to debugGetBlobMetadata
in the last diff. Let's delete the old method.

I am not really concerned about waiting for that lower diff to rollout and all
because this is a debugging command that we only sparingly ask users to run
(As far as I know like maybe 3 times).

Reviewed By: chadaustin

Differential Revision: D45972617

fbshipit-source-id: 6d4689a225fee972f8e3a802115852043f0bade8
2023-05-24 16:41:02 -07:00
Katie Mancini
5458cd7045 migrate last debugGetScmBlobMetadata call to debugGetBlobMetadata
Summary:
I created debugGetBlobMetadata a while ago and this is the last caller of
debugGetScmBlobMetadata. Let's migrate it to the new endpoint so we can delete
the old one.

Reviewed By: chadaustin

Differential Revision: D45972618

fbshipit-source-id: cbb0977260f9a1543d3bf0a31bf7b948c2f35143
2023-05-24 16:41:02 -07:00
Katie Mancini
b981977a84 remove debugGetScmBlob
Summary:
I created debugGetBlob a while ago and there are no more callers of
debugGetScmBlob from code search, so let's delete this.

Reviewed By: chadaustin

Differential Revision: D45972619

fbshipit-source-id: 97276ec2182fbe7d9022a06e9a0df34ae4e80235
2023-05-24 16:41:02 -07:00
Rajiv Sharma
ffa2587292 Use fb303 extension in Admin tool
Summary: The admin tool currently doesn't register the `fb303` extension with `MononokeApp` during its creation. This makes the tool incapable of registering for health check and responding to thrift health check requests by TW. In absence of ALIVE response from the job, TW ends up killing it. This diff adds the extension during `MononokeApp` construction. This will not impact admin tool's usage through CLI but the error messages in the integration tests will need to be updated.

Differential Revision: D46147128

fbshipit-source-id: f06b8bcdce938346726b9ff520a3d809d9fda6fc
2023-05-24 14:21:51 -07:00
Youssef Ibrahim
c344d94066 edenapi: gate streaming commit graph endpoint behind a tunable
Summary: Makes it easier to rollback

Reviewed By: mitrandir77

Differential Revision: D46156526

fbshipit-source-id: eae70801069d09ab03b3b683712d9353fb1e5a43
2023-05-24 14:14:19 -07:00
Genevieve (Genna) Helsel
23832acbf3 default to using buffered overlay
Reviewed By: chadaustin

Differential Revision: D45541124

fbshipit-source-id: bc6392cfd6ae8aa592a5e5546bd7d14df394a6dc
2023-05-24 13:11:13 -07:00
Xavier Deguillard
c88363c998 store: remove BlobMetadata computation/caching when getting blob
Summary:
EdenFS contains several layers of caching for BlobMetadata:
 - In the hgcache,
 - In the in-memory BlobMetadata cache,
 - In the LocalStore (configurable),
 - In the FileInode,
 - In the TreeEntry,

All of the above must be filled prior to reading a blob, therefore computing
the sha1+size when reading a blob is likely not needed and superfluous.

Alternatively, we could move the code to be done in the background in the
LocalStoreCachedBackingStore to avoid blocking reading the blob. Reviewers
opinions are welcome!

Reviewed By: chadaustin

Differential Revision: D45625432

fbshipit-source-id: ad7d897c32cbfd590dce5a3a9c8073349e9b70c8
2023-05-24 10:26:51 -07:00
Rajiv Sharma
eec4c1cdd4 Modify bookmark get admin command to handle annotated tags
Summary: The bookmark `get` command simply displays the changeset that is pointed to by the bookmark. This diff modifies the command to also handle git annotated tags converted into bookmarks. If the bookmark is a tag bookmark, then the command also outputs the metadata changeset associated with the bookmark. This will be useful for validating that imported annotated tags retain their metadata through metadata changesets.

Differential Revision: D46022692

fbshipit-source-id: b3980f4799066913268ef7acc1f4956d3feb5b23
2023-05-24 07:11:26 -07:00
Rajiv Sharma
3c830eaeb0 Add factory builder methods for BonsaiTagMapping
Summary: `BonsaiTagMapping` exists as a facet so let's add the appropriate builder methods in `RepoFactory` and `TestRepoFactory`. Follow-up diffs will add this new facet in the `Repo` facet container for `SCS` (for `remote-gitimport`) and in `gitimport`.

Differential Revision: D46020528

fbshipit-source-id: 88e65a498355bf21edc8c8d8aa3755a5507fe991
2023-05-24 07:11:26 -07:00
Rajiv Sharma
d3afd74c9a Utilize ContentMetadataV2 in metadata-diff endpoint
Summary:
The `metadata-diff` endpoint in SCS is used by Phabricator to get information about the difference between files of two commits. Currently, this endpoint works using raw file content. This diff makes the following optimizations:
- Avoids loading file content in memory if the file is `binary` or `non-utf8`
- Avoids parsing `generated` and `partially-generated` tags if the file is known to be neither
- Avoid parsing raw file bytes into UTF-8 string if the file is non-generated

These optimizations will be most helpful for the case of `binary` or `non-utf8` files but should improve performance of the endpoint in general.

Reviewed By: YousefSalama

Differential Revision: D46109336

fbshipit-source-id: b3c915005686f77defceeb53f1587049bc8b6bd8
2023-05-24 03:55:49 -07:00
Zhaolong Zhu
c6c3779843 remotefilelog: remove unnecessary file ancestor process
Summary: Remove unnecessary file ancestor process and their cache.

Reviewed By: muirdm

Differential Revision: D45898747

fbshipit-source-id: a540a937f98a63a93a71f5bb3e5befe0a56de1d8
2023-05-23 19:31:53 -07:00
Chad Austin
e858234e94 add OBJECT_ID attribute to getAttributesFromFilesV2
Summary:
For tools that want to take advantage of the same fast-path logic when
directories don't change across updates, expose a semistable ID they
can use to cache derived data or get a rough understand when a
directory has changed its contents.

Reviewed By: kmancini, xavierd

Differential Revision: D45974142

fbshipit-source-id: 7b2b482876b07e73514a936e198de2dc31ed1597
2023-05-23 19:12:06 -07:00
Chad Austin
3495e3731c split readdir integration tests into a separate file
Summary:
thrift_test is pretty general. For something like getFileAttributes,
getFileAttributesV2, and readdir, it's nice to have them in one file.

Reviewed By: kmancini

Differential Revision: D45974095

fbshipit-source-id: ca5ecd4795f1d278f4de5b83cb8c9af94c111902
2023-05-23 19:12:06 -07:00
Genevieve (Genna) Helsel
1148997dcb migrate edenfsctl fsck to C++
Reviewed By: chadaustin

Differential Revision: D44473843

fbshipit-source-id: 01c46e1cd50b73e6c0d13d00fd42a7da81abc01c
2023-05-23 13:33:07 -07:00
Youssef Ibrahim
97ab9db5df commit_graph: replace usages of LeastCommonAncestorsHint::is_ancestor and ReachabilityIndex::query_reachability (conditional on a tunable) (except in ChangesetPathContext)
Summary: :O

Reviewed By: mitrandir77

Differential Revision: D45607344

fbshipit-source-id: 2a0438cd7cff0e782eab4843f0436b5400d773aa
2023-05-23 11:26:11 -07:00
Youssef Ibrahim
77cb2d63e4 replace slice_repository with CommitGraph::slice_ancestors and delete commit_traversal directory
Summary: saintelmosfire

Reviewed By: mitrandir77

Differential Revision: D45607345

fbshipit-source-id: 638eb537b8f475fc9e6ae85dfbeabf8290105d1e
2023-05-23 11:26:11 -07:00
Youssef Ibrahim
608dc8dd0e commit_graph: implement slice_ancestors
Summary: Implement an alternative to slice_repository using the new commit graph that doesn't depend on the skiplist. Useful when doing any kind of processing that requires ancestors to be processed first (backfilling derived data, mirroring commits, ...)

Reviewed By: mitrandir77

Differential Revision: D45607347

fbshipit-source-id: b2012972472e718522e4f33ff01fc9b253b76fff
2023-05-23 11:26:11 -07:00
Youssef Ibrahim
f4e7296e5e commit_graph_types: move ChangesetFrontier to a separate module
Summary: Makes slightly more sense

Reviewed By: mitrandir77

Differential Revision: D45607346

fbshipit-source-id: 6b505796da96ff24cd7d555290dcf341f93c797f
2023-05-23 11:26:11 -07:00
Youssef Ibrahim
6205656019 commit_graph: split CommitGraph impl
Summary: My fingers are tired from scrolling

Reviewed By: mitrandir77

Differential Revision: D45607349

fbshipit-source-id: fe366797a37fbd1682ca917d6bdd39c88195c8e9
2023-05-23 11:26:11 -07:00
Youssef Ibrahim
938110f792 mononoke_api: use new commit graph common_base conditional on a tunable
Summary: :O

Reviewed By: mitrandir77

Differential Revision: D45607348

fbshipit-source-id: 8a0bbec488961007912d1ef865439a023c388437
2023-05-23 11:26:11 -07:00
Youssef Ibrahim
d9b60cffa2 commit_graph: implement common_base
Summary: common_base returns all of the highest generation changesets that are common ancestors of two changesets. Implementation is optimized for the most common case were there are no merges between the two changesets and their lowest common ancestor (taking O(log(height) iterations in that case), but is sound for all cases.

Reviewed By: mitrandir77

Differential Revision: D45480232

fbshipit-source-id: 147b6feaa57cdbeb5efb4b77335728f38105fb87
2023-05-23 11:26:11 -07:00
Stiopa Koltsov
f67b9e37bf Upgrade plist
Summary:
The changed something in 0.5 version, and cargo compilation of buck2 broke.

Let's just use latest version.

Reviewed By: zertosh

Differential Revision: D46106140

fbshipit-source-id: 67f4f63eff8e80be8408089003f1171e8b0e1865
2023-05-23 08:49:53 -07:00
Mateusz Kwapich
a7769f4207 add retries to move_bookmark call
Summary:
The bookmark update log is sequential and we can't write two things to it at
once (for a single repo). The aosp megarepo infra sometimes moves two bookmarks
concurrently and hits this ugly race: P743467889. Let's add retries to failed
bookmark moves.

Reviewed By: YousefSalama

Differential Revision: D46105621

fbshipit-source-id: 5c822301fc3201b070c1fe29eda6c395d265c33f
2023-05-23 07:33:20 -07:00
Rajiv Sharma
89792c6232 Unit tests for bonsai_tag_mapping
Summary: This diff adds unit tests to validate that the `BonsaiTagMapping` implementation works as expected.

Reviewed By: mitrandir77

Differential Revision: D46020108

fbshipit-source-id: 12e8268363f0917645a5eadd37eff321b510b755
2023-05-23 04:02:13 -07:00
Youssef Ibrahim
b9c436cdba repo_factory: construct preloaded commit graph depending on repo config
Summary: Constructs a preloaded commit graph when preloaded_commit_graph_blobstore_key is set in repo config.

Reviewed By: RajivTS

Differential Revision: D45993556

fbshipit-source-id: 3dd22617cbabcc007d02965e7392eb2f5283b1b8
2023-05-22 15:15:01 -07:00
Youssef Ibrahim
8f1a4a8c38 add repo config for specifying preloaded commit graph blobstore key
Summary: We need a way to specify which repos will use a preloaded commit graph and the blobstore key of the commit graph blob in that case.

Reviewed By: RajivTS

Differential Revision: D45993558

fbshipit-source-id: 4cf2ea84b72e3a50187fab3ece86e623a754d571
2023-05-22 15:15:01 -07:00
Youssef Ibrahim
8b2561119a newadmin: add command for updating/building preloaded commit graph blob
Summary: Adds a new command update-preloaded that tries to load a blob of the preloaded commit graph, update it with any newly added changeset edges, and re-upload it to the blobstore.

Reviewed By: mitrandir77

Differential Revision: D45993560

fbshipit-source-id: 4d14cbf091d86f165ed58fbba9305f0fa6021632
2023-05-22 15:15:01 -07:00
Youssef Ibrahim
1b8ae05406 commit_graph: implement PreloadedCommitGraphStorage
Summary: Implements a commit graph storage for preloading commit graph edges in memory. Useful for repos with complicated commit graph structures but relatively small overall size. It uses Reloader to periodically update the preloaded edges. CompactChangesetEdges are introduced to lower the memory usage by referencing other changesets using interned ids.

Reviewed By: mitrandir77

Differential Revision: D45992604

fbshipit-source-id: 5852079d10a0ba8c491e7b239d8cf4c58813dd45
2023-05-22 15:15:01 -07:00
Youssef Ibrahim
2ddd469c08 commit_graph: move thrift types and conversions to commit_graph_types
Summary: These are not specific to caching so let's move them

Reviewed By: RajivTS

Differential Revision: D45993559

fbshipit-source-id: b5f127bf2997c4bf5381013df10af28f1c42c1c9
2023-05-22 15:15:01 -07:00