[
https://issues.apache.org/jira/browse/FLINK-41777?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Xin Chen updated FLINK-41777:
-----------------------------
Description:
h3. Describe the bug
When an Oracle CDC Pipeline job starts in pure-stream startup modes
(latest-offset, timestamp, specific-offsets), the TaskManager fails immediately
with:
io.debezium.DebeziumException: The db history topic or its content is fully or
partially missing. Please check database history topic configuration and
re-execute the snapshot.
at
io.debezium.relational.HistorizedRelationalDatabaseSchema.recover(HistorizedRelationalDatabaseSchema.java:59)
at
org.apache.flink.cdc.connectors.oracle.source.reader.fetch.OracleSourceFetchTaskContext.validateAndLoadDatabaseHistory(OracleSourceFetchTaskContext.java:286)
Initial and snapshot modes are not affected, because their splits already carry
the snapshot table schemas and the database history is populated from them.
h3. Root cause
In pure-stream mode the stream split has no table schemas, so the source reader
re-discovers them at runtime:
IncrementalSourceReader#discoverTableSchemasForStreamSplit
-> OracleDialect#discoverDataCollections
-> OracleConnectionUtils#listTables
OracleConnectionUtils#listTables filters the tables it lists with:
SELECT OWNER, TABLE_NAME, TABLESPACE_NAME FROM ALL_TABLES
WHERE TABLESPACE_NAME IS NOT NULL
AND TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX')
AND NESTED = 'NO'
AND TABLE_NAME NOT IN (SELECT PARENT_TABLE_NAME FROM ALL_NESTED_TABLES)
while the tables captured at pipeline build time are listed by
OracleSchemaUtils#listTables, which has no tablespace restriction:
SELECT table_name FROM all_tables WHERE owner = '<schema>'
A captured table stored in the SYSTEM (or SYSAUX) tablespace is therefore
listed when the pipeline is built and appears in table.include.list, but is
never discovered at runtime. The discovered schema set is empty,
EmbeddedFlinkDatabaseHistory is registered with an empty collection, and
HistorizedRelationalDatabaseSchema#recover fails with the misleading
"db history topic ... missing" error.
h3. Steps to reproduce
1. Create a source table that is stored in the SYSTEM tablespace (for example
when the schema's default tablespace is SYSTEM):
CREATE TABLE QATEST.T (ID NUMBER(38) PRIMARY KEY) TABLESPACE SYSTEM;
2. Start an Oracle Pipeline job that captures QATEST.T in a pure-stream mode:
source:
type: oracle
scan.startup.mode: latest-offset
3. The job fails on startup with the exception above.
(The same job succeeds with scan.startup.mode: initial.)
h3. Attachments / evidence
- JobManager log: OracleSchemaUtils lists the table under its schema, so the
job is submitted.
- TaskManager log: "Source reader 0 discovers table schema for stream split ...
success",
no "including '...' for further processing" line (OracleConnectionUtils
discovered 0 tables),
followed by the Debezium history exception.
- SELECT OWNER, TABLE_NAME, TABLESPACE_NAME FROM ALL_TABLES WHERE OWNER =
'QATEST'
AND TABLE_NAME = 'T' returns TABLESPACE_NAME = SYSTEM, while the same query
with
TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX') returns no rows.
h3. Proposed fix
Drop the TABLESPACE_NAME restriction from OracleConnectionUtils#listTables. The
captured table set is already restricted by table.include.list, so the
tablespace restriction only hides valid tables. The NESTED = 'NO' and
nested-table exclusion are unrelated to this problem and are kept.
h3. Note on the original report
This issue was initially filed as a table-name case mismatch. Debezium's
table filters are case-insensitive (io.debezium.function.Predicates lower-cases
both the include list and the mapped TableId, and the Oracle mapper is
schema + "." + table), so case is not involved. The real cause is the
tablespace restriction described above.
was:
Describe the bug
When starting an Oracle CDC Pipeline job in pure-stream startup modes (e.g.,
`latest-offset`, `timestamp`, `specific-offsets`), the TaskManager fails
immediately with:
{code:java}
io.debezium.DebeziumException: The db history topic or its content is fully or
partially missing. Please check database history topic configuration and
re-execute the snapshot.{code}
> [Oracle CDC] Pure-stream startup fails with "db history topic is missing"
> because table discovery skips tables in the SYSTEM/SYSAUX tablespace
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: FLINK-41777
> URL: https://issues.apache.org/jira/browse/FLINK-41777
> Project: Flink
> Issue Type: Bug
> Components: Flink CDC
> Affects Versions: cdc-3.6.0, cdc-3.7.0
> Reporter: Xin Chen
> Priority: Major
>
> h3. Describe the bug
> When an Oracle CDC Pipeline job starts in pure-stream startup modes
> (latest-offset, timestamp, specific-offsets), the TaskManager fails
> immediately with:
> io.debezium.DebeziumException: The db history topic or its content is fully
> or partially missing. Please check database history topic configuration and
> re-execute the snapshot.
> at
> io.debezium.relational.HistorizedRelationalDatabaseSchema.recover(HistorizedRelationalDatabaseSchema.java:59)
> at
> org.apache.flink.cdc.connectors.oracle.source.reader.fetch.OracleSourceFetchTaskContext.validateAndLoadDatabaseHistory(OracleSourceFetchTaskContext.java:286)
> Initial and snapshot modes are not affected, because their splits already
> carry the snapshot table schemas and the database history is populated from
> them.
> h3. Root cause
> In pure-stream mode the stream split has no table schemas, so the source
> reader re-discovers them at runtime:
> IncrementalSourceReader#discoverTableSchemasForStreamSplit
> -> OracleDialect#discoverDataCollections
> -> OracleConnectionUtils#listTables
> OracleConnectionUtils#listTables filters the tables it lists with:
> SELECT OWNER, TABLE_NAME, TABLESPACE_NAME FROM ALL_TABLES
> WHERE TABLESPACE_NAME IS NOT NULL
> AND TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX')
> AND NESTED = 'NO'
> AND TABLE_NAME NOT IN (SELECT PARENT_TABLE_NAME FROM ALL_NESTED_TABLES)
> while the tables captured at pipeline build time are listed by
> OracleSchemaUtils#listTables, which has no tablespace restriction:
> SELECT table_name FROM all_tables WHERE owner = '<schema>'
> A captured table stored in the SYSTEM (or SYSAUX) tablespace is therefore
> listed when the pipeline is built and appears in table.include.list, but is
> never discovered at runtime. The discovered schema set is empty,
> EmbeddedFlinkDatabaseHistory is registered with an empty collection, and
> HistorizedRelationalDatabaseSchema#recover fails with the misleading
> "db history topic ... missing" error.
> h3. Steps to reproduce
> 1. Create a source table that is stored in the SYSTEM tablespace (for example
> when the schema's default tablespace is SYSTEM):
> CREATE TABLE QATEST.T (ID NUMBER(38) PRIMARY KEY) TABLESPACE SYSTEM;
> 2. Start an Oracle Pipeline job that captures QATEST.T in a pure-stream mode:
> source:
> type: oracle
> scan.startup.mode: latest-offset
> 3. The job fails on startup with the exception above.
> (The same job succeeds with scan.startup.mode: initial.)
> h3. Attachments / evidence
> - JobManager log: OracleSchemaUtils lists the table under its schema, so the
> job is submitted.
> - TaskManager log: "Source reader 0 discovers table schema for stream split
> ... success",
> no "including '...' for further processing" line (OracleConnectionUtils
> discovered 0 tables),
> followed by the Debezium history exception.
> - SELECT OWNER, TABLE_NAME, TABLESPACE_NAME FROM ALL_TABLES WHERE OWNER =
> 'QATEST'
> AND TABLE_NAME = 'T' returns TABLESPACE_NAME = SYSTEM, while the same query
> with
> TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX') returns no rows.
> h3. Proposed fix
> Drop the TABLESPACE_NAME restriction from OracleConnectionUtils#listTables.
> The
> captured table set is already restricted by table.include.list, so the
> tablespace restriction only hides valid tables. The NESTED = 'NO' and
> nested-table exclusion are unrelated to this problem and are kept.
> h3. Note on the original report
> This issue was initially filed as a table-name case mismatch. Debezium's
> table filters are case-insensitive (io.debezium.function.Predicates
> lower-cases
> both the include list and the mapped TableId, and the Oracle mapper is
> schema + "." + table), so case is not involved. The real cause is the
> tablespace restriction described above.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)