| 1270 | ImpalaServer::~ImpalaServer() {} |
| 1271 | |
| 1272 | void ImpalaServer::AddPoolConfiguration(TQueryCtx* ctx, |
| 1273 | const QueryOptionsMask& override_options_mask) { |
| 1274 | // Errors are not returned and are only logged (at level 2) because some incoming |
| 1275 | // requests are not expected to be mapped to a pool and will not have query options, |
| 1276 | // e.g. 'use [db];'. For requests that do need to be mapped to a pool successfully, the |
| 1277 | // pool is resolved again during scheduling and errors are handled at that point. |
| 1278 | string resolved_pool; |
| 1279 | Status status = exec_env_->request_pool_service()->ResolveRequestPool(*ctx, |
| 1280 | &resolved_pool); |
| 1281 | if (!status.ok()) { |
| 1282 | VLOG_RPC << "Not adding pool query options for query=" << PrintId(ctx->query_id) |
| 1283 | << " ResolveRequestPool status: " << status.GetDetail(); |
| 1284 | return; |
| 1285 | } |
| 1286 | ctx->__set_request_pool(resolved_pool); |
| 1287 | |
| 1288 | TPoolConfig config; |
| 1289 | status = exec_env_->request_pool_service()->GetPoolConfig(resolved_pool, &config); |
| 1290 | if (!status.ok()) { |
| 1291 | VLOG_RPC << "Not adding pool query options for query=" << PrintId(ctx->query_id) |
| 1292 | << " GetConfigPool status: " << status.GetDetail(); |
| 1293 | return; |
| 1294 | } |
| 1295 | |
| 1296 | TQueryOptions pool_options; |
| 1297 | QueryOptionsMask set_pool_options_mask; |
| 1298 | status = ParseQueryOptions(config.default_query_options, &pool_options, |
| 1299 | &set_pool_options_mask); |
| 1300 | if (!status.ok()) { |
| 1301 | VLOG_QUERY << "Ignoring errors while parsing default query options for pool=" |
| 1302 | << resolved_pool << ", message: " << status.GetDetail(); |
| 1303 | } |
| 1304 | |
| 1305 | QueryOptionsMask overlay_mask = override_options_mask & set_pool_options_mask; |
| 1306 | VLOG_RPC << "Parsed pool options: " << DebugQueryOptions(pool_options) |
| 1307 | << " override_options_mask=" << override_options_mask.to_string() |
| 1308 | << " set_pool_mask=" << set_pool_options_mask.to_string() |
| 1309 | << " overlay_mask=" << overlay_mask.to_string(); |
| 1310 | OverlayQueryOptions(pool_options, overlay_mask, &ctx->client_request.query_options); |
| 1311 | |
| 1312 | // Enforce the max mt_dop after the defaults and overlays have already been done. |
| 1313 | EnforceMaxMtDop(ctx, config.max_mt_dop); |
| 1314 | |
| 1315 | status = ValidateQueryOptions(&pool_options); |
| 1316 | if (!status.ok()) { |
| 1317 | VLOG_QUERY << "Ignoring errors while validating default query options for pool=" |
| 1318 | << resolved_pool << ", message: " << status.GetDetail(); |
| 1319 | } |
| 1320 | } |
| 1321 | |
| 1322 | void ImpalaServer::EnforceMaxMtDop(TQueryCtx* query_ctx, int64_t max_mt_dop) { |
| 1323 | TQueryOptions& query_options = query_ctx->client_request.query_options; |
nothing calls this directly
no test coverage detected