MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / process_normal_batch

Function process_normal_batch

nodedb/src/event/consumer.rs:358–394  ·  view source on GitHub ↗

Process a batch of Normal-mode events: trigger batching, CDC, permission cache, streaming MVs, CRDT sync. Statement-level trigger dispatch is per-event (no batching).

(
    events: &[super::types::WriteEvent],
    shared_state: &Arc<SharedState>,
    retry_queue: &mut TriggerRetryQueue,
    cdc_router: &Arc<super::cdc::CdcRouter>,
    _slab_account: &Arc<super::sla

Source from the content-addressed store, hash-verified

356/// Process a batch of Normal-mode events: trigger batching, CDC, permission cache,
357/// streaming MVs, CRDT sync. Statement-level trigger dispatch is per-event (no batching).
358async fn process_normal_batch(
359 events: &[super::types::WriteEvent],
360 shared_state: &Arc<SharedState>,
361 retry_queue: &mut TriggerRetryQueue,
362 cdc_router: &Arc<super::cdc::CdcRouter>,
363 _slab_account: &Arc<super::slab_budget::ConsumerSlabAccount>,
364) {
365 let mut trigger_collector =
366 crate::control::trigger::batch::collector::TriggerBatchCollector::new(
367 crate::control::trigger::batch::BatchConfig::default().batch_size,
368 );
369
370 for event in events {
371 if !event.op.is_data_event() {
372 shared_state
373 .watermark_tracker
374 .advance_lsn_only(event.vshard_id.as_u32(), event.lsn.as_u64());
375 continue;
376 }
377
378 // DML audit: record to audit log before dispatching triggers.
379 super::audit_dml::audit_dml_event(event, shared_state);
380
381 if let Some(batch) =
382 accumulate_data_event(event, shared_state, &mut trigger_collector, cdc_router)
383 {
384 super::trigger::dispatcher::dispatch_trigger_batch(&batch, shared_state, retry_queue)
385 .await;
386 }
387
388 super::trigger::dispatcher::dispatch_triggers(event, shared_state, retry_queue).await;
389 }
390
391 if let Some(batch) = trigger_collector.flush() {
392 super::trigger::dispatcher::dispatch_trigger_batch(&batch, shared_state, retry_queue).await;
393 }
394}
395
396/// Process the retry queue: DLQ exhausted entries and retry ready ones.
397async fn process_retry_queue(

Callers 1

consumer_loopFunction · 0.85

Calls 9

audit_dml_eventFunction · 0.85
accumulate_data_eventFunction · 0.85
dispatch_trigger_batchFunction · 0.85
dispatch_triggersFunction · 0.85
is_data_eventMethod · 0.80
advance_lsn_onlyMethod · 0.80
as_u32Method · 0.45
as_u64Method · 0.45
flushMethod · 0.45

Tested by

no test coverage detected