Skip to main content

risingwave_connector/source/cdc/
mariadb.rs

1// Copyright 2026 RisingWave Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use std::collections::BTreeMap;
16
17use risingwave_pb::secret::PbSecretRef;
18
19use crate::error::ConnectorResult;
20use crate::source::cdc::{
21    CdcSourceDdlValidator, CdcSourceExternalTableIdentifier, CdcSourceRuntimeFlags,
22    CdcSourceTypeTrait, Mariadb, Mysql, check_alter_with_options_inner, check_common_with_options,
23};
24
25// ------- Runtime flags -------
26
27impl CdcSourceRuntimeFlags for Mariadb {
28    const CAN_BACKFILL: bool = true;
29    const CAN_USE_TRANSACTION_METADATA: bool = true;
30    const NEEDS_NON_EMPTY_INITIAL_OFFSET: bool = true;
31}
32
33// ------- DDL validation -------
34
35impl CdcSourceDdlValidator for Mariadb {
36    fn check_and_fill_create_with_options(
37        props: &mut BTreeMap<String, String>,
38    ) -> ConnectorResult<()> {
39        // MariaDB replication needs a unique `server.id` just like MySQL.
40        Mysql::check_and_fill_create_with_options(props)
41    }
42
43    fn check_alter_with_options(
44        props: &BTreeMap<String, String>,
45        secret_refs: &BTreeMap<String, PbSecretRef>,
46    ) -> ConnectorResult<()> {
47        check_common_with_options(props)?;
48        check_alter_with_options_inner(
49            Self::CDC_CONNECTOR_NAME,
50            props,
51            secret_refs,
52            &[
53                "cdc.source.wait.streaming.start.timeout",
54                "debezium.max.queue.size",
55                "debezium.queue.memory.ratio",
56                "hostname",
57                "port",
58                "password",
59            ],
60        )
61    }
62}
63
64// ------- External table identifier -------
65
66impl CdcSourceExternalTableIdentifier for Mariadb {}