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 audit for insert into statement executing from follower #30663

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

liuyehcf
Copy link
Contributor

@liuyehcf liuyehcf commented Sep 8, 2023

This is an continuation work of #29901, and it cannot work well when there are multi frontend instances.

What type of PR is this:

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

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.1
    • 3.0
    • 2.5
    • 2.4

@github-actions github-actions bot added the 3.1 label Sep 8, 2023
@liuyehcf liuyehcf force-pushed the audit_for_insert branch 2 times, most recently from 590bc28 to 46b9bdf Compare September 11, 2023 01:45
@@ -480,6 +480,10 @@ public void execute() throws Exception {
// Write the resource group information to audit log.
prepareResourceGroup(context, ResourceGroupClassifier.QueryType.fromStatement(parsedStmt));

Preconditions.checkState(!(parsedStmt instanceof InsertStmt && parsedStmt.isExplain()
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not forward to leader FE?

@@ -1368,6 +1372,9 @@ private void handleShow() throws IOException, AnalysisException, DdlException {
}

private void handleExplainStmt(String explainString) throws IOException {
if (explainString == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why explainString could be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted

@liuyehcf liuyehcf force-pushed the audit_for_insert branch 4 times, most recently from faa4edb to 4bafe8a Compare September 13, 2023 02:19
@liuyehcf liuyehcf changed the title [BugFix] Fix audit update process for insert into statements [BugFix] Support audit for insert into statement executing from follower Sep 13, 2023
@liuyehcf liuyehcf force-pushed the audit_for_insert branch 4 times, most recently from 4405320 to 8953f42 Compare September 13, 2023 02:59
ZiheLiu
ZiheLiu previously approved these changes Sep 13, 2023
Signed-off-by: liuyehcf <1559500551@qq.com>
@sonarqubecloud
Copy link

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 3 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@wanpengfei-git
Copy link
Collaborator

[FE Incremental Coverage Report]

😞 fail : 62 / 117 (52.99%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/common/util/AuditStatisticsUtil.java 46 95 48.42% [27, 30, 40, 41, 42, 43, 44, 45, 46, 47, 54, 58, 64, 70, 76, 82, 88, 93, 94, 96, 97, 98, 99, 100, 102, 103, 104, 105, 106, 108, 110, 111, 112, 114, 117, 118, 120, 126, 136, 148, 149, 150, 151, 153, 154, 156, 157, 159, 160]
🔵 com/starrocks/qe/StmtExecutor.java 5 10 50.00% [1409, 1410, 1411, 1544, 1545]
🔵 com/starrocks/qe/LeaderOpExecutor.java 3 4 75.00% [122]
🔵 com/starrocks/sql/ast/InsertStmt.java 1 1 100.00% []
🔵 com/starrocks/qe/ConnectProcessor.java 3 3 100.00% []
🔵 com/starrocks/qe/DefaultCoordinator.java 4 4 100.00% []

@wanpengfei-git
Copy link
Collaborator

[BE Incremental Coverage Report]

😞 fail : 0 / 38 (00.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 src/exec/pipeline/result_sink_operator.h 0 3 00.00% [114, 117, 125]
🔵 src/exec/pipeline/sink/export_sink_operator.cpp 0 3 00.00% [195, 196, 225]
🔵 src/exec/pipeline/sink/memory_scratch_sink_operator.h 0 5 00.00% [44, 45, 89, 91, 99]
🔵 src/exec/pipeline/sink/iceberg_table_sink_operator.cpp 0 2 00.00% [64, 65]
🔵 src/exec/pipeline/olap_table_sink_operator.h 0 1 00.00% [106]
🔵 src/exec/pipeline/pipeline_driver_executor.cpp 0 2 00.00% [348, 349]
🔵 src/exec/pipeline/result_sink_operator.cpp 0 1 00.00% [68]
🔵 src/exec/pipeline/sink/export_sink_operator.h 0 6 00.00% [39, 40, 82, 83, 84, 92]
🔵 src/exec/pipeline/olap_table_sink_operator.cpp 0 5 00.00% [141, 142, 200, 203, 206]
🔵 src/exec/pipeline/sink/iceberg_table_sink_operator.h 0 7 00.00% [51, 108, 109, 110, 111, 112, 120]
🔵 src/runtime/query_statistics.cpp 0 1 00.00% [58]
🔵 src/exec/pipeline/sink/memory_scratch_sink_operator.cpp 0 2 00.00% [49, 50]

@kangkaisen kangkaisen merged commit 4a6b0c9 into StarRocks:main Sep 14, 2023
@wanpengfei-git
Copy link
Collaborator

@Mergifyio backport branch-3.0

@wanpengfei-git
Copy link
Collaborator

@Mergifyio backport branch-2.5

@mergify
Copy link
Contributor

mergify bot commented Sep 14, 2023

backport branch-3.1

✅ Backports have been created

@github-actions github-actions bot removed the 2.5 label Sep 14, 2023
@mergify
Copy link
Contributor

mergify bot commented Sep 14, 2023

backport branch-3.0

✅ Backports have been created

@mergify
Copy link
Contributor

mergify bot commented Sep 14, 2023

backport branch-2.5

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 14, 2023
…wer (#30663)

Signed-off-by: liuyehcf <1559500551@qq.com>
(cherry picked from commit 4a6b0c9)

# Conflicts:
#	be/src/exec/pipeline/result_sink_operator.h
#	fe/fe-core/src/main/java/com/starrocks/qe/ConnectProcessor.java
#	fe/fe-core/src/main/java/com/starrocks/qe/DefaultCoordinator.java
#	fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java
mergify bot pushed a commit that referenced this pull request Sep 14, 2023
…wer (#30663)

Signed-off-by: liuyehcf <1559500551@qq.com>
(cherry picked from commit 4a6b0c9)

# Conflicts:
#	be/src/exec/pipeline/olap_table_sink_operator.cpp
#	be/src/exec/pipeline/olap_table_sink_operator.h
#	be/src/exec/pipeline/result_sink_operator.h
#	be/src/exec/pipeline/sink/export_sink_operator.cpp
#	be/src/exec/pipeline/sink/export_sink_operator.h
#	be/src/exec/pipeline/sink/iceberg_table_sink_operator.cpp
#	be/src/exec/pipeline/sink/iceberg_table_sink_operator.h
#	be/src/exec/pipeline/sink/memory_scratch_sink_operator.cpp
#	be/src/exec/pipeline/sink/memory_scratch_sink_operator.h
#	fe/fe-core/src/main/java/com/starrocks/qe/ConnectProcessor.java
#	fe/fe-core/src/main/java/com/starrocks/qe/DefaultCoordinator.java
#	fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java
mergify bot pushed a commit that referenced this pull request Sep 14, 2023
…wer (#30663)

Signed-off-by: liuyehcf <1559500551@qq.com>
(cherry picked from commit 4a6b0c9)

# Conflicts:
#	be/src/exec/pipeline/olap_table_sink_operator.cpp
#	be/src/exec/pipeline/olap_table_sink_operator.h
#	be/src/exec/pipeline/result_sink_operator.h
#	be/src/exec/pipeline/sink/export_sink_operator.cpp
#	be/src/exec/pipeline/sink/export_sink_operator.h
#	be/src/exec/pipeline/sink/iceberg_table_sink_operator.cpp
#	be/src/exec/pipeline/sink/iceberg_table_sink_operator.h
#	be/src/exec/pipeline/sink/memory_scratch_sink_operator.cpp
#	be/src/exec/pipeline/sink/memory_scratch_sink_operator.h
#	fe/fe-core/src/main/java/com/starrocks/qe/ConnectProcessor.java
#	fe/fe-core/src/main/java/com/starrocks/qe/DefaultCoordinator.java
#	fe/fe-core/src/main/java/com/starrocks/qe/LeaderOpExecutor.java
#	fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java
#	gensrc/thrift/FrontendService.thrift
@liuyehcf
Copy link
Contributor Author

@Mergifyio backport branch-3.2

@mergify
Copy link
Contributor

mergify bot commented Sep 14, 2023

backport branch-3.2

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 14, 2023
…wer (#30663)

Signed-off-by: liuyehcf <1559500551@qq.com>
(cherry picked from commit 4a6b0c9)

# Conflicts:
#	be/src/exec/pipeline/result_sink_operator.h
#	fe/fe-core/src/main/java/com/starrocks/qe/ConnectProcessor.java
#	fe/fe-core/src/main/java/com/starrocks/qe/LeaderOpExecutor.java
#	fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java
#	gensrc/thrift/FrontendService.thrift
kangkaisen pushed a commit that referenced this pull request Sep 14, 2023
…wer (backport #30663) (#31045)

Signed-off-by: liuyehcf <1559500551@qq.com>
Co-authored-by: liuyehcf <1559500551@qq.com>
liuyehcf added a commit that referenced this pull request Sep 14, 2023
liuyehcf added a commit to liuyehcf/starrocks that referenced this pull request Sep 14, 2023
liuyehcf added a commit to liuyehcf/starrocks that referenced this pull request Sep 14, 2023
liuyehcf added a commit that referenced this pull request Sep 14, 2023
…wer (backport #30663) (#31044)

Signed-off-by: liuyehcf <1559500551@qq.com>
Co-authored-by: liuyehcf <1559500551@qq.com>
liuyehcf added a commit that referenced this pull request Sep 14, 2023
…wer (backport #30663) (#31043)

Signed-off-by: liuyehcf <1559500551@qq.com>
Co-authored-by: liuyehcf <1559500551@qq.com>
liuyehcf added a commit that referenced this pull request Sep 14, 2023
…wer (backport #30663) (#31046)

Signed-off-by: liuyehcf <1559500551@qq.com>
Co-authored-by: liuyehcf <1559500551@qq.com>
@ZiheLiu ZiheLiu mentioned this pull request Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants