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

[BugFix] Support authentication for StarRocks external table #11871

Merged
merged 8 commits into from
Oct 9, 2022

Conversation

banmoy
Copy link
Contributor

@banmoy banmoy commented Sep 29, 2022

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Which issues of this PR fixes :

Fixes #

Problem Summary(Required) :

When creating StarRocks external table, properties of user and password are required. But currently the target cluster does't check the password and LOAD_PRIV , so the INSERT INTO will be successful even if the user does not exist, or the user has no LOAD_PRIV on the target cluster. We should fix this problem.

How we fix it

When inserting data into the table on the target cluster, the source cluster will issue multiple RPCs to the target cluster in order, including beginRemoteTxn, commitRemoteTxn, and abortRemoteTxn in FrontendServiceImpl. We only need to
do the check in the first RPC beginRemoteTxn. So authentication information will be carried by the RPC, and checked in the target beginRemoteTxn.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • I have added user document for my new feature or new function

@banmoy
Copy link
Contributor Author

banmoy commented Sep 30, 2022

@padmejin @nshangyiming Thanks for your review. I have resolved the comments, and please help to take a look if your are available.

padmejin
padmejin previously approved these changes Sep 30, 2022
murphyatwork
murphyatwork previously approved these changes Sep 30, 2022
@murphyatwork
Copy link
Contributor

run starrocks_admit_test

@murphyatwork murphyatwork enabled auto-merge (squash) September 30, 2022 15:09
@wanpengfei-git wanpengfei-git added the Approved Ready to merge label Sep 30, 2022
@wanpengfei-git
Copy link
Collaborator

run starrocks_admit_test

nshangyiming
nshangyiming previously approved these changes Oct 1, 2022
auto-merge was automatically disabled October 2, 2022 16:20

Head branch was pushed to by a user without write access

@banmoy banmoy dismissed stale reviews from nshangyiming, murphyatwork, and padmejin via bcd6905 October 2, 2022 16:20
@wanpengfei-git
Copy link
Collaborator

run starrocks_admit_test

2 similar comments
@wanpengfei-git
Copy link
Collaborator

run starrocks_admit_test

@wanpengfei-git
Copy link
Collaborator

run starrocks_admit_test

nshangyiming
nshangyiming previously approved these changes Oct 3, 2022
@nshangyiming
Copy link
Contributor

run starrocks_fe_unittest

@nshangyiming
Copy link
Contributor

run starrocks_admit_test

@wanpengfei-git
Copy link
Collaborator

run starrocks_admit_test

@banmoy banmoy force-pushed the external_table_main branch from 7eef603 to dc4f9c5 Compare October 8, 2022 08:19
@wanpengfei-git
Copy link
Collaborator

run starrocks_admit_test

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 8, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@wanpengfei-git
Copy link
Collaborator

[FE PR Coverage Check]

😞 fail : 47 / 63 (74.60%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/transaction/GlobalTransactionMgr.java 0 2 00.00% [147, 161]
🔵 com/starrocks/qe/StmtExecutor.java 0 7 00.00% [1217, 1218, 1219, 1220, 1221, 1222, 1232]
🔵 com/starrocks/service/FrontendServiceImpl.java 32 39 82.05% [1307, 1308, 1360, 1361, 1362, 1363, 1364]
🔵 com/starrocks/http/BaseAction.java 14 14 100.00% []
🔵 com/starrocks/common/Config.java 1 1 100.00% []

@wanpengfei-git
Copy link
Collaborator

run starrocks_tscancode

LOG.debug("Receive TAuthenticateParams [user: {}, host: {}, db: {}, tables: {}]",
authParams.user, authParams.getHost(), authParams.getDb_name(), authParams.getTable_names());
if (!Config.enable_starrocks_external_table_auth_check) {
LOG.debug("enable_starrocks_external_table_auth_check is disabled, " +
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest you change this log level to INFO. I think it's an important log

Copy link
Contributor

Choose a reason for hiding this comment

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

@padmejin It may cause too many logs? every transaction will print this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@padmejin This log is helpful in the case the check is enabled, but a wrong user/password/privilege is passed. I think it may be reproduced easily if happened, and we can enable DEBUG level logging dynamically to simplify the log. What do you think?

@banmoy
Copy link
Contributor Author

banmoy commented Oct 9, 2022

run starrocks_be_unittest

@banmoy
Copy link
Contributor Author

banmoy commented Oct 9, 2022

run starrocks_clang-tidy

@Astralidea Astralidea enabled auto-merge (squash) October 9, 2022 06:27
@Astralidea Astralidea merged commit 294747e into StarRocks:main Oct 9, 2022
Astralidea pushed a commit that referenced this pull request Oct 10, 2022
… external table (#11871) (#11979)

cherry-pick pull request #11871 to branch-2.2
Astralidea pushed a commit that referenced this pull request Oct 21, 2022
…s external table (#11871) (#12011)

cherry-pick pull request #11871 to branch-2.4
southernriver pushed a commit to southernriver/starrocks that referenced this pull request Nov 11, 2022
…nto branch-2.4-tq

* 'branch-2.4' of https://github.com/StarRocks/starrocks: (84 commits)
  Upgrade opencsv due to CVE-2022-42889 (StarRocks#12526)
  [Cherry-pick][BugFix] Fix complex window + agg prune bug
  [BugFix] Fix transaction stream load empty label return message (StarRocks#12372)
  [Enhancement] Fix log printing in be (StarRocks#12497)
  [BugFix] Fix use-after-free in when TabletScanner call destructor (StarRocks#12453)
  [Doc]routine bugfix (StarRocks#12464)
  Update SHOW ALTER.md (StarRocks#12423)
  Update the link for Coloate join (StarRocks#12431)
  [Bugfix] Publish timeout in commitPreparedTransaction should raise error (StarRocks#12217) (StarRocks#12300)
  [Docs] Remove /bin/sh when starting binary (StarRocks#12434)
  [BugFix] fix alter table in new publish; add detail error message for load/insert publish timeout (StarRocks#12237)
  [BugFix] fix incorrect memory metrics of jemalloc (StarRocks#12365)
  Update Data_model.md (StarRocks#12420)
  [Doc] Update StreamLoad.md in Branch 2.4 (StarRocks#12410)
  [Doc]Update filemanager.md (StarRocks#12401)
  [Doc] correctify the parameter name of sink.properties.columns  (StarRocks#12389)
  Cherry-pick MAXVALUE bugfixs to branch-2.4
  [BugFix] Fix fencing failed when a new leader is elected (StarRocks#12138)
  [cherry-pick][branch-2.4][BugFix] Support authentication for StarRocks external table (StarRocks#11871) (StarRocks#12011)
  [Doc] Update Stream_Load_transaction_interface.md in Branch 2.4 (StarRocks#12371)
  ...
Astralidea pushed a commit that referenced this pull request Jan 4, 2023
…16130)

In #11871, to support authentication for StarRocks external table, we add three fields in thrift struct TAuthenticateParams: host, db_name and table_names, and they are marked required which leads to a compatible problem. Denote the starrocks before #11871 as v1, and starrocks after #11871 as v2, and we can ingesting data to v1 via the starrocks external table on v2 , but can't ingest data to v2 via external table on v1. The exception is as follows

#11871 adds host, db_name and table_names to TAuthenticateParams as required

struct TAuthenticateParams {
    1: required string user
    2: required string passwd
    3: required string host
    4: required string db_name
    5: required list<string> table_names;
}
The reason is that

external table on v1 will issue a RPC to v2 to request the meta of destination table
The RPC carries a parameter TAuthenticateParams created on v1 which not contains fields host, db_name and table_names
thrift requires these fields on v2, so the RPC failed
when ingesting data from v2 to v1, the RPC created on v2 does not carry TAuthenticateParams, so there is no problem
mergify bot pushed a commit that referenced this pull request Jan 4, 2023
…16130)

In #11871, to support authentication for StarRocks external table, we add three fields in thrift struct TAuthenticateParams: host, db_name and table_names, and they are marked required which leads to a compatible problem. Denote the starrocks before #11871 as v1, and starrocks after #11871 as v2, and we can ingesting data to v1 via the starrocks external table on v2 , but can't ingest data to v2 via external table on v1. The exception is as follows

#11871 adds host, db_name and table_names to TAuthenticateParams as required

struct TAuthenticateParams {
    1: required string user
    2: required string passwd
    3: required string host
    4: required string db_name
    5: required list<string> table_names;
}
The reason is that

external table on v1 will issue a RPC to v2 to request the meta of destination table
The RPC carries a parameter TAuthenticateParams created on v1 which not contains fields host, db_name and table_names
thrift requires these fields on v2, so the RPC failed
when ingesting data from v2 to v1, the RPC created on v2 does not carry TAuthenticateParams, so there is no problem

(cherry picked from commit 99b2b77)
mergify bot pushed a commit that referenced this pull request Jan 4, 2023
…16130)

In #11871, to support authentication for StarRocks external table, we add three fields in thrift struct TAuthenticateParams: host, db_name and table_names, and they are marked required which leads to a compatible problem. Denote the starrocks before #11871 as v1, and starrocks after #11871 as v2, and we can ingesting data to v1 via the starrocks external table on v2 , but can't ingest data to v2 via external table on v1. The exception is as follows

#11871 adds host, db_name and table_names to TAuthenticateParams as required

struct TAuthenticateParams {
    1: required string user
    2: required string passwd
    3: required string host
    4: required string db_name
    5: required list<string> table_names;
}
The reason is that

external table on v1 will issue a RPC to v2 to request the meta of destination table
The RPC carries a parameter TAuthenticateParams created on v1 which not contains fields host, db_name and table_names
thrift requires these fields on v2, so the RPC failed
when ingesting data from v2 to v1, the RPC created on v2 does not carry TAuthenticateParams, so there is no problem

(cherry picked from commit 99b2b77)
mergify bot pushed a commit that referenced this pull request Jan 4, 2023
…16130)

In #11871, to support authentication for StarRocks external table, we add three fields in thrift struct TAuthenticateParams: host, db_name and table_names, and they are marked required which leads to a compatible problem. Denote the starrocks before #11871 as v1, and starrocks after #11871 as v2, and we can ingesting data to v1 via the starrocks external table on v2 , but can't ingest data to v2 via external table on v1. The exception is as follows

#11871 adds host, db_name and table_names to TAuthenticateParams as required

struct TAuthenticateParams {
    1: required string user
    2: required string passwd
    3: required string host
    4: required string db_name
    5: required list<string> table_names;
}
The reason is that

external table on v1 will issue a RPC to v2 to request the meta of destination table
The RPC carries a parameter TAuthenticateParams created on v1 which not contains fields host, db_name and table_names
thrift requires these fields on v2, so the RPC failed
when ingesting data from v2 to v1, the RPC created on v2 does not carry TAuthenticateParams, so there is no problem

(cherry picked from commit 99b2b77)
mergify bot pushed a commit that referenced this pull request Jan 4, 2023
…16130)

In #11871, to support authentication for StarRocks external table, we add three fields in thrift struct TAuthenticateParams: host, db_name and table_names, and they are marked required which leads to a compatible problem. Denote the starrocks before #11871 as v1, and starrocks after #11871 as v2, and we can ingesting data to v1 via the starrocks external table on v2 , but can't ingest data to v2 via external table on v1. The exception is as follows

#11871 adds host, db_name and table_names to TAuthenticateParams as required

struct TAuthenticateParams {
    1: required string user
    2: required string passwd
    3: required string host
    4: required string db_name
    5: required list<string> table_names;
}
The reason is that

external table on v1 will issue a RPC to v2 to request the meta of destination table
The RPC carries a parameter TAuthenticateParams created on v1 which not contains fields host, db_name and table_names
thrift requires these fields on v2, so the RPC failed
when ingesting data from v2 to v1, the RPC created on v2 does not carry TAuthenticateParams, so there is no problem

(cherry picked from commit 99b2b77)
wanpengfei-git pushed a commit that referenced this pull request Jan 4, 2023
…16130)

In #11871, to support authentication for StarRocks external table, we add three fields in thrift struct TAuthenticateParams: host, db_name and table_names, and they are marked required which leads to a compatible problem. Denote the starrocks before #11871 as v1, and starrocks after #11871 as v2, and we can ingesting data to v1 via the starrocks external table on v2 , but can't ingest data to v2 via external table on v1. The exception is as follows

#11871 adds host, db_name and table_names to TAuthenticateParams as required

struct TAuthenticateParams {
    1: required string user
    2: required string passwd
    3: required string host
    4: required string db_name
    5: required list<string> table_names;
}
The reason is that

external table on v1 will issue a RPC to v2 to request the meta of destination table
The RPC carries a parameter TAuthenticateParams created on v1 which not contains fields host, db_name and table_names
thrift requires these fields on v2, so the RPC failed
when ingesting data from v2 to v1, the RPC created on v2 does not carry TAuthenticateParams, so there is no problem

(cherry picked from commit 99b2b77)
wanpengfei-git pushed a commit that referenced this pull request Jan 4, 2023
…16130)

In #11871, to support authentication for StarRocks external table, we add three fields in thrift struct TAuthenticateParams: host, db_name and table_names, and they are marked required which leads to a compatible problem. Denote the starrocks before #11871 as v1, and starrocks after #11871 as v2, and we can ingesting data to v1 via the starrocks external table on v2 , but can't ingest data to v2 via external table on v1. The exception is as follows

#11871 adds host, db_name and table_names to TAuthenticateParams as required

struct TAuthenticateParams {
    1: required string user
    2: required string passwd
    3: required string host
    4: required string db_name
    5: required list<string> table_names;
}
The reason is that

external table on v1 will issue a RPC to v2 to request the meta of destination table
The RPC carries a parameter TAuthenticateParams created on v1 which not contains fields host, db_name and table_names
thrift requires these fields on v2, so the RPC failed
when ingesting data from v2 to v1, the RPC created on v2 does not carry TAuthenticateParams, so there is no problem

(cherry picked from commit 99b2b77)
wanpengfei-git pushed a commit that referenced this pull request Jan 4, 2023
…16130)

In #11871, to support authentication for StarRocks external table, we add three fields in thrift struct TAuthenticateParams: host, db_name and table_names, and they are marked required which leads to a compatible problem. Denote the starrocks before #11871 as v1, and starrocks after #11871 as v2, and we can ingesting data to v1 via the starrocks external table on v2 , but can't ingest data to v2 via external table on v1. The exception is as follows

#11871 adds host, db_name and table_names to TAuthenticateParams as required

struct TAuthenticateParams {
    1: required string user
    2: required string passwd
    3: required string host
    4: required string db_name
    5: required list<string> table_names;
}
The reason is that

external table on v1 will issue a RPC to v2 to request the meta of destination table
The RPC carries a parameter TAuthenticateParams created on v1 which not contains fields host, db_name and table_names
thrift requires these fields on v2, so the RPC failed
when ingesting data from v2 to v1, the RPC created on v2 does not carry TAuthenticateParams, so there is no problem

(cherry picked from commit 99b2b77)
wanpengfei-git pushed a commit that referenced this pull request Jan 5, 2023
…16130)

In #11871, to support authentication for StarRocks external table, we add three fields in thrift struct TAuthenticateParams: host, db_name and table_names, and they are marked required which leads to a compatible problem. Denote the starrocks before #11871 as v1, and starrocks after #11871 as v2, and we can ingesting data to v1 via the starrocks external table on v2 , but can't ingest data to v2 via external table on v1. The exception is as follows

#11871 adds host, db_name and table_names to TAuthenticateParams as required

struct TAuthenticateParams {
    1: required string user
    2: required string passwd
    3: required string host
    4: required string db_name
    5: required list<string> table_names;
}
The reason is that

external table on v1 will issue a RPC to v2 to request the meta of destination table
The RPC carries a parameter TAuthenticateParams created on v1 which not contains fields host, db_name and table_names
thrift requires these fields on v2, so the RPC failed
when ingesting data from v2 to v1, the RPC created on v2 does not carry TAuthenticateParams, so there is no problem

(cherry picked from commit 99b2b77)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants