@@ -191,6 +191,9 @@ impl PersistConfig {
191191 storage_sink_minimum_batch_updates : AtomicUsize :: new (
192192 Self :: DEFAULT_SINK_MINIMUM_BATCH_UPDATES ,
193193 ) ,
194+ storage_source_decode_fuel : AtomicUsize :: new (
195+ Self :: DEFAULT_STORAGE_SOURCE_DECODE_FUEL ,
196+ ) ,
194197 next_listen_batch_retryer : RwLock :: new ( Self :: DEFAULT_NEXT_LISTEN_BATCH_RETRYER ) ,
195198 stats_audit_percent : AtomicUsize :: new ( Self :: DEFAULT_STATS_AUDIT_PERCENT ) ,
196199 stats_collection_enabled : AtomicBool :: new ( Self :: DEFAULT_STATS_COLLECTION_ENABLED ) ,
@@ -250,6 +253,14 @@ impl PersistConfig {
250253 . load ( DynamicConfig :: LOAD_ORDERING )
251254 }
252255
256+ /// The maximum amount of work to do in the persist_source mfp_and_decode
257+ /// operator before yielding.
258+ pub fn storage_source_decode_fuel ( & self ) -> usize {
259+ self . dynamic
260+ . storage_source_decode_fuel
261+ . load ( DynamicConfig :: LOAD_ORDERING )
262+ }
263+
253264 /// Returns a new instance of [PersistConfig] for tests.
254265 pub fn new_for_tests ( ) -> Self {
255266 use mz_build_info:: DUMMY_BUILD_INFO ;
@@ -319,6 +330,9 @@ impl PersistConfig {
319330 /// Default value for [`PersistConfig::sink_minimum_batch_updates`].
320331 pub const DEFAULT_SINK_MINIMUM_BATCH_UPDATES : usize = 0 ;
321332
333+ /// Default value for [`PersistConfig::storage_source_decode_fuel`].
334+ pub const DEFAULT_STORAGE_SOURCE_DECODE_FUEL : usize = 1_000_000 ;
335+
322336 /// Default value for [`DynamicConfig::next_listen_batch_retry_params`].
323337 pub const DEFAULT_NEXT_LISTEN_BATCH_RETRYER : RetryParameters = RetryParameters {
324338 initial_backoff : Duration :: from_millis ( 4 ) ,
@@ -425,6 +439,7 @@ pub struct DynamicConfig {
425439 reader_lease_duration : RwLock < Duration > ,
426440 sink_minimum_batch_updates : AtomicUsize ,
427441 storage_sink_minimum_batch_updates : AtomicUsize ,
442+ storage_source_decode_fuel : AtomicUsize ,
428443 stats_audit_percent : AtomicUsize ,
429444 stats_collection_enabled : AtomicBool ,
430445 stats_filter_enabled : AtomicBool ,
@@ -780,6 +795,8 @@ pub struct PersistParameters {
780795 pub sink_minimum_batch_updates : Option < usize > ,
781796 /// Configures [`PersistConfig::storage_sink_minimum_batch_updates`].
782797 pub storage_sink_minimum_batch_updates : Option < usize > ,
798+ /// Configures [`PersistConfig::storage_source_decode_fuel`].
799+ pub storage_source_decode_fuel : Option < usize > ,
783800 /// Configures [`DynamicConfig::stats_audit_percent`].
784801 pub stats_audit_percent : Option < usize > ,
785802 /// Configures [`DynamicConfig::stats_collection_enabled`].
@@ -816,6 +833,7 @@ impl PersistParameters {
816833 reader_lease_duration : self_reader_lease_duration,
817834 sink_minimum_batch_updates : self_sink_minimum_batch_updates,
818835 storage_sink_minimum_batch_updates : self_storage_sink_minimum_batch_updates,
836+ storage_source_decode_fuel : self_storage_source_decode_fuel,
819837 next_listen_batch_retryer : self_next_listen_batch_retryer,
820838 stats_audit_percent : self_stats_audit_percent,
821839 stats_collection_enabled : self_stats_collection_enabled,
@@ -838,6 +856,7 @@ impl PersistParameters {
838856 reader_lease_duration : other_reader_lease_duration,
839857 sink_minimum_batch_updates : other_sink_minimum_batch_updates,
840858 storage_sink_minimum_batch_updates : other_storage_sink_minimum_batch_updates,
859+ storage_source_decode_fuel : other_storage_source_decode_fuel,
841860 next_listen_batch_retryer : other_next_listen_batch_retryer,
842861 stats_audit_percent : other_stats_audit_percent,
843862 stats_collection_enabled : other_stats_collection_enabled,
@@ -879,6 +898,9 @@ impl PersistParameters {
879898 if let Some ( v) = other_storage_sink_minimum_batch_updates {
880899 * self_storage_sink_minimum_batch_updates = Some ( v) ;
881900 }
901+ if let Some ( v) = other_storage_source_decode_fuel {
902+ * self_storage_source_decode_fuel = Some ( v) ;
903+ }
882904 if let Some ( v) = other_next_listen_batch_retryer {
883905 * self_next_listen_batch_retryer = Some ( v) ;
884906 }
@@ -926,6 +948,7 @@ impl PersistParameters {
926948 reader_lease_duration,
927949 sink_minimum_batch_updates,
928950 storage_sink_minimum_batch_updates,
951+ storage_source_decode_fuel,
929952 next_listen_batch_retryer,
930953 stats_audit_percent,
931954 stats_collection_enabled,
@@ -947,6 +970,7 @@ impl PersistParameters {
947970 && reader_lease_duration. is_none ( )
948971 && sink_minimum_batch_updates. is_none ( )
949972 && storage_sink_minimum_batch_updates. is_none ( )
973+ && storage_source_decode_fuel. is_none ( )
950974 && next_listen_batch_retryer. is_none ( )
951975 && stats_audit_percent. is_none ( )
952976 && stats_collection_enabled. is_none ( )
@@ -977,6 +1001,7 @@ impl PersistParameters {
9771001 reader_lease_duration,
9781002 sink_minimum_batch_updates,
9791003 storage_sink_minimum_batch_updates,
1004+ storage_source_decode_fuel,
9801005 next_listen_batch_retryer,
9811006 stats_audit_percent,
9821007 stats_collection_enabled,
@@ -1053,6 +1078,11 @@ impl PersistParameters {
10531078 DynamicConfig :: STORE_ORDERING ,
10541079 ) ;
10551080 }
1081+ if let Some ( storage_source_decode_fuel) = storage_source_decode_fuel {
1082+ cfg. dynamic
1083+ . storage_source_decode_fuel
1084+ . store ( * storage_source_decode_fuel, DynamicConfig :: STORE_ORDERING ) ;
1085+ }
10561086 if let Some ( retry_params) = next_listen_batch_retryer {
10571087 let mut retry = cfg
10581088 . dynamic
@@ -1129,6 +1159,7 @@ impl RustType<ProtoPersistParameters> for PersistParameters {
11291159 storage_sink_minimum_batch_updates : self
11301160 . storage_sink_minimum_batch_updates
11311161 . into_proto ( ) ,
1162+ storage_source_decode_fuel : self . storage_source_decode_fuel . into_proto ( ) ,
11321163 next_listen_batch_retryer : self . next_listen_batch_retryer . into_proto ( ) ,
11331164 stats_audit_percent : self . stats_audit_percent . into_proto ( ) ,
11341165 stats_collection_enabled : self . stats_collection_enabled . into_proto ( ) ,
@@ -1159,6 +1190,7 @@ impl RustType<ProtoPersistParameters> for PersistParameters {
11591190 storage_sink_minimum_batch_updates : proto
11601191 . storage_sink_minimum_batch_updates
11611192 . into_rust ( ) ?,
1193+ storage_source_decode_fuel : proto. storage_source_decode_fuel . into_rust ( ) ?,
11621194 next_listen_batch_retryer : proto. next_listen_batch_retryer . into_rust ( ) ?,
11631195 stats_audit_percent : proto. stats_audit_percent . into_rust ( ) ?,
11641196 stats_collection_enabled : proto. stats_collection_enabled . into_rust ( ) ?,
0 commit comments