risingwave_connector/source/cdc/
oracle.rs1use std::collections::BTreeMap;
16
17use anyhow::anyhow;
18use risingwave_common::bail;
19use risingwave_pb::secret::PbSecretRef;
20
21use crate::error::ConnectorResult;
22use crate::source::cdc::{
23 CdcSourceDdlValidator, CdcSourceRuntimeFlags, CdcSourceTypeTrait, Oracle,
24 check_alter_with_options_inner, check_common_with_options,
25};
26
27const HEARTBEAT_TABLE_AUTO_INITIALIZE_KEY: &str = "heartbeat.table.auto.initialize";
28
29impl CdcSourceRuntimeFlags for Oracle {}
32
33impl CdcSourceDdlValidator for Oracle {
36 fn check_and_fill_create_with_options(
37 props: &mut BTreeMap<String, String>,
38 ) -> ConnectorResult<()> {
39 check_common_with_options(props)?;
40 if let Some(value) = props.get(HEARTBEAT_TABLE_AUTO_INITIALIZE_KEY)
41 && value.parse::<bool>().map_err(|_| {
42 anyhow!("'{HEARTBEAT_TABLE_AUTO_INITIALIZE_KEY}' must be 'true' or 'false'")
43 })?
44 && !props
45 .get("heartbeat.table.name")
46 .is_some_and(|value| !value.trim().is_empty())
47 {
48 bail!("'{HEARTBEAT_TABLE_AUTO_INITIALIZE_KEY}' requires 'heartbeat.table.name'");
49 }
50 Ok(())
51 }
52
53 fn check_alter_with_options(
54 props: &BTreeMap<String, String>,
55 secret_refs: &BTreeMap<String, PbSecretRef>,
56 ) -> ConnectorResult<()> {
57 check_common_with_options(props)?;
58 check_alter_with_options_inner(
59 Self::CDC_CONNECTOR_NAME,
60 props,
61 secret_refs,
62 &[
63 "cdc.source.wait.streaming.start.timeout",
64 "debezium.max.queue.size",
65 "debezium.queue.memory.ratio",
66 "debezium.heartbeat.interval.ms",
67 "heartbeat.table.name",
68 "hostname",
69 "port",
70 "password",
71 ],
72 )
73 }
74}