1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-05 16:15:50 +03:00

MCOL-4989: Fix error handling for misconfigured StorageManager startup. (#2385)

This commit is contained in:
benthompson15
2022-06-02 08:50:41 -05:00
committed by GitHub
parent 4e46645124
commit 652c9299b7
4 changed files with 28 additions and 4 deletions

View File

@@ -98,7 +98,7 @@ if __name__ == '__main__':
if use_systemd is True: if use_systemd is True:
cmd = 'systemctl start mcs-storagemanager' cmd = 'systemctl start mcs-storagemanager'
retcode = subprocess.call(cmd, shell=True) retcode = subprocess.call(cmd, shell=True)
if retcode < 0: if retcode != 0:
print('Failed to start storagemanager. \ print('Failed to start storagemanager. \
{} exits with {}.'.format(cmd, retcode)) {} exits with {}.'.format(cmd, retcode))
sys.exit(1) sys.exit(1)
@@ -219,7 +219,7 @@ brm_saves_current.decode("utf-8").replace("BRM_saves", ""), USER)
brm_saves_current.decode("utf-8").replace("BRM_saves", "")) brm_saves_current.decode("utf-8").replace("BRM_saves", ""))
try: try:
retcode = subprocess.call(cmd, shell=True) retcode = subprocess.call(cmd, shell=True)
if retcode < 0: if retcode != 0:
print('{} exits with {}.'.format(cmd, retcode)) print('{} exits with {}.'.format(cmd, retcode))
sys.exit(1) sys.exit(1)
# systemd services by default works using mysql privileges. # systemd services by default works using mysql privileges.
@@ -230,3 +230,9 @@ brm_saves_current.decode("utf-8").replace("BRM_saves", ""))
shutil.chown(shm_file, USER, GROUP) shutil.chown(shm_file, USER, GROUP)
except OSError as e: except OSError as e:
sys.exit(1) sys.exit(1)
else:
if s3_enabled:
print('brm_saves_currenty returned empty string from read_from_sm_with_retry')
else:
print('brm_saves_currenty returned empty string from read_from_disk')
sys.exit(1)

View File

@@ -56,7 +56,18 @@ CloudStorage* CloudStorage::get()
if (inst) if (inst)
return inst; return inst;
if (type == "s3") if (type == "s3")
inst = new S3Storage(); {
try
{
inst = new S3Storage();
}
catch (exception& e)
{
cout << "S3 Storage Manager Configuration Error:" << endl;
cout << e.what() << endl;
throw runtime_error("S3Storage: Failed");
}
}
else if (type == "local" || type == "localstorage") else if (type == "local" || type == "localstorage")
inst = new LocalStorage(); inst = new LocalStorage();
else else

View File

@@ -52,7 +52,7 @@ static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* use
inline bool retryable_error(uint8_t s3err) inline bool retryable_error(uint8_t s3err)
{ {
return (s3err == MS3_ERR_RESPONSE_PARSE || s3err == MS3_ERR_REQUEST_ERROR || s3err == MS3_ERR_OOM || return (s3err == MS3_ERR_RESPONSE_PARSE || s3err == MS3_ERR_REQUEST_ERROR || s3err == MS3_ERR_OOM ||
s3err == MS3_ERR_IMPOSSIBLE || s3err == MS3_ERR_AUTH || s3err == MS3_ERR_SERVER || s3err == MS3_ERR_IMPOSSIBLE || s3err == MS3_ERR_SERVER ||
s3err == MS3_ERR_AUTH_ROLE); s3err == MS3_ERR_AUTH_ROLE);
} }
@@ -294,6 +294,12 @@ void S3Storage::testConnectivityAndPerms()
err = deleteObject(testObjKey); err = deleteObject(testObjKey);
if (err) if (err)
FAIL(DELETE) FAIL(DELETE)
err = exists(testObjKey, &_exists);
if (err)
{
logger->log(LOG_CRIT, "S3Storage::exists() failed on nonexistent object. Check 'ListBucket' permissions.");
FAIL(HEAD)
}
logger->log(LOG_INFO, "S3Storage: S3 connectivity & permissions are OK"); logger->log(LOG_INFO, "S3Storage: S3 connectivity & permissions are OK");
} }

View File

@@ -87,6 +87,7 @@ void catFileOffline(const char* filename, int prefixlen)
catch (exception& e) catch (exception& e)
{ {
cerr << "smcat catFileOffline FAIL: " << e.what() << endl; cerr << "smcat catFileOffline FAIL: " << e.what() << endl;
exit(1);
} }
} }