MCPcopy Create free account
hub / github.com/apache/cloudberry / insertResgroupCapabilities

Function insertResgroupCapabilities

src/backend/commands/resgroupcmds.c:1163–1198  ·  view source on GitHub ↗

* Insert all the capabilities to the capability table. * * We store the capabilities in multiple lines for one group, * so we have to insert them one by one. This function will * handle the type conversion etc.. * * @param groupid oid of the resource group * @param caps the capabilities */

Source from the content-addressed store, hash-verified

1161 * @param caps the capabilities
1162 */
1163static void
1164insertResgroupCapabilities(Relation rel, Oid groupId, ResGroupCaps *caps)
1165{
1166 char value[64];
1167
1168 snprintf(value, sizeof(value), "%d", caps->concurrency);
1169 insertResgroupCapabilityEntry(rel, groupId,
1170 RESGROUP_LIMIT_TYPE_CONCURRENCY, value);
1171
1172 snprintf(value, sizeof(value), "%d", caps->cpuMaxPercent);
1173 insertResgroupCapabilityEntry(rel, groupId,
1174 RESGROUP_LIMIT_TYPE_CPU, value);
1175
1176 snprintf(value, sizeof(value), "%d", caps->cpuWeight);
1177 insertResgroupCapabilityEntry(rel, groupId,
1178 RESGROUP_LIMIT_TYPE_CPU_SHARES, value);
1179
1180 insertResgroupCapabilityEntry(rel, groupId,
1181 RESGROUP_LIMIT_TYPE_CPUSET, caps->cpuset);
1182
1183 snprintf(value, sizeof(value), "%d", caps->memory_quota);
1184 insertResgroupCapabilityEntry(rel, groupId,
1185 RESGROUP_LIMIT_TYPE_MEMORY_QUOTA, value);
1186
1187 snprintf(value, sizeof(value), "%d", caps->min_cost);
1188 insertResgroupCapabilityEntry(rel, groupId,
1189 RESGROUP_LIMIT_TYPE_MIN_COST, value);
1190
1191 if (caps->io_limit != NIL)
1192 insertResgroupCapabilityEntry(rel, groupId,
1193 RESGROUP_LIMIT_TYPE_IO_LIMIT,
1194 cgroupOpsRoutine->dumpio((caps->io_limit)));
1195 else
1196 insertResgroupCapabilityEntry(rel, groupId,
1197 RESGROUP_LIMIT_TYPE_IO_LIMIT, DefaultIOLimit);
1198}
1199
1200/*
1201 * Update all the capabilities of one resgroup in pg_resgroupcapability

Callers 1

CreateResourceGroupFunction · 0.85

Calls 1

Tested by

no test coverage detected