Merge lp:~schuster/mysql-proxy/negative-clock into lp:mysql-proxy

Proposed by Michael Schuster
Status: Merged
Merge reported by: Jan Kneschke
Merged at revision: not available
Proposed branch: lp:~schuster/mysql-proxy/negative-clock
Merge into: lp:mysql-proxy
Diff against target: 515 lines (+221/-24) (has conflicts)
10 files modified
plugins/proxy/proxy-plugin.c (+6/-5)
src/CMakeLists.txt (+50/-5)
src/Makefile.am (+33/-5)
src/chassis-gtimeval.c (+43/-0)
src/chassis-gtimeval.h (+34/-0)
src/chassis-timings.c (+2/-1)
src/glib-ext.c (+15/-1)
src/glib-ext.h (+2/-1)
src/network-backend.c (+14/-5)
tests/unit/Makefile.am (+22/-1)
Text conflict in src/CMakeLists.txt
To merge this branch: bzr merge lp:~schuster/mysql-proxy/negative-clock
Reviewer Review Type Date Requested Status
Jan Kneschke (community) Approve
Review via email: mp+20125@code.launchpad.net
To post a comment you must log in.
974. By Michael Schuster

fix copyright (year)

Revision history for this message
Jan Kneschke (jan-kneschke) :
review: Approve
Revision history for this message
Jan Kneschke (jan-kneschke) wrote :

rebased, fixed the conflicts against the current trunk and pushed over

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/proxy/proxy-plugin.c'
--- plugins/proxy/proxy-plugin.c 2010-02-08 11:23:10 +0000
+++ plugins/proxy/proxy-plugin.c 2010-02-26 08:20:31 +0000
@@ -1,5 +1,5 @@
1/* $%BEGINLICENSE%$1/* $%BEGINLICENSE%$
2 Copyright (C) 2007-2008 MySQL AB, 2008 Sun Microsystems, Inc2 Copyright (C) 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc
33
4 This program is free software; you can redistribute it and/or modify4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by5 it under the terms of the GNU General Public License as published by
@@ -145,6 +145,7 @@
145#include "lua-load-factory.h"145#include "lua-load-factory.h"
146146
147#include "chassis-timings.h"147#include "chassis-timings.h"
148#include "chassis-gtimeval.h"
148149
149#define C(x) x, sizeof(x) - 1150#define C(x) x, sizeof(x) - 1
150#define S(x) x->str, x->len151#define S(x) x->str, x->len
@@ -1469,7 +1470,7 @@
14691470
1470 /* mark the backend as being DOWN and retry with a different one */1471 /* mark the backend as being DOWN and retry with a different one */
1471 st->backend->state = BACKEND_STATE_DOWN;1472 st->backend->state = BACKEND_STATE_DOWN;
1472 g_get_current_time(&(st->backend->state_since));1473 (void) chassis_gtime_testset_now(&st->backend->state_since);
1473 network_socket_free(con->server);1474 network_socket_free(con->server);
1474 con->server = NULL;1475 con->server = NULL;
14751476
@@ -1481,7 +1482,7 @@
14811482
1482 if (st->backend->state != BACKEND_STATE_UP) {1483 if (st->backend->state != BACKEND_STATE_UP) {
1483 st->backend->state = BACKEND_STATE_UP;1484 st->backend->state = BACKEND_STATE_UP;
1484 g_get_current_time(&(st->backend->state_since));1485 (void) chassis_gtime_testset_now(&st->backend->state_since);
1485 }1486 }
14861487
1487 con->state = CON_STATE_READ_HANDSHAKE;1488 con->state = CON_STATE_READ_HANDSHAKE;
@@ -1599,7 +1600,7 @@
1599 __FILE__, __LINE__, con->server->dst->name->str);1600 __FILE__, __LINE__, con->server->dst->name->str);
16001601
1601 st->backend->state = BACKEND_STATE_DOWN;1602 st->backend->state = BACKEND_STATE_DOWN;
1602 g_get_current_time(&(st->backend->state_since));1603 (void) chassis_gtime_testset_now(&st->backend->state_since);
16031604
1604 network_socket_free(con->server);1605 network_socket_free(con->server);
1605 con->server = NULL;1606 con->server = NULL;
@@ -1609,7 +1610,7 @@
16091610
1610 if (st->backend->state != BACKEND_STATE_UP) {1611 if (st->backend->state != BACKEND_STATE_UP) {
1611 st->backend->state = BACKEND_STATE_UP;1612 st->backend->state = BACKEND_STATE_UP;
1612 g_get_current_time(&(st->backend->state_since));1613 (void) chassis_gtime_testset_now(&st->backend->state_since);
1613 }1614 }
16141615
1615 con->state = CON_STATE_READ_HANDSHAKE;1616 con->state = CON_STATE_READ_HANDSHAKE;
16161617
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2010-02-25 12:39:54 +0000
+++ src/CMakeLists.txt 2010-02-26 08:20:32 +0000
@@ -1,3 +1,20 @@
1# $%BEGINLICENSE%$
2# Copyright (C) 2009-2010 Sun Microsystems, Inc
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 as published by
6# the Free Software Foundation; version 2 of the License.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16#
17# $%ENDLICENSE%$
1INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # for config.h18INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # for config.h
2INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})19INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
320
@@ -17,12 +34,10 @@
17ADD_DEFINITIONS(-DSHARED_LIBRARY_SUFFIX="${SHARED_LIBRARY_SUFFIX}")34ADD_DEFINITIONS(-DSHARED_LIBRARY_SUFFIX="${SHARED_LIBRARY_SUFFIX}")
1835
19SET(chassis_sources 36SET(chassis_sources
20 glib-ext.c
21 glib-ext-ref.c
22 lua-load-factory.c37 lua-load-factory.c
23 lua-scope.c38 lua-scope.c
24 chassis-plugin.c39 chassis-plugin.c
25 chassis-event-thread.c40 chassis-event-thread.c
26 chassis-log.c41 chassis-log.c
27 chassis-mainloop.c42 chassis-mainloop.c
28 chassis-shutdown-hooks.c43 chassis-shutdown-hooks.c
@@ -31,13 +46,25 @@
31 chassis-filemode.c46 chassis-filemode.c
32 chassis-limits.c47 chassis-limits.c
33 chassis-stats.c48 chassis-stats.c
49<<<<<<< TREE
34)50)
3551
36SET(chassis_timing_sources52SET(chassis_timing_sources
53=======
54)
55
56SET(timing_sources
57>>>>>>> MERGE-SOURCE
37 chassis-timings.c58 chassis-timings.c
59 chassis-gtimeval.c
38 my_rdtsc.c60 my_rdtsc.c
39)61)
4062
63SET(glibext_sources
64 glib-ext.c
65 glib-ext-ref.c
66)
67
41SET(proxy_sources 68SET(proxy_sources
42 network-mysqld.c 69 network-mysqld.c
43 network-mysqld-lua.c 70 network-mysqld-lua.c
@@ -62,6 +89,8 @@
62ADD_LIBRARY(mysql-chassis SHARED ${chassis_sources})89ADD_LIBRARY(mysql-chassis SHARED ${chassis_sources})
63ADD_LIBRARY(mysql-chassis-timing SHARED ${chassis_timing_sources})90ADD_LIBRARY(mysql-chassis-timing SHARED ${chassis_timing_sources})
64ADD_LIBRARY(mysql-chassis-proxy SHARED ${proxy_sources})91ADD_LIBRARY(mysql-chassis-proxy SHARED ${proxy_sources})
92ADD_LIBRARY(mysql-chassis-glibext SHARED ${glibext_sources})
93ADD_LIBRARY(mysql-chassis-timing SHARED ${timing_sources})
65ADD_EXECUTABLE(mysql-proxy chassis.c)94ADD_EXECUTABLE(mysql-proxy chassis.c)
6695
67## for windows we need the winsock lib96## for windows we need the winsock lib
@@ -84,11 +113,17 @@
84 ${LUA_LIBRARIES}113 ${LUA_LIBRARIES}
85 ${EVENT_LIBRARIES}114 ${EVENT_LIBRARIES}
86 ${WINSOCK_LIBRARIES}115 ${WINSOCK_LIBRARIES}
116<<<<<<< TREE
87 mysql-chassis-timing117 mysql-chassis-timing
118=======
119 mysql-chassis-glibext
120>>>>>>> MERGE-SOURCE
88)121)
89122
90TARGET_LINK_LIBRARIES(mysql-chassis-proxy123TARGET_LINK_LIBRARIES(mysql-chassis-proxy
91 mysql-chassis124 mysql-chassis
125 mysql-chassis-glibext
126 mysql-chassis-timing
92)127)
93128
94TARGET_LINK_LIBRARIES(mysql-proxy 129TARGET_LINK_LIBRARIES(mysql-proxy
@@ -99,6 +134,8 @@
99 ${EVENT_LIBRARIES}134 ${EVENT_LIBRARIES}
100 mysql-chassis135 mysql-chassis
101 mysql-chassis-proxy136 mysql-chassis-proxy
137 mysql-chassis-glibext
138 mysql-chassis-timing
102)139)
103140
104IF(WIN32)141IF(WIN32)
@@ -111,6 +148,8 @@
111 ${EVENT_LIBRARIES}148 ${EVENT_LIBRARIES}
112 mysql-chassis149 mysql-chassis
113 mysql-chassis-proxy150 mysql-chassis-proxy
151 mysql-chassis-glibext
152 mysql-chassis-timing
114 )153 )
115 SET_TARGET_PROPERTIES(mysql-proxy-svc154 SET_TARGET_PROPERTIES(mysql-proxy-svc
116 PROPERTIES155 PROPERTIES
@@ -158,7 +197,12 @@
158197
159CHASSIS_INSTALL_TARGET(mysql-chassis)198CHASSIS_INSTALL_TARGET(mysql-chassis)
160CHASSIS_INSTALL_TARGET(mysql-chassis-proxy)199CHASSIS_INSTALL_TARGET(mysql-chassis-proxy)
161CHASSIS_INSTALL_TARGET(mysql-chassis-timing)200<<<<<<< TREE
201CHASSIS_INSTALL_TARGET(mysql-chassis-timing)
202=======
203CHASSIS_INSTALL_TARGET(mysql-chassis-glibext)
204CHASSIS_INSTALL_TARGET(mysql-chassis-timing)
205>>>>>>> MERGE-SOURCE
162206
163INSTALL(FILES207INSTALL(FILES
164 network-mysqld.h208 network-mysqld.h
@@ -200,6 +244,7 @@
200 lua-registry-keys.h244 lua-registry-keys.h
201 chassis-stats.h245 chassis-stats.h
202 chassis-timings.h246 chassis-timings.h
247 chassis-gtimeval.h
203 my_rdtsc.h248 my_rdtsc.h
204 DESTINATION include/249 DESTINATION include/
205 )250 )
206251
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2010-02-19 15:23:10 +0000
+++ src/Makefile.am 2010-02-26 08:20:32 +0000
@@ -1,3 +1,20 @@
1# $%BEGINLICENSE%$
2# Copyright (C) 2009-2010 Sun Microsystems, Inc
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 as published by
6# the Free Software Foundation; version 2 of the License.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16#
17# $%ENDLICENSE%$
1luaextdir = ${pkglibdir}/lua18luaextdir = ${pkglibdir}/lua
2plugindir = ${pkglibdir}/plugins19plugindir = ${pkglibdir}/plugins
320
@@ -32,13 +49,26 @@
3249
33lib_LTLIBRARIES = 50lib_LTLIBRARIES =
3451
52# functionality extending what's currently in glib
53lib_LTLIBRARIES += libmysql-chassis-glibext.la
54libmysql_chassis_glibext_la_SOURCES = \
55 glib-ext.c \
56 glib-ext-ref.c
57
58libmysql_chassis_glibext_la_LDFLAGS = -export-dynamic -no-undefined -dynamic
59libmysql_chassis_glibext_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(GMODULE_CFLAGS)
60libmysql_chassis_glibext_la_LIBADD = $(GLIB_LIBS)
61
62# library implementing timing functionality
35lib_LTLIBRARIES += libmysql-chassis-timing.la63lib_LTLIBRARIES += libmysql-chassis-timing.la
36libmysql_chassis_timing_la_SOURCES = \64libmysql_chassis_timing_la_SOURCES = \
37 chassis-timings.c \65 chassis-timings.c \
66 chassis-gtimeval.c \
38 my_rdtsc.c67 my_rdtsc.c
68
39libmysql_chassis_timing_la_LDFLAGS = -export-dynamic -no-undefined -dynamic69libmysql_chassis_timing_la_LDFLAGS = -export-dynamic -no-undefined -dynamic
40libmysql_chassis_timing_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS)70libmysql_chassis_timing_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS)
41libmysql_chassis_timing_la_LIBADD = $(GLIB_LIBS)71libmysql_chassis_timing_la_LIBADD = $(GLIB_LIBS) libmysql-chassis-glibext.la
42if USE_SUNCC_ASSEMBLY72if USE_SUNCC_ASSEMBLY
43libmysql_chassis_timing_la_CPPFLAGS += \73libmysql_chassis_timing_la_CPPFLAGS += \
44 $(top_srcdir)/src/my_timer_cycles.il74 $(top_srcdir)/src/my_timer_cycles.il
@@ -48,8 +78,6 @@
48## the core library78## the core library
49lib_LTLIBRARIES += libmysql-chassis.la79lib_LTLIBRARIES += libmysql-chassis.la
50libmysql_chassis_la_SOURCES = \80libmysql_chassis_la_SOURCES = \
51 glib-ext.c \
52 glib-ext-ref.c \
53 lua-load-factory.c \81 lua-load-factory.c \
54 lua-scope.c \82 lua-scope.c \
55 chassis-plugin.c \83 chassis-plugin.c \
@@ -66,7 +94,7 @@
6694
67libmysql_chassis_la_LDFLAGS = -export-dynamic -no-undefined -dynamic95libmysql_chassis_la_LDFLAGS = -export-dynamic -no-undefined -dynamic
68libmysql_chassis_la_CPPFLAGS = $(MYSQL_CFLAGS) $(EVENT_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) $(GTHREAD_CFLAGS)96libmysql_chassis_la_CPPFLAGS = $(MYSQL_CFLAGS) $(EVENT_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) $(GTHREAD_CFLAGS)
69libmysql_chassis_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(LUA_LIBS) $(GMODULE_LIBS) $(GTHREAD_LIBS) libmysql-chassis-timing.la97libmysql_chassis_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(LUA_LIBS) $(GMODULE_LIBS) $(GTHREAD_LIBS) libmysql-chassis-timing.la libmysql-chassis-glibext.la
7098
71lib_LTLIBRARIES += libmysql-proxy.la99lib_LTLIBRARIES += libmysql-proxy.la
72libmysql_proxy_la_SOURCES = \100libmysql_proxy_la_SOURCES = \
@@ -91,7 +119,7 @@
91119
92libmysql_proxy_la_LDFLAGS = -export-dynamic -no-undefined -dynamic120libmysql_proxy_la_LDFLAGS = -export-dynamic -no-undefined -dynamic
93libmysql_proxy_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS)121libmysql_proxy_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS)
94libmysql_proxy_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) libmysql-chassis.la libmysql-chassis-timing.la122libmysql_proxy_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) libmysql-chassis.la libmysql-chassis-timing.la libmysql-chassis-glibext.la
95123
96124
97include_HEADERS=\125include_HEADERS=\
98126
=== added file 'src/chassis-gtimeval.c'
--- src/chassis-gtimeval.c 1970-01-01 00:00:00 +0000
+++ src/chassis-gtimeval.c 2010-02-26 08:20:32 +0000
@@ -0,0 +1,43 @@
1/* $%BEGINLICENSE%$
2 Copyright (C) 2010 Sun Microsystems, Inc
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 as published by
6 the Free Software Foundation; version 2 of the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17 $%ENDLICENSE%$ */
18
19#include <glib.h>
20
21#include "chassis-gtimeval.h"
22
23gint64 chassis_gtime_testset_now(GTimeVal *gt)
24{
25 GTimeVal now;
26 gint64 tdiff;
27
28 if (gt == NULL)
29 return (0);
30
31 g_get_current_time(&now);
32 tdiff = ge_gtimeval_diff(gt, &now);
33
34 if (tdiff < 0) {
35 g_critical("%s: time went backwards (%"G_GINT64_FORMAT" usec)!",
36 G_STRLOC, tdiff);
37 gt->tv_usec = gt->tv_sec = 0;
38 return tdiff;
39 }
40
41 *gt = now;
42 return tdiff;
43}
044
=== added file 'src/chassis-gtimeval.h'
--- src/chassis-gtimeval.h 1970-01-01 00:00:00 +0000
+++ src/chassis-gtimeval.h 2010-02-26 08:20:32 +0000
@@ -0,0 +1,34 @@
1/* $%BEGINLICENSE%$
2 Copyright (C) 2010 Sun Microsystems, Inc
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 as published by
6 the Free Software Foundation; version 2 of the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17 $%ENDLICENSE%$ */
18
19#ifndef __CHASSIS_GTIMEVAL_H__
20#define __CHASSIS_GTIMEVAL_H__
21
22#include <glib.h>
23#include "glib-ext.h"
24
25/**
26 * stores the current time in the location passed as argument
27 * if time is seen to move backwards, output an error message and
28 * set the time to "0".
29 * @param pointer to a GTimeVal struct
30 * @return difference in usec between provided timestamp and "now"
31 */
32
33CHASSIS_API gint64 chassis_gtime_testset_now(GTimeVal *gt);
34#endif
035
=== modified file 'src/chassis-timings.c'
--- src/chassis-timings.c 2010-01-20 08:59:12 +0000
+++ src/chassis-timings.c 2010-02-26 08:20:32 +0000
@@ -1,5 +1,5 @@
1/* $%BEGINLICENSE%$1/* $%BEGINLICENSE%$
2 Copyright (C) 2009 Sun Microsystems, Inc2 Copyright (C) 2009-2010 Sun Microsystems, Inc
33
4 This program is free software; you can redistribute it and/or modify4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by5 it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
19#include <glib.h>19#include <glib.h>
2020
21#include "chassis-timings.h"21#include "chassis-timings.h"
22#include "glib-ext.h"
2223
23#define MICROS_IN_SEC 100000024#define MICROS_IN_SEC 1000000
2425
2526
=== modified file 'src/glib-ext.c'
--- src/glib-ext.c 2009-11-11 16:58:44 +0000
+++ src/glib-ext.c 2010-02-26 08:20:32 +0000
@@ -1,5 +1,5 @@
1/* $%BEGINLICENSE%$1/* $%BEGINLICENSE%$
2 Copyright (C) 2007-2008 MySQL AB, 2008 Sun Microsystems, Inc2 Copyright (C) 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc
33
4 This program is free software; you can redistribute it and/or modify4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by5 it under the terms of the GNU General Public License as published by
@@ -142,6 +142,20 @@
142 return g_string_get_time(s, &gt);142 return g_string_get_time(s, &gt);
143}143}
144144
145/**
146 * calculate the difference between two GTimeVal values, in usec
147 * positive return means *told is indeed "earlier" than *tnew, negative
148 * return means the reverse
149 * Caller is responsible for passing valid pointers
150 */
151gint64 ge_gtimeval_diff(GTimeVal *told, GTimeVal *tnew) {
152 gint64 diff;
153
154 diff = (gint64) tnew->tv_sec - told->tv_sec;
155 diff *= G_USEC_PER_SEC;
156 diff += (gint64) tnew->tv_usec - told->tv_usec;
157 return diff;
158}
145159
146GString * g_string_assign_len(GString *s, const char *str, gsize str_len) {160GString * g_string_assign_len(GString *s, const char *str, gsize str_len) {
147 g_string_truncate(s, 0);161 g_string_truncate(s, 0);
148162
=== modified file 'src/glib-ext.h'
--- src/glib-ext.h 2009-11-11 16:58:44 +0000
+++ src/glib-ext.h 2010-02-26 08:20:32 +0000
@@ -1,5 +1,5 @@
1/* $%BEGINLICENSE%$1/* $%BEGINLICENSE%$
2 Copyright (C) 2007-2008 MySQL AB, 2008 Sun Microsystems, Inc2 Copyright (C) 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc
33
4 This program is free software; you can redistribute it and/or modify4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by5 it under the terms of the GNU General Public License as published by
@@ -41,6 +41,7 @@
4141
42CHASSIS_API int g_string_get_time(GString *s, GTimeVal *gt);42CHASSIS_API int g_string_get_time(GString *s, GTimeVal *gt);
43CHASSIS_API int g_string_get_current_time(GString *s);43CHASSIS_API int g_string_get_current_time(GString *s);
44CHASSIS_API gint64 ge_gtimeval_diff(GTimeVal *old, GTimeVal *new);
44CHASSIS_API GString *g_string_assign_len(GString *s, const char *, gsize );45CHASSIS_API GString *g_string_assign_len(GString *s, const char *, gsize );
45CHASSIS_API void g_debug_hexdump(const char *msg, const void *s, size_t len);46CHASSIS_API void g_debug_hexdump(const char *msg, const void *s, size_t len);
4647
4748
=== modified file 'src/network-backend.c'
--- src/network-backend.c 2009-09-16 12:20:47 +0000
+++ src/network-backend.c 2010-02-26 08:20:32 +0000
@@ -1,5 +1,5 @@
1/* $%BEGINLICENSE%$1/* $%BEGINLICENSE%$
2 Copyright (C) 2008 MySQL AB, 2008 Sun Microsystems, Inc2 Copyright (C) 2008 MySQL AB, 2008-2010 Sun Microsystems, Inc
33
4 This program is free software; you can redistribute it and/or modify4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by5 it under the terms of the GNU General Public License as published by
@@ -143,14 +143,23 @@
143 GTimeVal now;143 GTimeVal now;
144 guint i;144 guint i;
145 int backends_woken_up = 0;145 int backends_woken_up = 0;
146 gint64 t_diff;
146147
147 g_get_current_time(&now);148 g_get_current_time(&now);
149 t_diff = ge_gtimeval_diff(&bs->backend_last_check, &now);
148150
149 /* check max(once a second) */151 /* check max(once a second) */
150 if (bs->backend_last_check.tv_sec > 0 &&152 /* this also covers the "time went backards" case */
151 now.tv_sec - bs->backend_last_check.tv_sec < 1) return 0;153 if (t_diff < G_USEC_PER_SEC) {
152154 if (t_diff < 0) {
153155 g_critical("%s: time went backwards (%"G_GINT64_FORMAT" usec)!",
156 G_STRLOC, t_diff);
157 bs->backend_last_check.tv_usec = 0;
158 bs->backend_last_check.tv_sec = 0;
159 }
160 return 0;
161 }
162
154 /* check once a second if we have to wakeup a connection */163 /* check once a second if we have to wakeup a connection */
155 g_mutex_lock(bs->backends_mutex);164 g_mutex_lock(bs->backends_mutex);
156165
157166
=== modified file 'tests/unit/Makefile.am'
--- tests/unit/Makefile.am 2010-02-22 15:23:06 +0000
+++ tests/unit/Makefile.am 2010-02-26 08:20:32 +0000
@@ -1,3 +1,21 @@
1# $%BEGINLICENSE%$
2# Copyright (C) 2009-2010 Sun Microsystems, Inc
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 as published by
6# the Free Software Foundation; version 2 of the License.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16#
17# $%ENDLICENSE%$
18
1SUBDIRS=lua19SUBDIRS=lua
220
3TESTS=\21TESTS=\
@@ -76,6 +94,7 @@
76t_chassis_timings_SOURCES = \94t_chassis_timings_SOURCES = \
77 t_chassis_timings.c \95 t_chassis_timings.c \
78 $(top_srcdir)/src/chassis-timings.c \96 $(top_srcdir)/src/chassis-timings.c \
97 $(top_srcdir)/src/glib-ext.c \
79 $(top_srcdir)/src/my_rdtsc.c 98 $(top_srcdir)/src/my_rdtsc.c
8099
81t_chassis_timings_CPPFLAGS = -I$(top_srcdir)/src/ $(GLIB_CFLAGS) 100t_chassis_timings_CPPFLAGS = -I$(top_srcdir)/src/ $(GLIB_CFLAGS)
@@ -151,6 +170,7 @@
151170
152t_network_backend_SOURCES = \171t_network_backend_SOURCES = \
153 t_network_backend.c \172 t_network_backend.c \
173 $(top_srcdir)/src/chassis-timings.c \
154 $(top_srcdir)/src/glib-ext.c \174 $(top_srcdir)/src/glib-ext.c \
155 $(top_srcdir)/src/network-backend.c \175 $(top_srcdir)/src/network-backend.c \
156 $(top_srcdir)/src/network-mysqld-proto.c \176 $(top_srcdir)/src/network-mysqld-proto.c \
@@ -158,7 +178,8 @@
158 $(top_srcdir)/src/network-conn-pool.c \178 $(top_srcdir)/src/network-conn-pool.c \
159 $(top_srcdir)/src/network-address.c \179 $(top_srcdir)/src/network-address.c \
160 $(top_srcdir)/src/network-queue.c \180 $(top_srcdir)/src/network-queue.c \
161 $(top_srcdir)/src/network-socket.c181 $(top_srcdir)/src/network-socket.c \
182 $(top_srcdir)/src/my_rdtsc.c
162183
163t_network_backend_CPPFLAGS = -I$(top_srcdir)/src/ $(GLIB_CFLAGS) $(MYSQL_CFLAGS) $(GMODULE_CFLAGS) $(EVENT_CFLAGS) $(LUA_CFLAGS)184t_network_backend_CPPFLAGS = -I$(top_srcdir)/src/ $(GLIB_CFLAGS) $(MYSQL_CFLAGS) $(GMODULE_CFLAGS) $(EVENT_CFLAGS) $(LUA_CFLAGS)
164t_network_backend_LDADD = $(GLIB_LIBS) $(GMODULE_LIBS) $(GTHREAD_LIBS) $(EVENT_LIBS) $(LUA_LIBS)185t_network_backend_LDADD = $(GLIB_LIBS) $(GMODULE_LIBS) $(GTHREAD_LIBS) $(EVENT_LIBS) $(LUA_LIBS)

Subscribers

People subscribed via source and target branches