| 2277 | } |
| 2278 | |
| 2279 | void ClientRequestState::LogQueryEvents() { |
| 2280 | // Wait until the results are available. This guarantees the completion of non QUERY |
| 2281 | // statements like DDL/DML etc. Query events are logged if the query reaches a FINISHED |
| 2282 | // state. For certain query types, events are logged regardless of the query state. |
| 2283 | Status status; |
| 2284 | { |
| 2285 | lock_guard<mutex> l(lock_); |
| 2286 | status = query_status(); |
| 2287 | } |
| 2288 | bool log_events = true; |
| 2289 | switch (stmt_type()) { |
| 2290 | case TStmtType::QUERY: |
| 2291 | case TStmtType::DML: |
| 2292 | case TStmtType::DDL: |
| 2293 | case TStmtType::UNKNOWN: |
| 2294 | log_events = status.ok(); |
| 2295 | break; |
| 2296 | case TStmtType::EXPLAIN: |
| 2297 | case TStmtType::LOAD: |
| 2298 | case TStmtType::SET: |
| 2299 | case TStmtType::ADMIN_FN: |
| 2300 | default: |
| 2301 | break; |
| 2302 | } |
| 2303 | |
| 2304 | // Log audit events that are due to an AuthorizationException. |
| 2305 | if (parent_server_->IsAuditEventLoggingEnabled() && |
| 2306 | (Frontend::IsAuthorizationError(status) || log_events)) { |
| 2307 | // TODO: deal with an error status |
| 2308 | discard_result(LogAuditRecord(status)); |
| 2309 | } |
| 2310 | |
| 2311 | if (log_events && (parent_server_->AreQueryHooksEnabled() || |
| 2312 | parent_server_->IsLineageLoggingEnabled())) { |
| 2313 | // TODO: deal with an error status |
| 2314 | discard_result(LogLineageRecord()); |
| 2315 | } |
| 2316 | } |
| 2317 | |
| 2318 | Status ClientRequestState::LogAuditRecord(const Status& query_status) { |
| 2319 | const TExecRequest& request = exec_request(); |
nothing calls this directly
no test coverage detected