]> TLD Linux GIT Repositories - packages/mysql.git/blob - handlersocket.patch
- updated to 5.6.39-83.1
[packages/mysql.git] / handlersocket.patch
1 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/client/hslongrun.cpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/client/hslongrun.cpp
2 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/client/hslongrun.cpp       2017-05-09 06:31:39.000000000 +0000
3 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/client/hslongrun.cpp       2015-07-28 06:06:23.000000000 +0000
4 @@ -370,6 +370,16 @@ struct hs_longrun_thread_hs : public hs_
5    socket_args sockargs;
6  };
7  
8 +struct lock_guard : noncopyable {
9 +  lock_guard(mutex& mtx) : mtx(mtx) {
10 +    mtx.lock();
11 +  }
12 +  ~lock_guard() {
13 +    mtx.unlock();
14 +  }
15 +  mutex& mtx;
16 +};
17 +
18  string_ref
19  to_string_ref(const std::string& s)
20  {
21 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/COPYING percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/COPYING
22 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/COPYING    1970-01-01 00:00:00.000000000 +0000
23 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/COPYING    2015-07-28 06:06:23.000000000 +0000
24 @@ -0,0 +1,30 @@
25 +-----------------------------------------------------------------------------
26 +HandlerSocket plugin for MySQL
27 +
28 + Copyright (c) 2010 DeNA Co.,Ltd.
29 + All rights reserved.
30 +
31 + Redistribution and use in source and binary forms, with or without
32 + modification, are permitted provided that the following conditions are met:
33 +
34 +     * Redistributions of source code must retain the above copyright
35 +       notice, this list of conditions and the following disclaimer.
36 +     * Redistributions in binary form must reproduce the above copyright
37 +       notice, this list of conditions and the following disclaimer in the
38 +       documentation and/or other materials provided with the distribution.
39 +     * Neither the name of DeNA Co.,Ltd. nor the names of its contributors
40 +       may be used to endorse or promote products derived from this software
41 +       without specific prior written permission.
42 +
43 + THIS SOFTWARE IS PROVIDED BY DeNA Co.,Ltd. "AS IS" AND ANY EXPRESS OR
44 + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
45 + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
46 + EVENT SHALL DeNA Co.,Ltd. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
48 + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
49 + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
50 + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
51 + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
52 + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 +
54 +
55 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/database.cpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/database.cpp
56 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/database.cpp 2017-05-09 06:31:39.000000000 +0000
57 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/database.cpp 2015-07-28 06:06:23.000000000 +0000
58 @@ -132,7 +132,6 @@ struct dbcontext : public dbcontext_i, p
59    virtual ~dbcontext();
60    virtual void init_thread(const void *stack_botton,
61      volatile int& shutdown_flag);
62 -  virtual void wait_for_server_to_start();
63    virtual void term_thread();
64    virtual bool check_alive();
65    virtual void lock_tables_if();
66 @@ -232,6 +231,43 @@ dbcontext::~dbcontext()
67  {
68  }
69  
70 +namespace {
71 +
72 +int
73 +wait_server_to_start(THD *thd, volatile int& shutdown_flag)
74 +{
75 +  int r = 0;
76 +  DBG_SHUT(fprintf(stderr, "HNDSOCK wsts\n"));
77 +  pthread_mutex_lock(&LOCK_server_started);
78 +  while (!mysqld_server_started) {
79 +    timespec abstime = { };
80 +    set_timespec(abstime, 1);
81 +    pthread_cond_timedwait(&COND_server_started, &LOCK_server_started,
82 +      &abstime);
83 +    pthread_mutex_unlock(&LOCK_server_started);
84 +    pthread_mutex_lock(&thd->mysys_var->mutex);
85 +    int killed = thd_killed(thd);
86 +    pthread_mutex_unlock(&thd->mysys_var->mutex);
87 +    DBG_SHUT(fprintf(stderr, "HNDSOCK wsts kst %d\n", killed));
88 +    pthread_mutex_lock(&LOCK_server_started);
89 +    if (killed) {
90 +      DBG_SHUT(fprintf(stderr, "HNDSOCK wsts kst %d break\n", killed));
91 +      r = -1;
92 +      break;
93 +    }
94 +    if (shutdown_flag) {
95 +      DBG_SHUT(fprintf(stderr, "HNDSOCK wsts kst shut break\n"));
96 +      r = -1;
97 +      break;
98 +    }
99 +  }
100 +  pthread_mutex_unlock(&LOCK_server_started);
101 +  DBG_SHUT(fprintf(stderr, "HNDSOCK wsts done\n"));
102 +  return r;
103 +}
104 +
105 +}; // namespace
106 +
107  #define DENA_THR_OFFSETOF(fld) ((char *)(&thd->fld) - (char *)thd)
108  
109  void
110 @@ -240,7 +276,7 @@ dbcontext::init_thread(const void *stack
111    DBG_THR(fprintf(stderr, "HNDSOCK init thread\n"));
112    {
113      my_thread_init();
114 -    thd = new THD(false);
115 +    thd = new THD;
116      thd->thread_stack = (char *)stack_bottom;
117      DBG_THR(fprintf(stderr,
118        "thread_stack = %p sizeof(THD)=%zu sizeof(mtx)=%zu "
119 @@ -255,8 +291,7 @@ dbcontext::init_thread(const void *stack
120        DENA_THR_OFFSETOF(locked_tables_list)));
121      thd->store_globals();
122      thd->system_thread = static_cast<enum_thread_type>(1<<30UL);
123 -    NET v;
124 -    memset(&v, 0, sizeof(v));
125 +    const NET v = { 0 };
126      thd->net = v;
127      if (for_write_flag) {
128        #if MYSQL_VERSION_ID >= 50505
129 @@ -283,6 +318,8 @@ dbcontext::init_thread(const void *stack
130      pthread_mutex_unlock(&LOCK_thread_count);
131    }
132  
133 +  DBG_THR(fprintf(stderr, "HNDSOCK %p init thread wsts\n", thd));
134 +  wait_server_to_start(thd, shutdown_flag);
135    DBG_THR(fprintf(stderr, "HNDSOCK %p init thread done\n", thd));
136  
137    thd_proc_info(thd, &info_message_buf[0]);
138 @@ -294,15 +331,6 @@ dbcontext::init_thread(const void *stack
139    user_lock.reset(new expr_user_lock(thd, user_level_lock_timeout));
140  }
141  
142 -void
143 -dbcontext::wait_for_server_to_start()
144 -{
145 -  mysql_mutex_lock(&LOCK_server_started);
146 -  while (!mysqld_server_started)
147 -    mysql_cond_wait(&COND_server_started, &LOCK_server_started);
148 -  mysql_mutex_unlock(&LOCK_server_started);
149 -}
150 -
151  int
152  dbcontext::set_thread_message(const char *fmt, ...)
153  {
154 @@ -318,25 +346,20 @@ void
155  dbcontext::term_thread()
156  {
157    DBG_THR(fprintf(stderr, "HNDSOCK thread end %p\n", thd));
158 -  unlock_tables_if();
159 +  close_tables_if();
160    my_pthread_setspecific_ptr(THR_THD, 0);
161    {
162      #if MYSQL_VERSION_ID >= 50600
163 -    thd->release_resources();
164 +    remove_global_thread(thd);
165      #endif
166 -    #if MYSQL_VERSION_ID < 50620
167 +
168      pthread_mutex_lock(&LOCK_thread_count);
169 -    #endif
170 -    #if MYSQL_VERSION_ID >= 50600
171 -    remove_global_thread(thd);
172 -    #else
173 +    #if MYSQL_VERSION_ID < 50600
174      --thread_count;
175      #endif
176      delete thd;
177      thd = 0;
178 -    #if MYSQL_VERSION_ID < 50620
179      pthread_mutex_unlock(&LOCK_thread_count);
180 -    #endif
181      my_thread_end();
182    }
183  }
184 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/database.hpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/database.hpp
185 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/database.hpp 2017-05-09 06:31:39.000000000 +0000
186 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/database.hpp 2015-07-28 06:06:23.000000000 +0000
187 @@ -114,7 +114,6 @@ struct dbcontext_i {
188    virtual ~dbcontext_i() { }
189    virtual void init_thread(const void *stack_bottom,
190      volatile int& shutdown_flag) = 0;
191 -  virtual void wait_for_server_to_start() = 0;
192    virtual void term_thread() = 0;
193    virtual bool check_alive() = 0;
194    virtual void lock_tables_if() = 0;
195 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/handlersocket.cpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/handlersocket.cpp
196 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/handlersocket.cpp    2017-05-09 06:31:39.000000000 +0000
197 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/handlersocket.cpp    2015-07-28 06:06:23.000000000 +0000
198 @@ -216,8 +216,7 @@ mysql_declare_plugin(handlersocket)
199    0x0100 /* 1.0 */,
200    daemon_handlersocket_status_variables,
201    daemon_handlersocket_system_variables,
202 -  NULL,
203 -  0,
204 +  0
205  }
206  mysql_declare_plugin_end;
207  
208 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr.cpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr.cpp
209 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr.cpp 2017-05-09 06:31:39.000000000 +0000
210 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr.cpp 2015-07-28 06:06:23.000000000 +0000
211 @@ -54,7 +54,7 @@ namespace {
212  void
213  check_nfile(size_t nfile)
214  {
215 -  struct rlimit rl;
216 +  struct rlimit rl = { };
217    const int r = getrlimit(RLIMIT_NOFILE, &rl);
218    if (r != 0) {
219      fatal_abort("check_nfile: getrlimit failed");
220 @@ -125,15 +125,6 @@ hstcpsvr::start_listen()
221    for (size_t i = 0; i < threads.size(); ++i) {
222      threads[i]->start();
223    }
224 -  {
225 -    lock_guard crit_sec(const_cast<mutex &>(vshared.v_mutex));
226 -    while (vshared.threads_started < cshared.num_threads) {
227 -      pthread_cond_wait(
228 -        const_cast<pthread_cond_t *>(&vshared.threads_started_cond),
229 -        (const_cast<mutex &>(vshared.v_mutex)).get());
230 -    }
231 -  }
232 -
233    DENA_VERBOSE(20, fprintf(stderr, "threads started\n"));
234    return std::string();
235  }
236 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr.hpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr.hpp
237 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr.hpp 2017-05-09 06:31:39.000000000 +0000
238 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr.hpp 2015-07-28 06:06:23.000000000 +0000
239 @@ -38,19 +38,9 @@ struct hstcpsvr_shared_c {
240      thread_num_conns(0) { }
241  };
242  
243 -struct hstcpsvr_shared_v : private noncopyable {
244 +struct hstcpsvr_shared_v : public mutex {
245    int shutdown;
246 -  long threads_started;
247 -  pthread_cond_t threads_started_cond;
248 -  mutex v_mutex;
249 -  hstcpsvr_shared_v() : shutdown(0), threads_started(0)
250 -  {
251 -    pthread_cond_init(&threads_started_cond, NULL);
252 -  }
253 -  ~hstcpsvr_shared_v()
254 -  {
255 -    pthread_cond_destroy(&threads_started_cond);
256 -  }
257 +  hstcpsvr_shared_v() : shutdown(0) { }
258  };
259  
260  struct hstcpsvr_i;
261 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr_worker.cpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr_worker.cpp
262 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr_worker.cpp  2017-05-09 06:31:39.000000000 +0000
263 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/hstcpsvr_worker.cpp  2015-07-28 06:06:23.000000000 +0000
264 @@ -293,7 +293,9 @@ hstcpsvr_worker::hstcpsvr_worker(const h
265      if (epoll_fd.get() < 0) {
266        fatal_abort("epoll_create");
267      }
268 -    epoll_event ev = { EPOLLIN, { 0 } };
269 +    epoll_event ev = { };
270 +    ev.events = EPOLLIN;
271 +    ev.data.ptr = 0;
272      if (epoll_ctl(epoll_fd.get(), EPOLL_CTL_ADD, cshared.listen_fd.get(), &ev)
273        != 0) {
274        fatal_abort("epoll_ctl EPOLL_CTL_ADD");
275 @@ -323,19 +325,7 @@ hstcpsvr_worker::run()
276  {
277    thr_init initobj(dbctx, vshared.shutdown);
278  
279 -  {
280 -    lock_guard crit_sec(const_cast<mutex &>(vshared.v_mutex));
281 -    ++vshared.threads_started;
282 -    if (vshared.threads_started == cshared.num_threads)
283 -    {
284 -      pthread_cond_signal(
285 -        const_cast<pthread_cond_t *>(&vshared.threads_started_cond));
286 -    }
287 -  }
288 -
289 -  dbctx->wait_for_server_to_start();
290 -
291 -#ifdef __linux__
292 +  #ifdef __linux__
293    if (cshared.sockargs.use_epoll) {
294      while (!vshared.shutdown && dbctx->check_alive()) {
295        run_one_ep();
296 @@ -515,7 +505,7 @@ hstcpsvr_worker::run_one_ep()
297         if (fcntl(c->fd.get(), F_SETFL, O_NONBLOCK) != 0) {
298           fatal_abort("F_SETFL O_NONBLOCK");
299         }
300 -       epoll_event cev;
301 +       epoll_event cev = { };
302         cev.events = EPOLLIN | EPOLLOUT | EPOLLET;
303         cev.data.ptr = c.get();
304         c->nb_last_io = now;
305 @@ -640,7 +630,9 @@ hstcpsvr_worker::run_one_ep()
306        total_num_conns * 2 > num_conns * cshared.num_threads) {
307        e_acc = true;
308      }
309 -    epoll_event ev = { EPOLLIN, { 0 } };
310 +    epoll_event ev = { };
311 +    ev.events = EPOLLIN;
312 +    ev.data.ptr = 0;
313      if (e_acc == accept_enabled) {
314      } else if (e_acc) {
315        if (epoll_ctl(epoll_fd.get(), EPOLL_CTL_ADD, cshared.listen_fd.get(), &ev)
316 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/Makefile.plain.template percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/Makefile.plain.template
317 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/Makefile.plain.template      2017-05-09 06:31:39.000000000 +0000
318 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/Makefile.plain.template      2015-07-28 06:06:23.000000000 +0000
319 @@ -4,7 +4,7 @@ MYSQL_LIB = HANDLERSOCKET_MYSQL_LIB
320  
321  CXX = g++ -Wall -g -fno-rtti -fno-exceptions -fPIC -DPIC
322  LIBS = $(MYSQL_LIB) -lhsclient -lpthread -lz
323 -CXXFLAGS = -I/usr/include/handlersocket $(MYSQL_INC)
324 +CXXFLAGS = -I../libhsclient $(MYSQL_INC)
325  LDFLAGS =
326  
327  CXXFLAGS += -O3 -DNDEBUG
328 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/mysql_incl.hpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/mysql_incl.hpp
329 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/mysql_incl.hpp       2017-05-09 06:31:39.000000000 +0000
330 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/handlersocket/mysql_incl.hpp       2015-07-28 06:06:23.000000000 +0000
331 @@ -13,10 +13,7 @@
332  #define HAVE_CONFIG_H
333  #endif
334  
335 -#ifndef MYSQL_DYNAMIC_PLUGIN
336  #define MYSQL_DYNAMIC_PLUGIN
337 -#endif
338 -
339  #define MYSQL_SERVER 1
340  
341  #include <my_config.h>
342 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_addrinfo.hpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_addrinfo.hpp
343 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_addrinfo.hpp      2017-05-09 06:31:39.000000000 +0000
344 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_addrinfo.hpp      2015-07-28 06:06:23.000000000 +0000
345 @@ -9,7 +9,6 @@
346  #ifndef DENA_AUTO_ADDRINFO_HPP
347  #define DENA_AUTO_ADDRINFO_HPP
348  
349 -#include <cstring>
350  #include <sys/types.h>
351  #include <sys/socket.h>
352  #include <netdb.h>
353 @@ -33,8 +32,7 @@ struct auto_addrinfo : private noncopyab
354    int resolve(const char *node, const char *service, int flags = 0,
355      int family = AF_UNSPEC, int socktype = SOCK_STREAM, int protocol = 0) {
356      reset();
357 -    addrinfo hints;
358 -    memset(&hints, 0, sizeof(hints));
359 +    addrinfo hints = { };
360      hints.ai_flags = flags;
361      hints.ai_family = family;
362      hints.ai_socktype = socktype;
363 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_ptrcontainer.hpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_ptrcontainer.hpp
364 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_ptrcontainer.hpp  2017-05-09 06:31:39.000000000 +0000
365 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/auto_ptrcontainer.hpp  2015-07-28 06:06:23.000000000 +0000
366 @@ -12,7 +12,7 @@
367  namespace dena {
368  
369  template <typename Tcnt>
370 -struct auto_ptrcontainer : private noncopyable {
371 +struct auto_ptrcontainer {
372    typedef Tcnt container_type;
373    typedef typename container_type::value_type value_type;
374    typedef typename container_type::pointer pointer;
375 @@ -42,7 +42,9 @@ struct auto_ptrcontainer : private nonco
376    const_reference back() const { cnt.back(); }
377    void swap(auto_ptrcontainer& x) { cnt.swap(x.cnt); }
378    ~auto_ptrcontainer() {
379 -    clear();
380 +    for (iterator i = begin(); i != end(); ++i) {
381 +      delete *i;
382 +    }
383    }
384    template <typename Tap> void push_back_ptr(Tap& ap) {
385      cnt.push_back(ap.get());
386 @@ -54,12 +56,7 @@ struct auto_ptrcontainer : private nonco
387    }
388    reference operator [](size_type n) { return cnt[n]; }
389    const_reference operator [](size_type n) const { return cnt[n]; }
390 -  void clear() {
391 -    for (iterator i = begin(); i != end(); i++) {
392 -      delete *i;
393 -    }
394 -    cnt.clear();
395 -  }
396 +  void clear() { cnt.clear(); }
397   private:
398    Tcnt cnt;
399  };
400 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/mutex.hpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/mutex.hpp
401 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/mutex.hpp      2017-05-09 06:31:39.000000000 +0000
402 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/mutex.hpp      2015-07-28 06:06:23.000000000 +0000
403 @@ -41,23 +41,10 @@ struct mutex : private noncopyable {
404        fatal_abort("pthread_mutex_unlock");
405      }
406    }
407 -  pthread_mutex_t* get() const {
408 -    return &mtx;
409 -  }
410   private:
411    mutable pthread_mutex_t mtx;
412  };
413  
414 -struct lock_guard : noncopyable {
415 -  lock_guard(mutex& mtx) : mtx(mtx) {
416 -    mtx.lock();
417 -  }
418 -  ~lock_guard() {
419 -    mtx.unlock();
420 -  }
421 -  mutex& mtx;
422 -};
423 -
424  };
425  
426  #endif
427 diff -urNp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/socket.cpp percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/socket.cpp
428 --- percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/socket.cpp     2017-05-09 06:31:39.000000000 +0000
429 +++ percona-server-5.6.36-82.0/plugin/HandlerSocket-Plugin-for-MySQL/libhsclient/socket.cpp     2015-07-28 06:06:23.000000000 +0000
430 @@ -80,9 +80,9 @@ int
431  socket_set_options(auto_file& fd, const socket_args& args, std::string& err_r)
432  {
433    if (args.timeout != 0 && !args.nonblocking) {
434 -    struct timeval tv;
435 -    memset(&tv, 0, sizeof(tv));
436 +    struct timeval tv = { };
437      tv.tv_sec = args.timeout;
438 +    tv.tv_usec = 0;
439      if (setsockopt(fd.get(), SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) != 0) {
440        return errno_string("setsockopt SO_RCVTIMEO", errno, err_r);
441      }