fix(ecstore): bound copy-source shard read-ahead (#6663)

This commit is contained in:
cxymds
2026-08-26 21:24:37 +08:00
committed by GitHub
parent a96dd7d289
commit 7c2361757e
13 changed files with 2262 additions and 145 deletions
+27
View File
@@ -2468,6 +2468,33 @@ impl ECStore {
Self::resolve_decommission_tiered_object_result(result, bucket, &object)
}
/// Open a source reader for a server-side copy.
///
/// Copy consumers hold the source reader while a destination write can
/// apply backpressure. Keep that read contract explicit at the storage
/// boundary so the lower-level legacy multipart pipeline can suppress its
/// speculative next-part setup without changing the public `ObjectIO`
/// trait or `ObjectOptions` layout.
pub async fn get_object_reader_for_copy(
&self,
bucket: &str,
object: &str,
range: Option<HTTPRangeSpec>,
h: HeaderMap,
opts: &ObjectOptions,
) -> Result<(GetObjectReader, tokio_util::sync::CancellationToken)> {
let cancellation = tokio_util::sync::CancellationToken::new();
let reader = crate::set_disk::with_get_object_read_cancellation(
cancellation.clone(),
crate::set_disk::with_get_object_read_policy(
crate::set_disk::GetObjectReadPolicy::CopySource,
self.handle_get_object_reader(bucket, object, range, h, opts),
),
)
.await?;
Ok((reader, cancellation))
}
#[instrument(level = "debug", skip(self, h))]
#[hotpath::measure(impl_type = "ECStore")]
pub(super) async fn handle_get_object_reader(