Repository: risingwavelabs/risingwave
File: src/stream/src/common/table/state_table.rs (Rust)

Code before:

    pub fn forbid_preload_all_rows(self) -> StateTableBuilder<'a, S, SD, IS_REPLICATED, bool> {
        self.with_preload_all_rows(false)
    }
}

impl<'a, S: StateStore, SD: ValueRowSerde, const IS_REPLICATED: bool, PreloadAllRow>
    StateTableBuilder<'a, S, SD, IS_REPLICATED, PreloadAllRow>
{
    pub fn with_op_consistency_level(
        mut self,
        op_consistency_level: StateTableOpConsistencyLevel,
    ) -> Self {
        self.op_consistency_level = Some(op_consistency_level);
        self
    }

    pub fn with_output_column_ids(mut self, output_column_ids: Vec<ColumnId>) -> Self {
        self.output_column_ids = Some(output_column_ids);
        self
    }

    pub fn enable_vnode_key_stats(mut self, enable: bool, config: &StreamingConfig) -> Self {
        self.enable_vnode_key_stats = Some(enable);
        self.enable_state_table_vnode_stats_prunning =
            enable && config.developer.enable_state_table_vnode_stats_prunning;
        self
    }

    pub fn with_metrics(mut self, metrics: StateTableMetrics) -> Self {
        self.metrics = Some(metrics);
        self
    }
}

impl<'a, S: StateStore, SD: ValueRowSerde, const IS_REPLICATED: bool>
    StateTableBuilder<'a, S, SD, IS_REPLICATED, bool>
{
    pub async fn build(self) -> StateTableInner<S, SD, IS_REPLICATED> {
        let mut preload_all_rows = self.preload_all_rows;
        if preload_all_rows
            && let Err(e) =
                risingwave_common::license::Feature::StateTableMemoryPreload.check_available()
        {
            warn!(table_id=%self.table_catalog.id, e=%e.as_report(), "table configured to preload rows to memory but disabled by license");
            preload_all_rows = false;
        }

        let should_enable_vnode_key_stats = if preload_all_rows
            && let Some(enable_vnode_key_stats) = self.enable_vnode_key_stats
            && enable_vnode_key_stats

Review comment (suggestion):
Spelling error: "prunning" should be "pruning" (single 'n'). This affects the field assignments which should be `enable_state_table_vnode_stats_pruning` instead of `enable_state_table_vnode_stats_prunning`.

Code after:

    pub fn forbid_preload_all_rows(self) -> StateTableBuilder<'a, S, SD, IS_REPLICATED, bool> {
        self.with_preload_all_rows(false)
    }
}

impl<'a, S: StateStore, SD: ValueRowSerde, const IS_REPLICATED: bool, PreloadAllRow>
    StateTableBuilder<'a, S, SD, IS_REPLICATED, PreloadAllRow>
{
    pub fn with_op_consistency_level(
        mut self,
        op_consistency_level: StateTableOpConsistencyLevel,
    ) -> Self {
        self.op_consistency_level = Some(op_consistency_level);
        self
    }

    pub fn with_output_column_ids(mut self, output_column_ids: Vec<ColumnId>) -> Self {
        self.output_column_ids = Some(output_column_ids);
        self
    }

    pub fn enable_vnode_key_stats(mut self, enable: bool, config: &StreamingConfig) -> Self {
        self.enable_vnode_key_stats = Some(enable);
        self.enable_state_table_vnode_stats_pruning =
            enable && config.developer.enable_state_table_vnode_stats_pruning;
        self
    }

    pub fn with_metrics(mut self, metrics: StateTableMetrics) -> Self {
        self.metrics = Some(metrics);
        self
    }
}

impl<'a, S: StateStore, SD: ValueRowSerde, const IS_REPLICATED: bool>
    StateTableBuilder<'a, S, SD, IS_REPLICATED, bool>
{
    pub async fn build(self) -> StateTableInner<S, SD, IS_REPLICATED> {
        let mut preload_all_rows = self.preload_all_rows;
        if preload_all_rows
            && let Err(e) =
                risingwave_common::license::Feature::StateTableMemoryPreload.check_available()
        {
            warn!(table_id=%self.table_catalog.id, e=%e.as_report(), "table configured to preload rows to memory but disabled by license");
            preload_all_rows = false;
        }

        let should_enable_vnode_key_stats = if preload_all_rows
            && let Some(enable_vnode_key_stats) = self.enable_vnode_key_stats
            && enable_vnode_key_stats