Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix][Connectors V2][CDC Oracle] oracle run in cdb+pdb mode, fix ORA-… #8958

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

screnwei
Copy link
Contributor

…00942 error

Purpose of this pull request

Fix #8463

Does this PR introduce any user-facing change?

How was this patch tested?

I tested on my own mac pc.

Check list

Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @screnwei . Please add test case.

@hailin0 hailin0 requested a review from Copilot March 31, 2025 05:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue with CDC Oracle by enabling the connector to run in both CDB and PDB modes, addressing the ORA-00942 error.

  • Added a SQL constant and utility method in OracleConnectionUtils to fetch the current container name from the Oracle server.
  • Updated OracleSnapshotSplitReadTask to switch the session to a designated PDB when the container name is "cdb$root".

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/utils/OracleConnectionUtils.java Added SHOW_CON_NAME constant and new method getCurrentContainerName to retrieve the container name.
seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/source/reader/fetch/scan/OracleSnapshotSplitReadTask.java Added logic to use the container name and set the session to PDB if necessary.

throw new SeaTunnelException(
"Cannot read the container name via '"
+ SHOW_CON_NAME
+ "'. Makesure your server is correctly configured");
Copy link
Preview

Copilot AI Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in error message: 'Makesure' should be 'Make sure'.

Suggested change
+ "'. Makesure your server is correctly configured");
+ "'. Make sure your server is correctly configured");

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

throw new SeaTunnelException(
"Cannot read the container name via '"
+ SHOW_CON_NAME
+ "'. Makesure your server is correctly configured",
Copy link
Preview

Copilot AI Mar 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in error message: 'Makesure' should be 'Make sure'.

Suggested change
+ "'. Makesure your server is correctly configured",
+ "'. Make sure your server is correctly configured",

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

@@ -164,6 +165,13 @@ protected SnapshottingTask getSnapshottingTask(
@Override
protected SnapshotContext<OraclePartition, OracleOffsetContext> prepare(
OraclePartition partition) throws Exception {
String currentContainerName = OracleConnectionUtils.getCurrentContainerName(jdbcConnection);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to change this code?

For pdb you need to add configuration

source {
        Oracle-CDC {
              ......
              debezium {
                     database.pdb.name = "your pdb name"
              }
        }
}

@hailin0 hailin0 added the discuss label Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants