ValidateResqueueCapabilityEntry * * Validate the resource setting for a pg_resqueuecapability entry. * Insert calls to separate per-resourcetype validation functions * here. */
| 169 | * here. |
| 170 | */ |
| 171 | static |
| 172 | void ValidateResqueueCapabilityEntry(int resTypeInt, |
| 173 | char *pResSetting) |
| 174 | { |
| 175 | bool bValid = true; |
| 176 | char *restyp = "unknown"; |
| 177 | |
| 178 | switch(resTypeInt) |
| 179 | { |
| 180 | case PG_RESRCTYPE_ACTIVE_STATEMENTS:/* rsqcountlimit: count */ |
| 181 | case PG_RESRCTYPE_MAX_COST: /* rsqcostlimit: max_cost */ |
| 182 | case PG_RESRCTYPE_MIN_COST: /* rsqignorecostlimit: min_cost */ |
| 183 | case PG_RESRCTYPE_COST_OVERCOMMIT: /* rsqovercommit: cost_overcommit*/ |
| 184 | break; |
| 185 | |
| 186 | /* start of "pg_resourcetype" entries... */ |
| 187 | case PG_RESRCTYPE_PRIORITY: /* backoff.c: priority queue */ |
| 188 | bValid = ValidPriority(pResSetting); |
| 189 | restyp = "PRIORITY"; |
| 190 | break; |
| 191 | |
| 192 | case PG_RESRCTYPE_MEMORY_LIMIT: |
| 193 | bValid = ValidMemoryLimit(pResSetting); |
| 194 | Assert(bValid); |
| 195 | restyp = "MEMORY_LIMIT"; |
| 196 | |
| 197 | break; |
| 198 | |
| 199 | default: |
| 200 | ereport(ERROR, |
| 201 | (errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
| 202 | errmsg("unknown resource type \"%d\"", |
| 203 | resTypeInt))); |
| 204 | |
| 205 | break; |
| 206 | } |
| 207 | |
| 208 | if (!bValid) |
| 209 | ereport(ERROR, |
| 210 | (errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
| 211 | errmsg("Invalid parameter value \"%s\" for " |
| 212 | "resource type \"%s\"", |
| 213 | pResSetting, restyp))); |
| 214 | |
| 215 | } |
| 216 | |
| 217 | /* MPP-6923: */ |
| 218 | /* AddUpdResqueueCapabilityEntryInternal: |
no test coverage detected