20260801 并行控制面:stage worker池+CurrentRepoIndex RwLock化,--control-plane-stage-workers开关默认关闭(#138)
This commit is contained in:
@@ -639,7 +639,7 @@ pub(crate) fn try_build_fresh_publication_point_with_timing(
|
||||
> {
|
||||
let mut timing = FreshPublicationPointTimingBreakdown::default();
|
||||
let current_index_lock_started = std::time::Instant::now();
|
||||
let current_index_guard = current_repo_index.and_then(|handle| handle.lock().ok());
|
||||
let current_index_guard = current_repo_index.and_then(|handle| handle.read().ok());
|
||||
timing.current_index_lock_ms = current_index_lock_started.elapsed().as_millis() as u64;
|
||||
|
||||
if !rsync_uri_is_under_publication_point(manifest_rsync_uri, publication_point_rsync_uri) {
|
||||
@@ -1445,8 +1445,8 @@ mod tests {
|
||||
}
|
||||
|
||||
current_index
|
||||
.lock()
|
||||
.expect("index lock")
|
||||
.write()
|
||||
.expect("index write lock")
|
||||
.apply_repository_view_entries(&entries)
|
||||
.expect("apply current index");
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ fn snapshot_current_repo_objects(
|
||||
return Vec::new();
|
||||
}
|
||||
current_repo_index
|
||||
.and_then(|handle| handle.lock().ok().map(|idx| idx.snapshot_objects()))
|
||||
.and_then(|handle| handle.read().ok().map(|idx| idx.snapshot_objects()))
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
@@ -2392,8 +2392,8 @@ mod multi_tal_tests {
|
||||
fn snapshot_current_repo_objects_is_on_demand() {
|
||||
let handle = CurrentRepoIndex::shared();
|
||||
handle
|
||||
.lock()
|
||||
.expect("lock index")
|
||||
.write()
|
||||
.expect("write-lock index")
|
||||
.apply_repository_view_entries(&[RepositoryViewEntry {
|
||||
rsync_uri: "rsync://example.test/repo/a.roa".to_string(),
|
||||
current_hash: Some("11".repeat(32)),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -511,7 +511,7 @@ impl<'a> Rpkiv1PublicationPointRunner<'a> {
|
||||
|
||||
fn current_hash_for_uri(&self, uri: &str) -> Option<[u8; 32]> {
|
||||
if let Some(index) = self.current_repo_index.as_ref() {
|
||||
if let Ok(index) = index.lock() {
|
||||
if let Ok(index) = index.read() {
|
||||
if let Some(entry) = index.get_by_uri(uri) {
|
||||
return Some(entry.current_hash);
|
||||
}
|
||||
@@ -760,7 +760,7 @@ impl<'a> Rpkiv1PublicationPointRunner<'a> {
|
||||
|
||||
fn current_manifest_hash_hex_for_audit(&self, ca: &CaInstanceHandle) -> Option<String> {
|
||||
if let Some(index_handle) = self.current_repo_index.as_ref()
|
||||
&& let Ok(index) = index_handle.lock()
|
||||
&& let Ok(index) = index_handle.read()
|
||||
&& let Some(entry) = index.get_by_uri(&ca.manifest_rsync_uri)
|
||||
{
|
||||
return Some(entry.current_hash_hex.clone());
|
||||
|
||||
Reference in New Issue
Block a user