@@ -409,6 +409,19 @@ impl LogScannerInner {
409409 Ok ( ( ) )
410410 }
411411
412+ async fn unsubscribe_partition ( & self , partition_id : PartitionId , bucket : i32 ) -> Result < ( ) > {
413+ if !self . is_partitioned_table {
414+ return Err ( Error :: UnsupportedOperation {
415+ message : "Can't unsubscribe a partition for a non-partitioned table." . to_string ( ) ,
416+ } ) ;
417+ }
418+ let table_bucket =
419+ TableBucket :: new_with_partition ( self . table_id , Some ( partition_id) , bucket) ;
420+ self . log_scanner_status
421+ . unassign_scan_buckets ( from_ref ( & table_bucket) ) ;
422+ Ok ( ( ) )
423+ }
424+
412425 async fn poll_for_fetches ( & self ) -> Result < HashMap < TableBucket , Vec < ScanRecord > > > {
413426 let result = self . log_fetcher . collect_fetches ( ) ?;
414427 if !result. is_empty ( ) {
@@ -487,6 +500,14 @@ impl LogScanner {
487500 . subscribe_partition ( partition_id, bucket, offset)
488501 . await
489502 }
503+
504+ pub async fn unsubscribe_partition (
505+ & self ,
506+ partition_id : PartitionId ,
507+ bucket : i32 ,
508+ ) -> Result < ( ) > {
509+ self . inner . unsubscribe_partition ( partition_id, bucket) . await
510+ }
490511}
491512
492513// Implementation for RecordBatchLogScanner (batches mode)
@@ -514,6 +535,14 @@ impl RecordBatchLogScanner {
514535 . subscribe_partition ( partition_id, bucket, offset)
515536 . await
516537 }
538+
539+ pub async fn unsubscribe_partition (
540+ & self ,
541+ partition_id : PartitionId ,
542+ bucket : i32 ,
543+ ) -> Result < ( ) > {
544+ self . inner . unsubscribe_partition ( partition_id, bucket) . await
545+ }
517546}
518547
519548struct LogFetcher {
0 commit comments