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

PHOENIX-7008 Implementation for CREATE CDC #1681

Merged
merged 22 commits into from
Sep 30, 2023

Conversation

haridsv
Copy link
Contributor

@haridsv haridsv commented Sep 20, 2023

This PR builds on top of the shallow grammar support added for CREATE CDC grammar as part of #1662. This change makes the required syscat changes along with the creation of the underly index. There are quite a few TODO items that need to be discussed, but this PR can still be merged as we can address them in future PRs.

Jira: PHOENIX-7008

@virajjasani virajjasani self-requested a review September 26, 2023 16:00
bin/sqlline.py Outdated
@@ -114,6 +116,7 @@ def kill_child():
disable_jna = ""

java_cmd = java + ' $PHOENIX_OPTS ' + \
(args.debug and "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8071" or "") + \
Copy link
Contributor

Choose a reason for hiding this comment

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

this is local change right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am hoping to include this as it is quite useful. Do you see any problem?

bin/sqlline.py Outdated
" -u jdbc:phoenix:" + phoenix_utils.shell_quote([zookeeper]) + \
" -n none -p none --color=" + colorSetting + " --fastConnect=" + tryDecode(args.fastconnect) + \
" --verbose=" + tryDecode(args.verbose) + " --incremental=false --isolation=TRANSACTION_READ_COMMITTED " + sqlfile
(not args.noconnect and " -u jdbc:phoenix:" + phoenix_utils.shell_quote([zookeeper]) or "") + \
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, all changes in this file can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to include the changes in the sqlline, unless there is a problem with the approach. I can also raise it as a separate PR if that is preferred.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah i think separate Jira would be better to track it and others can also review, i am not actually sure whether we can make the change or not because at least we don't use this script as is in production env

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I now moved the change into PHOENIX-7055 and created a separate PR #1695. Please take a look.

public class CDCMiscIT extends ParallelStatsDisabledIT {
private void assertCDCState(Connection conn, String cdcName, String expInclude,
int idxType) throws SQLException {
try (ResultSet rs = conn.createStatement().executeQuery("SELECT cdc_include FROM " +
Copy link
Contributor

Choose a reason for hiding this comment

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

Once all the SELECT queries to SYSTEM.CATALOG are replaced with PTable based comparison, we are good to go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added the check for the change scope on PTable as it corresponds to the protobuf change but left the existing SYSCAT checks as is, as these are existing fields and don't necessarily have to be validated through PTable. WDYT?

@virajjasani
Copy link
Contributor

Looks like PTableType change from previous commit caused the conflict

@virajjasani
Copy link
Contributor

looks good otherwise

@haridsv
Copy link
Contributor Author

haridsv commented Sep 28, 2023

FIxed the conflict and moved out the sqlline.py change.

@virajjasani
Copy link
Contributor

virajjasani commented Sep 28, 2023

Some test failures reported with error:

ERROR 504 (42703): Undefined column. columnName=SYSTEM.CATALOG.CDC_INCLUDE

https://ci-hadoop.apache.org/job/Phoenix/job/Phoenix-PreCommit-GitHub-PR/job/PR-1681/5/testReport/

otherwise, we are good to go.

@@ -4107,6 +4109,9 @@ protected PhoenixConnection upgradeSystemCatalogIfRequired(PhoenixConnection met
metaConnection = addColumnsIfNotExists(metaConnection, PhoenixDatabaseMetaData.SYSTEM_CATALOG,
MIN_SYSTEM_TABLE_TIMESTAMP_5_2_0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Here MIN_SYSTEM_TABLE_TIMESTAMP_5_2_0 should be increased by 1 and then each addColumns above will decrease it by 1. This can lead to BackwardCompatibilityIT tests to fail, which we are seeing,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests are still failing for the same reason, but this time on the PHYSICAL_TABLE_NAME column (the very first one). Could you please check to see what I might have done wrong?

Copy link
Contributor

Choose a reason for hiding this comment

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

Value of MIN_SYSTEM_TABLE_TIMESTAMP needs to be increased by 1 as well here :-

public static final long MIN_SYSTEM_TABLE_TIMESTAMP_5_2_0 = MIN_TABLE_TIMESTAMP + 37;

@virajjasani virajjasani merged commit 581e613 into apache:PHOENIX-7001-feature Sep 30, 2023
0 of 5 checks passed
haridsv added a commit to haridsv/phoenix that referenced this pull request Jan 22, 2024
Address the changes in the CREATE CDC spec in PHOENIX-7001
Also includes some review feedback changes across the changes in PRs apache#1681, apache#1703 and apache#1766
haridsv added a commit to haridsv/phoenix that referenced this pull request Jan 23, 2024
Address the changes in the CREATE CDC spec in PHOENIX-7001
Also includes some review feedback changes across the changes in PRs apache#1681, apache#1703 and apache#1766
haridsv added a commit to haridsv/phoenix that referenced this pull request Jan 24, 2024
Address the changes in the CREATE CDC spec in PHOENIX-7001
Also includes some review feedback changes across the changes in PRs apache#1681, apache#1703 and apache#1766
haridsv added a commit to haridsv/phoenix that referenced this pull request Mar 29, 2024
This commit includes a squash of all the below changes from the PRs apache#1662, apache#1694,
down by removing non-functional changes for the ease of review. On top of it,
the changes have been reworked for the changed state of master, especially the
new submodules.

* 4c9827a Hari.. PHOENIX-7008 Shallow grammar support for CREATE CDC (apache#1662)
* e5220e0 TheN..  PHOENIX-7054 Shallow grammar support for DROP CDC and ALTER CDC  (apache#1694)
* 581e613 Hari.. PHOENIX-7008 Implementation for CREATE CDC  (apache#1681)
* e2ef886 Hari.. PHOENIX-7008 Tweaks, fixes and additional test coverage for CREATE CDC (apache#1703)
* 5d3fd40 TheN.. PHOENIX-7074 DROP CDC Implementation (apache#1713)
* 7420443 Hari.. PHOENIX-7014: Query compiler/optimizer changes along with some PHOENIX-7015 changes (apache#1766)
* da6ddad Kadi.. Add an extra delete mutation for CDC
* 93d586e Kadi.. Add an extra delete mutation during rebuild for CDC index
* f07898f Hari.. PHOENIX-7008: Addressing Jira spec and review feedback changes (apache#1802)
* 87a2ea1 Hari.. PHOENIX-7008: Fix for parser gap and fix for failing test (apache#1812)
* e395780 TheN.. PHOENIX-7015 Implementing CDCGlobalIndexRegionScanner (apache#1813)

Co-authored-by: Saurabh Rai <saurabh.rai@salesforce.com>
haridsv added a commit to haridsv/phoenix that referenced this pull request Mar 29, 2024
…ture

This commit includes a squash of all the below changes from the PRs apache#1662, apache#1694,
down by removing non-functional changes for the ease of review. On top of it,
the changes have been reworked for the changed state of master, especially the
new submodules.

* 4c9827a Hari.. PHOENIX-7008 Shallow grammar support for CREATE CDC (apache#1662)
* e5220e0 TheN..  PHOENIX-7054 Shallow grammar support for DROP CDC and ALTER CDC  (apache#1694)
* 581e613 Hari.. PHOENIX-7008 Implementation for CREATE CDC  (apache#1681)
* e2ef886 Hari.. PHOENIX-7008 Tweaks, fixes and additional test coverage for CREATE CDC (apache#1703)
* 5d3fd40 TheN.. PHOENIX-7074 DROP CDC Implementation (apache#1713)
* 7420443 Hari.. PHOENIX-7014: Query compiler/optimizer changes along with some PHOENIX-7015 changes (apache#1766)
* da6ddad Kadi.. Add an extra delete mutation for CDC
* 93d586e Kadi.. Add an extra delete mutation during rebuild for CDC index
* f07898f Hari.. PHOENIX-7008: Addressing Jira spec and review feedback changes (apache#1802)
* 87a2ea1 Hari.. PHOENIX-7008: Fix for parser gap and fix for failing test (apache#1812)
* e395780 TheN.. PHOENIX-7015 Implementing CDCGlobalIndexRegionScanner (apache#1813)

Co-authored-by: Saurabh Rai <saurabh.rai@salesforce.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants