Move adding tenant statistic attributes to local_executor to keep track of both local shard queries and local cached queries

pull/6763/head
Gokhan Gulbiz 2023-03-22 16:39:10 +03:00
parent 9a0ed9844f
commit bb2ab9e93c
No known key found for this signature in database
GPG Key ID: 608EF06B6BD1B45B
4 changed files with 8 additions and 6 deletions

View File

@ -103,6 +103,7 @@
#include "optimizer/optimizer.h" #include "optimizer/optimizer.h"
#include "nodes/params.h" #include "nodes/params.h"
#include "utils/snapmgr.h" #include "utils/snapmgr.h"
#include "distributed/utils/attribute.h"
/* controlled via a GUC */ /* controlled via a GUC */
bool EnableLocalExecution = true; bool EnableLocalExecution = true;
@ -646,6 +647,8 @@ LocallyExecuteTaskPlan(PlannedStmt *taskPlan, char *queryString,
LocalExecutorShardId = task->anchorShardId; LocalExecutorShardId = task->anchorShardId;
} }
AttributeTask(task->partitionColumn, task->colocationId, taskPlan->commandType);
PG_TRY(); PG_TRY();
{ {
processedRows = ExecuteTaskPlan(taskPlan, queryString, tupleDest, task, processedRows = ExecuteTaskPlan(taskPlan, queryString, tupleDest, task,

View File

@ -400,7 +400,6 @@ SetTaskQueryIfShouldLazyDeparse(Task *task, Query *query)
task->taskQuery.queryType = TASK_QUERY_OBJECT; task->taskQuery.queryType = TASK_QUERY_OBJECT;
task->taskQuery.data.jobQueryReferenceForLazyDeparsing = query; task->taskQuery.data.jobQueryReferenceForLazyDeparsing = query;
task->queryCount = 1; task->queryCount = 1;
AttributeTask(task->partitionColumn, task->colocationId, query->commandType);
return; return;
} }

View File

@ -146,8 +146,11 @@ distributed_planner(Query *parse,
bool fastPathRouterQuery = false; bool fastPathRouterQuery = false;
Node *distributionKeyValue = NULL; Node *distributionKeyValue = NULL;
AttributeQueryIfAnnotated(query_string, parse->commandType); if (query_string != NULL)
{
AttributeQueryIfAnnotated(query_string, parse->commandType);
}
List *rangeTableList = ExtractRangeTableEntryList(parse); List *rangeTableList = ExtractRangeTableEntryList(parse);
if (cursorOptions & CURSOR_OPT_FORCE_DISTRIBUTED) if (cursorOptions & CURSOR_OPT_FORCE_DISTRIBUTED)

View File

@ -205,9 +205,6 @@ AttributeQueryIfAnnotated(const char *query_string, CmdType commandType)
*/ */
void AttributeTask(char *tenantId, int colocationId, CmdType commandType) void AttributeTask(char *tenantId, int colocationId, CmdType commandType)
{ {
ereport(NOTICE, (errmsg("MyProcPid: %d", MyProcPid)));
sleep(10);
colocationGroupId = colocationId; colocationGroupId = colocationId;
strcpy_s(attributeToTenant, sizeof(attributeToTenant), tenantId); strcpy_s(attributeToTenant, sizeof(attributeToTenant), tenantId);
attributeCommandType = commandType; attributeCommandType = commandType;