dynamic set shared_buffers value by om install

This commit is contained in:
chenxiaobin
2021-01-08 09:55:19 +08:00
parent 6d826b9755
commit 836186bd1d
2 changed files with 23 additions and 1 deletions

View File

@ -4018,6 +4018,28 @@ class DefaultValue():
else:
gucDict[guc] = "2047GB"
continue
elif (guc == "shared_buffers"):
if (int(dynamicParaList[0]) < 256):
ratioNum = 1
elif (int(dynamicParaList[0]) < 512):
ratioNum = 2
else:
ratioNum = 3
gucDict[guc] = gucDict[guc].replace(
"PHYSIC_MEMORY", dynamicParaList[1])
gucDict[guc] = gucDict[guc].replace(
"MAX_MASTER_DATANUM_IN_ONENODE", dynamicParaList[2])
gucDict[guc] = gucDict[guc].replace("N", str(ratioNum))
try:
gucDict[guc] = eval(gucDict[guc])
except Exception as e:
raise Exception(ErrorCode.GAUSS_516["GAUSS_51632"] %
"calculate: %s" % gucDict[guc])
gucDict[guc] = int(gucDict[guc] * 1024)
if (gucDict[guc] >= 1024):
gucDict[guc] = "1GB"
else:
gucDict[guc] = str(gucDict[guc]) + "MB"
return gucDict
@staticmethod