1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

add verbose optio in testS3Connection

This commit is contained in:
mariadb-KristinaPavlova
2025-06-12 15:08:56 +03:00
committed by Leonid Fedorov
parent 780e34680f
commit dcdfb9d018
5 changed files with 34 additions and 17 deletions

View File

@ -93,7 +93,7 @@ columnstore_link(unit_tests storagemanager)
columnstore_executable(testS3Connection src/testS3Connection.cpp)
target_compile_definitions(testS3Connection PUBLIC BOOST_NO_CXX11_SCOPED_ENUMS)
columnstore_link(testS3Connection storagemanager)
columnstore_link(testS3Connection storagemanager boost_program_options)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${TMPDIR})

View File

@ -112,7 +112,7 @@ S3Storage::ScopedConnection::~ScopedConnection()
s3->returnConnection(conn);
}
S3Storage::S3Storage(bool skipRetry) : skipRetryableErrors(skipRetry)
S3Storage::S3Storage(bool skipRetry, bool verbose) : skipRetryableErrors(skipRetry), verbose_enabled(verbose)
{
/* Check creds from envvars
Get necessary vars from config
@ -225,7 +225,7 @@ S3Storage::S3Storage(bool skipRetry) : skipRetryableErrors(skipRetry)
}
ms3_library_init();
if (libs3_debug == "enabled")
if (verbose_enabled || libs3_debug == "enabled")
{
ms3_debug(1);
}

View File

@ -32,7 +32,7 @@ namespace storagemanager
class S3Storage : public CloudStorage
{
public:
explicit S3Storage(bool skipRetry = false);
explicit S3Storage(bool skipRetry = false, bool verbose = false);
~S3Storage() override;
@ -57,6 +57,7 @@ class S3Storage : public CloudStorage
void returnConnection(std::shared_ptr<Connection> conn);
bool skipRetryableErrors;
bool verbose_enabled;
std::string bucket; // might store this as a char *, since it's only used that way
std::string prefix;

View File

@ -20,23 +20,26 @@
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <boost/program_options.hpp>
using namespace storagemanager;
using namespace std;
namespace po = boost::program_options;
void printUsage()
void printUsage(const po::options_description& desc)
{
cout << "MariaDB Columnstore Storage Manager Test Configuration Connectivity.\n" << endl;
cout << "Usage: testS3Connection \n" << endl;
cout<< desc <<endl;
cout << "Returns Success=0 Failure=1\n" << endl;
}
int s3TestConnection()
int s3TestConnection(bool verbose)
{
S3Storage* s3 = NULL;
int ret = 0;
try
{
S3Storage* s3 = new S3Storage(true);
S3Storage* s3 = new S3Storage(true, verbose);
cout << "S3 Storage Manager Configuration OK" << endl;
delete s3;
}
@ -53,17 +56,30 @@ int s3TestConnection()
int main(int argc, char* argv[])
{
int option;
while ((option = getopt(argc, argv, "h")) != EOF)
try
{
switch (option)
//define options
po::options_description desc("Options");
desc.add_options ()
("help,h", "Print help message")
("verbose,v", po::value<bool>()->default_value(false), "Enable verbose output");
// Parse command line
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
if(vm.count("help"))
{
case 'h':
default:
printUsage();
return 0;
break;
printUsage (desc);
return 0;
}
// Run the test with verbose flag
return s3TestConnection(vm["verbose"].as<bool>());
}
return s3TestConnection();
catch(const std::exception& e)
{
std::cerr << e.what() << '\n';
}
}