diff --git a/oamapps/postConfigure/postConfigure.cpp b/oamapps/postConfigure/postConfigure.cpp index be02a8be7..a2c73e814 100644 --- a/oamapps/postConfigure/postConfigure.cpp +++ b/oamapps/postConfigure/postConfigure.cpp @@ -5429,6 +5429,12 @@ bool storageSetup(bool amazonInstall) hdfs = false; sysConfig->setConfig("StorageManager", "Enabled", "Y"); sysConfig->setConfig("SystemConfig", "DataFilePlugin", "libcloudio.so"); + // Verify S3 Configuration settings + if (system("testS3Connection")) + { + cout << "ERROR: S3Storage Configuration check failed. Verify storagemanager.cnf settings and rerun postConfigure." << endl; + return false; + } } else { diff --git a/storage-manager/CMakeLists.txt b/storage-manager/CMakeLists.txt index 6be5a3b9e..b6644f1e2 100755 --- a/storage-manager/CMakeLists.txt +++ b/storage-manager/CMakeLists.txt @@ -75,6 +75,11 @@ target_compile_definitions(unit_tests PUBLIC BOOST_NO_CXX11_SCOPED_ENUMS) target_link_libraries(unit_tests storagemanager) set_property(TARGET unit_tests PROPERTY CXX_STANDARD 11) +add_executable(testS3Connection src/testS3Connection.cpp) +target_compile_definitions(testS3Connection PUBLIC BOOST_NO_CXX11_SCOPED_ENUMS) +target_link_libraries(testS3Connection storagemanager) +set_property(TARGET testS3Connection PROPERTY CXX_STANDARD 11) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${TMPDIR}) add_custom_command( @@ -129,7 +134,7 @@ install(TARGETS storagemanager COMPONENT columnstore-platform ) -install(TARGETS StorageManager smcat smput smls smrm +install(TARGETS StorageManager smcat smput smls smrm testS3Connection RUNTIME DESTINATION ${ENGINE_BINDIR} COMPONENT columnstore-platform ) diff --git a/storage-manager/src/testS3Connection.cpp b/storage-manager/src/testS3Connection.cpp new file mode 100644 index 000000000..aa0071d1b --- /dev/null +++ b/storage-manager/src/testS3Connection.cpp @@ -0,0 +1,68 @@ +/* Copyright (C) 2020 MariaDB Corporation + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; version 2 of + the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#include "S3Storage.h" + +#include +#include +#include + +using namespace storagemanager; +using namespace std; + +void printUsage() { + cout << "MariaDB Columnstore Storage Manager Test Configuration Connectivity.\n" << endl; + cout << "Usage: testS3Connection \n" << endl; + cout << "Returns Success=0 Failure=1\n" << endl; +} +int s3TestConnection() +{ + S3Storage* s3 = NULL; + int ret = 0; + try + { + S3Storage* s3 = new S3Storage(); + cout << "S3 Storage Manager Configuration OK" << endl; + delete s3; + } + catch (exception &e) + { + cout << "S3 Storage Manager Configuration Error:" << endl; + cout << e.what() << endl; + if (s3) + delete s3; + ret = 1; + } + return ret; +} + +int main(int argc, char* argv[]) +{ + int option; + while ((option = getopt(argc, argv, "h")) != EOF ) + { + switch (option) + { + case 'h': + default: + printUsage(); + return 0; + break; + } + } + return s3TestConnection(); +}