@@ -82,6 +82,7 @@ use common::{
8282 Reader ,
8383 Writer ,
8484 } ,
85+ try_chunks:: TryChunksExt ,
8586 types:: {
8687 GenericIndexName ,
8788 IndexId ,
@@ -533,8 +534,7 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
533534 let reader_ = & reader;
534535 let mut index_entry_chunks = reader
535536 . load_documents ( TimestampRange :: new ( cursor..min_snapshot_ts) ?, Order :: Asc )
536- . try_chunks ( * RETENTION_READ_CHUNK )
537- . map_err ( |e| e. 1 )
537+ . try_chunks2 ( * RETENTION_READ_CHUNK )
538538 . map ( move |chunk| async move {
539539 let chunk = chunk?. to_vec ( ) ;
540540 let mut entries_to_delete = vec ! [ ] ;
@@ -653,8 +653,7 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
653653 all_indexes,
654654 persistence_version,
655655 )
656- . try_chunks ( * RETENTION_DELETE_CHUNK )
657- . map_err ( |e| e. 1 ) ;
656+ . try_chunks2 ( * RETENTION_DELETE_CHUNK ) ;
658657 pin_mut ! ( expired_chunks) ;
659658 while let Some ( delete_chunk) = expired_chunks. try_next ( ) . await ? {
660659 tracing:: trace!(
@@ -709,8 +708,7 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
709708 Order :: Asc ,
710709 Arc :: new ( NoopRetentionValidator ) ,
711710 )
712- . try_chunks ( * RETENTION_READ_CHUNK )
713- . map_err ( |e| e. 1 )
711+ . try_chunks2 ( * RETENTION_READ_CHUNK )
714712 . map ( move |chunk| async move {
715713 let chunk = chunk?. to_vec ( ) ;
716714 let mut entries_to_delete: Vec < ( Timestamp , InternalDocumentId ) > = vec ! [ ] ;
@@ -812,8 +810,7 @@ impl<RT: Runtime> LeaderRetentionManager<RT> {
812810
813811 tracing:: trace!( "delete_documents: about to grab chunks" ) ;
814812 let expired_chunks = Self :: expired_documents ( rt, reader, cursor, min_snapshot_ts)
815- . try_chunks ( * RETENTION_DELETE_CHUNK )
816- . map_err ( |e| e. 1 ) ;
813+ . try_chunks2 ( * RETENTION_DELETE_CHUNK ) ;
817814 pin_mut ! ( expired_chunks) ;
818815 while let Some ( delete_chunk) = expired_chunks. try_next ( ) . await ? {
819816 tracing:: trace!(
@@ -1530,6 +1527,7 @@ mod tests {
15301527 TestIdGenerator ,
15311528 TestPersistence ,
15321529 } ,
1530+ try_chunks:: TryChunksExt ,
15331531 types:: {
15341532 unchecked_repeatable_ts,
15351533 DatabaseIndexUpdate ,
@@ -1570,9 +1568,8 @@ mod tests {
15701568 ) ) ;
15711569 } ;
15721570 let stream_throws = stream:: once ( async move { throws ( ) } ) ;
1573- // IMPORTANT: the map_err is required here and whenever we use try_chunks.
1574- // Otherwise the error gets re-wrapped and loses context.
1575- let chunks = stream_throws. try_chunks ( 1 ) . map_err ( |e| e. 1 ) ;
1571+ // IMPORTANT: try_chunks fails here. try_chunks2 is necessary.
1572+ let chunks = stream_throws. try_chunks2 ( 1 ) ;
15761573 let chunk_throws = async move || -> anyhow:: Result < ( ) > {
15771574 pin_mut ! ( chunks) ;
15781575 chunks. try_next ( ) . await ?;
0 commit comments