xlog store in single lun in shared storage

This commit is contained in:
shenzheng4 2023-06-15 20:32:30 +08:00
parent d58ea2eb14
commit eb7c9cac27
3 changed files with 41 additions and 4 deletions

View File

@ -70,10 +70,14 @@ class DssConfig():
inst.dss_config = str(
DssConfig((dss_ids, dss_ips, dss_ports), offset=10))
infos = list(filter(None, re.split(r':|,', inst.dss_vg_info)))
if len(infos[::2]) != len(dss_ips) + 1:
# We support two deployment method:
# 1. one dss disk for xlog of each node, and one dss disk for shared data;
# 2. one dss disk for xlogs of all nodes, and one dss disk for shared data;
if (len(infos[::2]) != len(dss_ips) + 1) and (len(infos[::2]) != 2):
raise Exception(
ErrorCode.GAUSS_500['GAUSS_50026'] % 'dss_vg_info' +
' The number of volumes is one more than the number of dns.' +
' The number of volumes is one more than the number of dns or the number of volumes is 2.' +
' The number of dns is {} and the number of dss volumes is {}'.
format(len(dss_ips), len(infos[::2])))
for dp in dss_ports:

View File

@ -64,13 +64,39 @@ class DssInst():
else:
raise Exception(ErrorCode.GAUSS_502["GAUSS_50201"] % self.cfg_path)
return items
@staticmethod
def get_private_vg_num(dss_home):
'''
Obtaining Private Volumes
'''
vg_cfg = os.path.join(dss_home, 'cfg', 'dss_vg_conf.ini')
if os.path.isfile(vg_cfg):
try:
with open(vg_cfg, "r") as fp:
context = fp.read().strip()
pris = re.findall(
'(.*):/dev/.*private_.*', context)
if pris:
return len(pris)
else:
raise Exception(ErrorCode.GAUSS_504["GAUSS_50416"] %
'in dss_vg_conf.ini')
except Exception as eds:
raise Exception(ErrorCode.GAUSS_504["GAUSS_50414"] % eds)
else:
raise Exception(ErrorCode.GAUSS_502["GAUSS_50201"] % vg_cfg)
@staticmethod
def get_private_vgname_by_ini(dss_home, dss_id):
def get_private_vgname_by_ini(dss_home, dss_id, xlog_in_one_priv_vg):
'''
Obtaining a Private Volume
'''
if xlog_in_one_priv_vg:
dss_id = 0
vg_cfg = os.path.join(dss_home, 'cfg', 'dss_vg_conf.ini')
if os.path.isfile(vg_cfg):
try:

View File

@ -150,7 +150,14 @@ class DN_OLAP(Kernel):
dss_nodes_list = DssConfig.get_value_b64_handler(
'dss_nodes_list', self.dss_config, action='decode')
cfg_context = DssInst.get_dms_url(dss_nodes_list)
pri_vgname = DssInst.get_private_vgname_by_ini(dss_home, inst_id)
xlog_in_one_priv_vg = False
infos = list(filter(None, re.split(r':|:|,', dss_nodes_list)))
pri_vg_num = DssInst.get_private_vg_num(dss_home)
# when use one private vg for xlog, vgname should get from inst_id=0
if (pri_vg_num < len(infos[::3]) and pri_vg_num == 1):
xlog_in_one_priv_vg = True
pri_vgname = DssInst.get_private_vgname_by_ini(dss_home, inst_id, xlog_in_one_priv_vg)
cmd += " -n --vgname=\"{}\" --enable-dss --dms_url=\"{}\" -I {}" \
" --socketpath=\"{}\"".format(
"+{},+{}".format(vgname, pri_vgname), cfg_context, inst_id,