mirror of https://github.com/citusdata/citus.git
Indent
parent
bb2ab9e93c
commit
46ae3a37d5
|
@ -150,7 +150,7 @@ distributed_planner(Query *parse,
|
||||||
{
|
{
|
||||||
AttributeQueryIfAnnotated(query_string, parse->commandType);
|
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)
|
||||||
|
|
|
@ -193,17 +193,19 @@ AttributeQueryIfAnnotated(const char *query_string, CmdType commandType)
|
||||||
}
|
}
|
||||||
|
|
||||||
int colocationId = ExtractFieldInt32(jsonbDatum, "cId",
|
int colocationId = ExtractFieldInt32(jsonbDatum, "cId",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
AttributeTask(tenantId, colocationId, commandType);
|
AttributeTask(tenantId, colocationId, commandType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AttributeTask assigns the given attributes of a tenant and starts a timer
|
* AttributeTask assigns the given attributes of a tenant and starts a timer
|
||||||
*/
|
*/
|
||||||
void AttributeTask(char *tenantId, int colocationId, CmdType commandType)
|
void
|
||||||
|
AttributeTask(char *tenantId, int colocationId, CmdType commandType)
|
||||||
{
|
{
|
||||||
colocationGroupId = colocationId;
|
colocationGroupId = colocationId;
|
||||||
strcpy_s(attributeToTenant, sizeof(attributeToTenant), tenantId);
|
strcpy_s(attributeToTenant, sizeof(attributeToTenant), tenantId);
|
||||||
|
@ -212,14 +214,15 @@ void AttributeTask(char *tenantId, int colocationId, CmdType commandType)
|
||||||
if (MultiTenantMonitoringLogLevel != CITUS_LOG_LEVEL_OFF)
|
if (MultiTenantMonitoringLogLevel != CITUS_LOG_LEVEL_OFF)
|
||||||
{
|
{
|
||||||
ereport(NOTICE, (errmsg(
|
ereport(NOTICE, (errmsg(
|
||||||
"attributing query to tenant: %s, colocationGroupId: %d",
|
"attributing query to tenant: %s, colocationGroupId: %d",
|
||||||
quote_literal_cstr(attributeToTenant),
|
quote_literal_cstr(attributeToTenant),
|
||||||
colocationGroupId)));
|
colocationGroupId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
attributeToTenantStart = clock();
|
attributeToTenantStart = clock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AnnotateQuery annotates the query with tenant attributes.
|
* AnnotateQuery annotates the query with tenant attributes.
|
||||||
*/
|
*/
|
||||||
|
@ -621,42 +624,43 @@ MultiTenantMonitorshmemSize(void)
|
||||||
static char *
|
static char *
|
||||||
ExtractTopComment(const char *inputString)
|
ExtractTopComment(const char *inputString)
|
||||||
{
|
{
|
||||||
int commentCharsLength = 2;
|
int commentCharsLength = 2;
|
||||||
int inputStringLen = strlen(inputString);
|
int inputStringLen = strlen(inputString);
|
||||||
if (inputStringLen < commentCharsLength)
|
if (inputStringLen < commentCharsLength)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *commentStartChars = "/*";
|
const char *commentStartChars = "/*";
|
||||||
const char *commentEndChars = "*/";
|
const char *commentEndChars = "*/";
|
||||||
|
|
||||||
/* If query doesn't start with a comment, return NULL */
|
/* If query doesn't start with a comment, return NULL */
|
||||||
if (strstr(inputString, commentStartChars) != inputString)
|
if (strstr(inputString, commentStartChars) != inputString)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringInfo commentData = makeStringInfo();
|
StringInfo commentData = makeStringInfo();
|
||||||
|
|
||||||
/* Skip the comment start characters */
|
/* Skip the comment start characters */
|
||||||
const char *commentStart = inputString + commentCharsLength;
|
const char *commentStart = inputString + commentCharsLength;
|
||||||
|
|
||||||
/* Find the first comment end character */
|
/* Find the first comment end character */
|
||||||
const char *commentEnd = strstr(commentStart, commentEndChars);
|
const char *commentEnd = strstr(commentStart, commentEndChars);
|
||||||
if (commentEnd == NULL)
|
if (commentEnd == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append the comment to the StringInfo buffer */
|
/* Append the comment to the StringInfo buffer */
|
||||||
int commentLength = commentEnd - commentStart;
|
int commentLength = commentEnd - commentStart;
|
||||||
appendStringInfo(commentData, "%.*s", commentLength, commentStart);
|
appendStringInfo(commentData, "%.*s", commentLength, commentStart);
|
||||||
|
|
||||||
/* Return the extracted comment */
|
/* Return the extracted comment */
|
||||||
return commentData->data;
|
return commentData->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* EscapeCommentChars adds a backslash before each occurrence of '*' or '/' in the input string */
|
/* EscapeCommentChars adds a backslash before each occurrence of '*' or '/' in the input string */
|
||||||
static char *
|
static char *
|
||||||
EscapeCommentChars(const char *str)
|
EscapeCommentChars(const char *str)
|
||||||
|
@ -673,11 +677,12 @@ EscapeCommentChars(const char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfoChar(escapedString, str[originalStringIndex]);
|
appendStringInfoChar(escapedString, str[originalStringIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return escapedString->data;
|
return escapedString->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* UnescapeCommentChars removes the backslash that precedes '*' or '/' in the input string. */
|
/* UnescapeCommentChars removes the backslash that precedes '*' or '/' in the input string. */
|
||||||
static char *
|
static char *
|
||||||
UnescapeCommentChars(const char *str)
|
UnescapeCommentChars(const char *str)
|
||||||
|
|
Loading…
Reference in New Issue