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