Skip to content

Commit d3edf5c

Browse files
gustavoavenameta-codesync[bot]
authored andcommitted
code_tenting: Fix mononoke build after race condition
Summary: D91887015 landed around the same time as D95219906. They weren't conflicting, but are incompatible and broke the build. This just updates content manifest code to do the same thing done in fsnodes. Reviewed By: Joald Differential Revision: D96010294 fbshipit-source-id: 9e6ac2694b937b7b51363d9b6635a86dae2b6cf3
1 parent 150e663 commit d3edf5c

File tree

4 files changed

+30
-28
lines changed

4 files changed

+30
-28
lines changed

eden/mononoke/derived_data/content_manifest_derivation/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ rust_library(
3838
"//eden/mononoke/derived_data/remote/if:derived_data_service_if-rust",
3939
"//eden/mononoke/manifest:manifest",
4040
"//eden/mononoke/mononoke_types:mononoke_types",
41-
"//eden/mononoke/repo_attributes/restricted_paths:restricted_paths",
41+
"//eden/mononoke/repo_attributes/restricted_paths_common:restricted_paths_common",
4242
"//eden/mononoke/servers/slapi/slapi_server/context:context",
4343
],
4444
)

eden/mononoke/derived_data/content_manifest_derivation/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ futures = { version = "0.3.31", features = ["async-await", "compat"] }
2222
justknobs = { version = "0.1.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" }
2323
manifest = { version = "0.1.0", path = "../../manifest" }
2424
mononoke_types = { version = "0.1.0", path = "../../mononoke_types" }
25-
restricted_paths = { version = "0.1.0", path = "../../repo_attributes/restricted_paths" }
25+
restricted_paths_common = { version = "0.1.0", path = "../../repo_attributes/restricted_paths_common" }
2626
thiserror = "2.0.18"
2727
tracing = { version = "0.1.41", features = ["attributes", "valuable"] }
2828

eden/mononoke/derived_data/content_manifest_derivation/src/derive.rs

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ use mononoke_types::content_manifest::ContentManifestFile;
4141
use mononoke_types::content_manifest::ContentManifestRollupData;
4242
use mononoke_types::sharded_map_v2::LoadableShardedMapV2Node;
4343
use mononoke_types::sharded_map_v2::ShardedMapV2Node;
44-
use restricted_paths::ManifestId;
45-
use restricted_paths::ManifestType;
46-
use restricted_paths::RestrictedPathManifestIdEntry;
47-
use restricted_paths::RestrictedPaths;
44+
use restricted_paths_common::ManifestId;
45+
use restricted_paths_common::ManifestType;
46+
use restricted_paths_common::RestrictedPathManifestIdEntry;
47+
use restricted_paths_common::RestrictedPathsConfigBased;
4848

4949
use crate::ContentManifestDerivationError;
5050
use crate::RootContentManifestId;
@@ -150,7 +150,7 @@ pub(crate) async fn create_content_manifest_directory(
150150
ctx: CoreContext,
151151
blobstore: Arc<dyn KeyedBlobstore>,
152152
path: &MPath,
153-
restricted_paths: &Arc<RestrictedPaths>,
153+
restricted_paths: &Arc<RestrictedPathsConfigBased>,
154154
subentries: TreeInfoSubentries<
155155
ContentManifestId,
156156
ContentManifestFile,
@@ -193,26 +193,28 @@ pub(crate) async fn create_content_manifest_directory(
193193
Some("content_manifest_write"),
194194
)?;
195195

196-
if restricted_paths_enabled
197-
&& let Some(non_root_path) = path.clone().into_optional_non_root_path()
198-
&& restricted_paths.is_restricted_path(&non_root_path)
199-
{
200-
let entry = RestrictedPathManifestIdEntry::new(
201-
ManifestType::ContentManifest,
202-
ManifestId::from(&id.blake2().into_inner()),
203-
RepoPath::DirectoryPath(non_root_path),
204-
)?;
205-
206-
if let Err(e) = restricted_paths
207-
.manifest_id_store()
208-
.add_entry(&ctx, entry)
209-
.await
210-
{
211-
tracing::warn!(
212-
path = %path,
213-
error = %e,
214-
"Failed to track restricted path"
215-
);
196+
if restricted_paths_enabled {
197+
if let Some(non_root_path) = path.clone().into_optional_non_root_path() {
198+
let is_restricted = restricted_paths.is_restricted_path(&non_root_path);
199+
if is_restricted {
200+
let entry = RestrictedPathManifestIdEntry::new(
201+
ManifestType::ContentManifest,
202+
ManifestId::from(&id.blake2().into_inner()),
203+
RepoPath::DirectoryPath(non_root_path),
204+
)?;
205+
206+
if let Err(e) = restricted_paths
207+
.manifest_id_store()
208+
.add_entry(&ctx, entry)
209+
.await
210+
{
211+
tracing::warn!(
212+
path = %path,
213+
error = %e,
214+
"Failed to track restricted path"
215+
);
216+
}
217+
}
216218
}
217219
}
218220

eden/mononoke/derived_data/content_manifest_derivation/src/derive_from_predecessor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::derive::empty_directory;
2828
pub(crate) async fn inner_derive_from_predecessor(
2929
ctx: &CoreContext,
3030
blobstore: &Arc<dyn KeyedBlobstore>,
31-
restricted_paths: &Arc<restricted_paths::RestrictedPaths>,
31+
restricted_paths: &Arc<restricted_paths_common::RestrictedPathsConfigBased>,
3232
predecessor: mononoke_types::FsnodeId,
3333
chunk_size: usize,
3434
) -> Result<Option<ContentManifestId>> {

0 commit comments

Comments
 (0)