-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
ADD: support sql block rule #6192
Conversation
fe/fe-core/src/main/java/org/apache/doris/analysis/AlterSqlBlockRuleStmt.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/analysis/AlterSqlBlockRuleStmt.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/analysis/AlterSqlBlockRuleStmt.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateSqlBlockRuleStmt.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/test/java/org/apache/doris/qe/StmtExecutorTest.java
Outdated
Show resolved
Hide resolved
I think this feature is used to block some abnormal sql, for example , sql caused core. Is it need to limit the number of rules, which will occupied a lot of memory. Is is better to store the hash value of a sql, not the sql self, when a sql is very long? |
At present, in my scenario, some special user are not allowed to join, and some large tables are not allowed to query the full table, really do not need too many rules |
Using hash to block problematic SQL may also be a practical requirement. In some cases, we need to quickly block some SQL that affects the cluster through the block rules. There are pros and cons to using regular expressions or hash values:
In summary, we can implement two block rules, one based on hash and the other based on regular expressions. |
Okay, I'm going to support both matches |
fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/analysis/AlterSqlBlockRuleStmt.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
Outdated
Show resolved
Hide resolved
2a51703
to
b0c8bcc
Compare
b1aa4ef
to
80ce658
Compare
fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
Outdated
Show resolved
Hide resolved
71423dd
to
2e0b697
Compare
fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
5d5bb52
to
a4b6d49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR approved by at least one committer and no changes requested. |
Support grammar: - SHOW SQL_BLOCK_RULE [FOR NAME] - CREATE SQL_BLOCK_RULE test_rule PROPERTIES ("user"="default", "sql"="select .* from .* join .*", "enable": "true"); - ALTER SQL_BLOCK_RULE test_rule PROPERTIES ("user"="test_user", "enable": "false"); - DROP SQL_BLOCK_RULE test_rule1,test_rule2;
Support grammar: - SHOW SQL_BLOCK_RULE [FOR NAME] - CREATE SQL_BLOCK_RULE test_rule PROPERTIES ("user"="default", "sql"="select .* from .* join .*", "enable": "true"); - ALTER SQL_BLOCK_RULE test_rule PROPERTIES ("user"="test_user", "enable": "false"); - DROP SQL_BLOCK_RULE test_rule1,test_rule2;
Proposed changes
Support configuring sql_block_rule by user level to deny the specified SQL
Types of changes
What types of changes does your code introduce to Doris?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.