MySQL 9.4.0
Source Code Documentation
mysql_fixed_pool_manager.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2025, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ROUTER_SRC_REST_MRS_SRC_FIXED_CONNECTION_POOL_MANAGER_H_
27#define ROUTER_SRC_REST_MRS_SRC_FIXED_CONNECTION_POOL_MANAGER_H_
28
29#include <cassert>
30
34#include "mrs/configuration.h"
35
36#include "secure_string.h" // NOLINT(build/include_subdir)
37
38namespace collector {
39
41 public:
46 using Callbacks = MySqlFixedCacheManagerImpl::Callbacks;
48
50 public:
51 bool object_before_cache(Object, bool dirty) override;
53 void object_remove(Object) override;
54 Object object_allocate(bool wait) override;
55 };
56
57 public:
58 explicit MysqlFixedPoolManager(uint32_t passthrough_pool_size)
59 : num_instances_{passthrough_pool_size},
60 callbacks_{},
62
63 virtual ~MysqlFixedPoolManager() = default;
64
66 return cache_manager_.get_instance(false);
67 }
68
69 void init(DestinationProvider *destination, const std::string &user,
71
72 virtual void return_instance(CachedObject &object) {
73 if (object.parent_) object.parent_->return_instance(object);
74 }
75
76 private:
80};
81
82class db_pool_exhausted : public std::exception {};
83
84} // namespace collector
85
86#endif // ROUTER_SRC_REST_MRS_SRC_FIXED_CONNECTION_POOL_MANAGER_H_
Definition: cache_manager.h:41
Definition: cache_manager.h:114
CacheManager::Object Object
Definition: cache_manager.h:116
CachedObject get_instance(bool wait)
Definition: cache_manager.h:136
CountedMySQLSession * Object
Definition: cache_manager.h:38
Definition: counted_mysql_session.h:38
Definition: destination_provider.h:37
Definition: mysql_fixed_pool_manager.h:49
Object object_allocate(bool wait) override
Definition: mysql_fixed_pool_manager.cc:43
bool object_retrived_from_cache(Object) override
Definition: mysql_fixed_pool_manager.cc:60
bool object_before_cache(Object, bool dirty) override
Definition: mysql_fixed_pool_manager.cc:52
void object_remove(Object) override
Definition: mysql_fixed_pool_manager.cc:47
Definition: mysql_fixed_pool_manager.h:40
MysqlCacheCallbacks callbacks_
Definition: mysql_fixed_pool_manager.h:78
MysqlFixedPoolManager(uint32_t passthrough_pool_size)
Definition: mysql_fixed_pool_manager.h:58
void init(DestinationProvider *destination, const std::string &user, const mysql_harness::SecureString &password)
Definition: mysql_fixed_pool_manager.cc:109
virtual void return_instance(CachedObject &object)
Definition: mysql_fixed_pool_manager.h:72
MySqlFixedCacheManagerImpl cache_manager_
Definition: mysql_fixed_pool_manager.h:79
virtual ~MysqlFixedPoolManager()=default
virtual CachedObject get_instance()
Definition: mysql_fixed_pool_manager.h:65
uint32_t num_instances_
Definition: mysql_fixed_pool_manager.h:77
Definition: mysql_fixed_pool_manager.h:82
Null-terminated string which is securely wiped on destruction.
Definition: secure_string.h:59
static char * password
Definition: mysql_secure_installation.cc:58
Definition: cache_manager.h:33
collector::CountedMySQLSession::ConnectionParameters ConnectionParameters
Definition: query_retry_on_ro.cc:38
collector::MysqlCacheManager::CachedObject CachedObject
Definition: handler_db_object_function.cc:55
static int wait(mysql_cond_t *that, mysql_mutex_t *mutex_arg, const char *, unsigned int)
Definition: mysql_cond_v1_native.cc:62
Definition: counted_mysql_session.h:41