summaryrefslogtreecommitdiff
path: root/sys-cluster/ceph/files/ceph-19.2.1-immutableobjectcache.patch
blob: c2c9633c341fd4d7ce45a82ec1b0d89370512d46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
From 87ee31f88d82169a85fade8d91e9469d9d508d5e Mon Sep 17 00:00:00 2001
From: Adam Emerson <aemerson@redhat.com>
Date: Fri, 13 Dec 2024 15:21:49 -0500
Subject: [PATCH] immutable_object_cache: Asio deprecations

Signed-off-by: Adam Emerson <aemerson@redhat.com>
---
 src/tools/immutable_object_cache/CacheClient.cc |  6 +++---
 src/tools/immutable_object_cache/CacheClient.h  |  5 +++--
 src/tools/immutable_object_cache/CacheServer.cc | 10 +++++-----
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/tools/immutable_object_cache/CacheClient.cc b/src/tools/immutable_object_cache/CacheClient.cc
index 44686529547d3..32a199dbe2102 100644
--- a/src/tools/immutable_object_cache/CacheClient.cc
+++ b/src/tools/immutable_object_cache/CacheClient.cc
@@ -20,7 +20,7 @@ namespace ceph {
 namespace immutable_obj_cache {
 
   CacheClient::CacheClient(const std::string& file, CephContext* ceph_ctx)
-    : m_cct(ceph_ctx), m_io_service_work(m_io_service),
+    : m_cct(ceph_ctx), m_io_service_work(m_io_service.get_executor()),
       m_dm_socket(m_io_service), m_ep(stream_protocol::endpoint(file)),
       m_io_thread(nullptr), m_session_work(false), m_writing(false),
       m_reading(false), m_sequence_id(0) {
@@ -30,7 +30,7 @@ namespace immutable_obj_cache {
 
     if (m_worker_thread_num != 0) {
       m_worker = new boost::asio::io_context();
-      m_worker_io_service_work = new boost::asio::io_context::work(*m_worker);
+      m_worker_io_service_work = new boost::asio::executor_work_guard<boost::asio::io_context::executor_type>(m_worker->get_executor());
       for (uint64_t i = 0; i < m_worker_thread_num; i++) {
         std::thread* thd = new std::thread([this](){m_worker->run();});
         m_worker_threads.push_back(thd);
@@ -299,7 +299,7 @@ namespace immutable_obj_cache {
     });
 
     if (m_worker_thread_num != 0) {
-      m_worker->post([process_reply]() {
+      boost::asio::post(*m_worker, [process_reply]() {
         process_reply->complete(true);
       });
     } else {
diff --git a/src/tools/immutable_object_cache/CacheClient.h b/src/tools/immutable_object_cache/CacheClient.h
index 7dc4aa76c1324..5122e0906b91b 100644
--- a/src/tools/immutable_object_cache/CacheClient.h
+++ b/src/tools/immutable_object_cache/CacheClient.h
@@ -5,6 +5,7 @@
 #define CEPH_CACHE_CACHE_CLIENT_H
 
 #include <atomic>
+#include <boost/asio/executor_work_guard.hpp>
 #include <boost/asio/io_context.hpp>
 #include <boost/asio/local/stream_protocol.hpp>
 #include <boost/algorithm/string.hpp>
@@ -58,7 +59,7 @@ class CacheClient {
  private:
   CephContext* m_cct;
   boost::asio::io_context m_io_service;
-  boost::asio::io_context::work m_io_service_work;
+  boost::asio::executor_work_guard<boost::asio::io_context::executor_type> m_io_service_work;
   stream_protocol::socket m_dm_socket;
   stream_protocol::endpoint m_ep;
   std::shared_ptr<std::thread> m_io_thread;
@@ -67,7 +68,7 @@ class CacheClient {
   uint64_t m_worker_thread_num;
   boost::asio::io_context* m_worker;
   std::vector<std::thread*> m_worker_threads;
-  boost::asio::io_context::work* m_worker_io_service_work;
+  boost::asio::executor_work_guard<boost::asio::io_context::executor_type>* m_worker_io_service_work;
 
   std::atomic<bool> m_writing;
   std::atomic<bool> m_reading;
diff --git a/src/tools/immutable_object_cache/CacheServer.cc b/src/tools/immutable_object_cache/CacheServer.cc
index 14deddce561b3..a4c4e3bc36ce1 100644
--- a/src/tools/immutable_object_cache/CacheServer.cc
+++ b/src/tools/immutable_object_cache/CacheServer.cc
@@ -35,10 +35,10 @@ int CacheServer::run() {
     return ret;
   }
 
-  boost::system::error_code ec;
-  ret = m_io_service.run(ec);
-  if (ec) {
-    ldout(cct, 1) << "m_io_service run fails: " << ec.message() << dendl;
+  try {
+    ret = m_io_service.run();
+  } catch (const std::exception& e) {
+    ldout(cct, 1) << "m_io_service run fails: " << e.what() << dendl;
     return -1;
   }
   return 0;
@@ -66,7 +66,7 @@ int CacheServer::start_accept() {
     return -ec.value();
   }
 
-  m_acceptor.listen(boost::asio::socket_base::max_connections, ec);
+  m_acceptor.listen(boost::asio::socket_base::max_listen_connections, ec);
   if (ec) {
     lderr(cct) << "failed to listen on domain socket: " << ec.message()
                << dendl;