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

Function ValidMemoryLimit

src/backend/commands/queue.c:132–162  ·  view source on GitHub ↗

* Validate memory limit setting. */

Source from the content-addressed store, hash-verified

130 * Validate memory limit setting.
131 */
132static
133bool ValidMemoryLimit(char *pResSetting)
134{
135 int valueKB;
136 const char *restyp = "MEMORY_LIMIT";
137
138 bool result = parse_int(pResSetting, &valueKB, GUC_UNIT_KB, NULL);
139
140 if (!result)
141 {
142 ereport(ERROR,
143 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
144 errmsg("Invalid parameter value \"%s\" for "
145 "resource type \"%s\". "
146 "Value must be in kB, MB or GB.",
147 pResSetting, restyp)));
148
149 }
150 else if (valueKB != -1 && valueKB < MIN_RESOURCEQUEUE_MEMORY_LIMIT_KB)
151 {
152 ereport(ERROR,
153 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
154 errmsg("Invalid parameter value \"%s\" for "
155 "resource type \"%s\". "
156 "Value must be at least %dkB",
157 pResSetting, restyp, (int) MIN_RESOURCEQUEUE_MEMORY_LIMIT_KB)));
158
159 }
160
161 return true;
162}
163
164
165/* ValidateResqueueCapabilityEntry

Callers 1

Calls 3

parse_intFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected