You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-11-03 17:13:17 +03:00
Merge pull request #1472 from jmrojas2332/MCOL-4314-develop
MCOL-4314 shared storage manager cluster initialization fix.
This commit is contained in:
@@ -302,25 +302,23 @@ if [ ! -z "$MCS_USE_S3_STORAGE" ] && [ $MCS_USE_S3_STORAGE -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
#change ownership/permissions to be able to run columnstore as non-root
|
#change ownership/permissions to be able to run columnstore as non-root
|
||||||
chown -R mysql:mysql /var/log/mariadb/columnstore
|
# TODO: Remove conditional once container dispatcher uses non-root by default
|
||||||
chown -R mysql:mysql /etc/columnstore
|
if [ $(running_systemd) -eq 0 ]; then
|
||||||
chown -R mysql:mysql /var/lib/columnstore
|
chown -R mysql:mysql /var/log/mariadb/columnstore
|
||||||
chown -R mysql:mysql /tmp/columnstore_tmp_files
|
chown -R mysql:mysql /etc/columnstore
|
||||||
chmod 777 /tmp/columnstore_tmp_files
|
chown -R mysql:mysql /var/lib/columnstore
|
||||||
chmod 777 /dev/shm
|
chown -R mysql:mysql /tmp/columnstore_tmp_files
|
||||||
|
chmod 777 /tmp/columnstore_tmp_files
|
||||||
|
chmod 777 /dev/shm
|
||||||
|
fi
|
||||||
|
|
||||||
systemctl cat mariadb-columnstore.service > /dev/null 2>&1
|
systemctl cat mariadb-columnstore.service > /dev/null 2>&1
|
||||||
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
if [ $? -eq 0 ] && [ $(running_systemd) -eq 0 ]; then
|
||||||
# prevent clusters using shared storage from initializing columnstore more than once
|
|
||||||
IFLAG=/var/lib/columnstore/storagemanager/cs-initialized
|
|
||||||
mkdir -p /var/lib/columnstore/storagemanager
|
mkdir -p /var/lib/columnstore/storagemanager
|
||||||
chown -R mysql:mysql /var/lib/columnstore/storagemanager
|
chown -R mysql:mysql /var/lib/columnstore/storagemanager
|
||||||
|
|
||||||
if [ ! -e $IFLAG ]; then
|
|
||||||
touch $IFLAG
|
|
||||||
echo "Populating the engine initial system catalog."
|
echo "Populating the engine initial system catalog."
|
||||||
systemctl start mariadb-columnstore
|
systemctl start mariadb-columnstore
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $stop_mysqld -eq 1 ];then
|
if [ $stop_mysqld -eq 1 ];then
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
# This script allows to gracefully start MCS
|
# This script allows to gracefully start MCS
|
||||||
|
|
||||||
|
# prevent nodes using shared storage manager from stepping on each other when initializing
|
||||||
|
# flock will open up an exclusive file lock to run atomic operations
|
||||||
|
exec {fd_lock}>/var/lib/columnstore/storagemanager/storagemanager-lock
|
||||||
|
flock -n "$fd_lock" || exit 0
|
||||||
|
|
||||||
/bin/systemctl start mcs-workernode
|
/bin/systemctl start mcs-workernode
|
||||||
/bin/systemctl start mcs-controllernode
|
/bin/systemctl start mcs-controllernode
|
||||||
/bin/systemctl start mcs-primproc
|
/bin/systemctl start mcs-primproc
|
||||||
@@ -9,7 +14,9 @@
|
|||||||
/bin/systemctl start mcs-exemgr
|
/bin/systemctl start mcs-exemgr
|
||||||
/bin/systemctl start mcs-dmlproc
|
/bin/systemctl start mcs-dmlproc
|
||||||
/bin/systemctl start mcs-ddlproc
|
/bin/systemctl start mcs-ddlproc
|
||||||
|
sleep 2
|
||||||
|
su -s /bin/sh -c 'dbbuilder 7' mysql 1> /tmp/columnstore_tmp_files/dbbuilder.log
|
||||||
|
|
||||||
su -s /bin/sh -c 'dbbuilder 7' mysql 2> /tmp/columnstore_tmp_files/dbbuilder.log
|
flock -u "$fd_lock"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -81,7 +81,12 @@ if __name__ == '__main__':
|
|||||||
# Single-node on S3
|
# Single-node on S3
|
||||||
if storage.lower() == 's3' and not bucket.lower() == 'some_bucket' and pmCount == 1:
|
if storage.lower() == 's3' and not bucket.lower() == 'some_bucket' and pmCount == 1:
|
||||||
try:
|
try:
|
||||||
brm_saves_current = subprocess.check_output(['smcat', brm])
|
if use_systemd:
|
||||||
|
args = ['su', '-s', '/bin/sh', '-c', f'smcat {brm}', 'mysql']
|
||||||
|
else:
|
||||||
|
args = ['smcat', brm]
|
||||||
|
|
||||||
|
brm_saves_current = subprocess.check_output(args)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
# will happen when brm file does not exist
|
# will happen when brm file does not exist
|
||||||
print('{} does not exist.'.format(brm), file=sys.stderr)
|
print('{} does not exist.'.format(brm), file=sys.stderr)
|
||||||
@@ -122,6 +127,8 @@ node.".format(e))
|
|||||||
|
|
||||||
if not os.path.exists(dbrmroot):
|
if not os.path.exists(dbrmroot):
|
||||||
os.makedirs(dbrmroot)
|
os.makedirs(dbrmroot)
|
||||||
|
if use_systemd:
|
||||||
|
shutil.chown(dbrmroot, USER, GROUP)
|
||||||
|
|
||||||
current_name = '{}_{}'.format(dbrmroot, e)
|
current_name = '{}_{}'.format(dbrmroot, e)
|
||||||
|
|
||||||
@@ -145,6 +152,10 @@ node {}.'.format(primary_address), file=sys.stderr)
|
|||||||
print('{} does not exist.'.format(brm), file=sys.stderr)
|
print('{} does not exist.'.format(brm), file=sys.stderr)
|
||||||
|
|
||||||
if brm_saves_current:
|
if brm_saves_current:
|
||||||
|
if use_systemd:
|
||||||
|
cmd = 'su -s /bin/sh -c "{} {}{}" mysql'.format(loadbrm, dbrmroot, \
|
||||||
|
brm_saves_current.decode("utf-8").replace("BRM_saves", ""))
|
||||||
|
else:
|
||||||
cmd = '{} {}{}'.format(loadbrm, dbrmroot, \
|
cmd = '{} {}{}'.format(loadbrm, dbrmroot, \
|
||||||
brm_saves_current.decode("utf-8").replace("BRM_saves", ""))
|
brm_saves_current.decode("utf-8").replace("BRM_saves", ""))
|
||||||
try:
|
try:
|
||||||
@@ -152,6 +163,7 @@ brm_saves_current.decode("utf-8").replace("BRM_saves", ""))
|
|||||||
if retcode < 0:
|
if retcode < 0:
|
||||||
print('{} exits with {}.'.format(cmd, retcode))
|
print('{} exits with {}.'.format(cmd, retcode))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
if use_systemd:
|
||||||
for shm_file in glob.glob('/dev/shm/*'):
|
for shm_file in glob.glob('/dev/shm/*'):
|
||||||
shutil.chown(shm_file, USER, GROUP)
|
shutil.chown(shm_file, USER, GROUP)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user