1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-18 21:44:02 +03:00
Alexey Antipovsky c22409760f
feat(SM): MCOL-5785 Add timeout options for S3Storage (#3265)
* Update libmarias3

fix build with the recent libmarias3

* feat(SM): MCOL-5785 Add timeout options for S3Storage

    In some unfortunate situations StorageManager may get stuck on
    network operations. This commit adds the ability to set network
    timeouts which will help to ensure that the system is more
    responsive.

* feat(SM): MCOL-5785 Add smps & smkill tools

    * `smps` shows all active S3 network operations
    * `smkill` terminates S3 network operations

    NB! At the moment smkill is able to terminate operations
    that are stuck on retries, but not hang inside the libcurl
    call. In other words if you want to terminate all operations
    you should configure `connect_timeout` & `timeout`
---------

Co-authored-by: Leonid Fedorov <leonid.fedorov@mariadb.com>
2024-08-21 18:38:49 +03:00

85 lines
2.6 KiB
C++

/* Copyright (C) 2019 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. */
#pragma once
#include <sys/stat.h>
#include <string>
#include "SocketPool.h"
#include "bytestream.h"
#include "bytestreampool.h"
namespace storagemanager
{
struct list_iotask_resp_entry;
}
namespace idbdatafile
{
class SMComm : public boost::noncopyable
{
public:
// This is a singleton. Get it with get()
static SMComm* get();
/* Open currently returns a stat struct so SMDataFile can set its initial position, otherwise
behaves how you'd think. */
int open(const std::string& filename, const int mode, struct stat* statbuf);
ssize_t pread(const std::string& filename, void* buf, const size_t count, const off_t offset);
ssize_t pwrite(const std::string& filename, const void* buf, const size_t count, const off_t offset);
/* append exists for cases where the file is open in append mode. A normal write won't work
because the file position/size may be out of date if there are multiple writers. */
ssize_t append(const std::string& filename, const void* buf, const size_t count);
int unlink(const std::string& filename);
int stat(const std::string& filename, struct stat* statbuf);
// added this one because it should be trivial to implement in SM, and prevents a large
// operation in SMDataFile.
int truncate(const std::string& filename, const off64_t length);
int listDirectory(const std::string& path, std::list<std::string>* entries);
// health indicator. 0 = processes are talking to each other and SM has read/write access to
// the specified S3 bucket. Need to define specific error codes.
int ping();
int sync();
int copyFile(const std::string& file1, const std::string& file2);
int listIOTasks(std::vector<storagemanager::list_iotask_resp_entry>* entries);
int killIOTask(uint64_t id);
virtual ~SMComm();
private:
SMComm();
std::string getAbsFilename(const std::string& filename);
SocketPool sockets;
messageqcpp::ByteStreamPool buffers;
std::string cwd;
};
} // namespace idbdatafile