risingwave_connector/source/cdc/
sql_server.rs1use std::collections::BTreeMap;
16
17use risingwave_common::license::{Feature, FeatureNotAvailable};
18use risingwave_pb::secret::PbSecretRef;
19
20use crate::error::ConnectorResult;
21use crate::source::cdc::{
22 CdcSourceDdlValidator, CdcSourceRuntimeFlags, CdcSourceTypeTrait, SqlServer,
23 check_alter_with_options_inner, check_common_with_options,
24};
25
26impl CdcSourceRuntimeFlags for SqlServer {
29 const CAN_BACKFILL: bool = true;
30 const NEEDS_NON_EMPTY_INITIAL_OFFSET: bool = true;
31 }
35
36impl CdcSourceDdlValidator for SqlServer {
39 fn check_and_fill_create_with_options(
40 props: &mut BTreeMap<String, String>,
41 ) -> ConnectorResult<()> {
42 check_common_with_options(props)?;
43 if !props.contains_key("schema.name") {
44 props.insert("schema.name".into(), "dbo".into());
46 }
47 Ok(())
48 }
49
50 fn check_license() -> Result<(), FeatureNotAvailable> {
51 Feature::SqlServerCdcSource.check_available()
52 }
53
54 fn check_alter_with_options(
55 props: &BTreeMap<String, String>,
56 secret_refs: &BTreeMap<String, PbSecretRef>,
57 ) -> ConnectorResult<()> {
58 check_common_with_options(props)?;
59 check_alter_with_options_inner(
60 Self::CDC_CONNECTOR_NAME,
61 props,
62 secret_refs,
63 &[
64 "cdc.source.wait.streaming.start.timeout",
65 "debezium.max.queue.size",
66 "debezium.queue.memory.ratio",
67 "hostname",
68 "port",
69 "password",
70 ],
71 )
72 }
73}