Skip to content

Commit b205c82

Browse files
committed
chore(query): log the access denied query to log file
1 parent f2265e1 commit b205c82

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/query/service/src/interpreters/interpreter_factory.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use std::sync::Arc;
1717
use common_exception::ErrorCode;
1818
use common_exception::Result;
1919
use common_legacy_planners::PlanNode;
20+
use tracing::error;
2021

2122
use crate::interpreters::access::Accessor;
2223
use crate::interpreters::DeleteInterpreter;
@@ -38,7 +39,9 @@ impl InterpreterFactory {
3839
pub fn get(ctx: Arc<QueryContext>, plan: PlanNode) -> Result<Arc<dyn Interpreter>> {
3940
// Check the access permission.
4041
let access_checker = Accessor::create(ctx.clone());
41-
access_checker.check(&plan)?;
42+
access_checker
43+
.check(&plan)
44+
.map(|e| error!("Access.denied(v1): {:?}", e))?;
4245

4346
let inner = Self::create_interpreter(ctx.clone(), &plan)?;
4447
let query_kind = plan.name().to_string();

src/query/service/src/interpreters/interpreter_factory_v2.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use std::sync::Arc;
1616

1717
use common_exception::Result;
18+
use tracing::error;
1819

1920
use super::interpreter_share_desc::DescShareInterpreter;
2021
use super::interpreter_user_stage_drop::DropUserStageInterpreter;
@@ -45,7 +46,9 @@ impl InterpreterFactoryV2 {
4546
pub fn get(ctx: Arc<QueryContext>, plan: &Plan) -> Result<InterpreterPtr> {
4647
// Check the access permission.
4748
let access_checker = Accessor::create(ctx.clone());
48-
access_checker.check_new(plan)?;
49+
access_checker
50+
.check_new(plan)
51+
.map(|e| error!("Access.denied(v2): {:?}", e))?;
4952

5053
let inner = InterpreterFactoryV2::create_interpreter(ctx.clone(), plan)?;
5154

0 commit comments

Comments
 (0)