Merge lp:~schuster/mysql-proxy/negative-clock into lp:mysql-proxy
- negative-clock
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jan Kneschke (community) | Approve | ||
Review via email:
|
Commit message
Description of the change
To post a comment you must log in.
- 974. By Michael Schuster
-
fix copyright (year)
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jan Kneschke (jan-kneschke) : | # |
review:
Approve
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jan Kneschke (jan-kneschke) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'plugins/proxy/proxy-plugin.c' | |||
2 | --- plugins/proxy/proxy-plugin.c 2010-02-08 11:23:10 +0000 | |||
3 | +++ plugins/proxy/proxy-plugin.c 2010-02-26 08:20:31 +0000 | |||
4 | @@ -1,5 +1,5 @@ | |||
5 | 1 | /* $%BEGINLICENSE%$ | 1 | /* $%BEGINLICENSE%$ |
7 | 2 | Copyright (C) 2007-2008 MySQL AB, 2008 Sun Microsystems, Inc | 2 | Copyright (C) 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc |
8 | 3 | 3 | ||
9 | 4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
10 | 5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
11 | @@ -145,6 +145,7 @@ | |||
12 | 145 | #include "lua-load-factory.h" | 145 | #include "lua-load-factory.h" |
13 | 146 | 146 | ||
14 | 147 | #include "chassis-timings.h" | 147 | #include "chassis-timings.h" |
15 | 148 | #include "chassis-gtimeval.h" | ||
16 | 148 | 149 | ||
17 | 149 | #define C(x) x, sizeof(x) - 1 | 150 | #define C(x) x, sizeof(x) - 1 |
18 | 150 | #define S(x) x->str, x->len | 151 | #define S(x) x->str, x->len |
19 | @@ -1469,7 +1470,7 @@ | |||
20 | 1469 | 1470 | ||
21 | 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 */ |
22 | 1471 | st->backend->state = BACKEND_STATE_DOWN; | 1472 | st->backend->state = BACKEND_STATE_DOWN; |
24 | 1472 | g_get_current_time(&(st->backend->state_since)); | 1473 | (void) chassis_gtime_testset_now(&st->backend->state_since); |
25 | 1473 | network_socket_free(con->server); | 1474 | network_socket_free(con->server); |
26 | 1474 | con->server = NULL; | 1475 | con->server = NULL; |
27 | 1475 | 1476 | ||
28 | @@ -1481,7 +1482,7 @@ | |||
29 | 1481 | 1482 | ||
30 | 1482 | if (st->backend->state != BACKEND_STATE_UP) { | 1483 | if (st->backend->state != BACKEND_STATE_UP) { |
31 | 1483 | st->backend->state = BACKEND_STATE_UP; | 1484 | st->backend->state = BACKEND_STATE_UP; |
33 | 1484 | g_get_current_time(&(st->backend->state_since)); | 1485 | (void) chassis_gtime_testset_now(&st->backend->state_since); |
34 | 1485 | } | 1486 | } |
35 | 1486 | 1487 | ||
36 | 1487 | con->state = CON_STATE_READ_HANDSHAKE; | 1488 | con->state = CON_STATE_READ_HANDSHAKE; |
37 | @@ -1599,7 +1600,7 @@ | |||
38 | 1599 | __FILE__, __LINE__, con->server->dst->name->str); | 1600 | __FILE__, __LINE__, con->server->dst->name->str); |
39 | 1600 | 1601 | ||
40 | 1601 | st->backend->state = BACKEND_STATE_DOWN; | 1602 | st->backend->state = BACKEND_STATE_DOWN; |
42 | 1602 | g_get_current_time(&(st->backend->state_since)); | 1603 | (void) chassis_gtime_testset_now(&st->backend->state_since); |
43 | 1603 | 1604 | ||
44 | 1604 | network_socket_free(con->server); | 1605 | network_socket_free(con->server); |
45 | 1605 | con->server = NULL; | 1606 | con->server = NULL; |
46 | @@ -1609,7 +1610,7 @@ | |||
47 | 1609 | 1610 | ||
48 | 1610 | if (st->backend->state != BACKEND_STATE_UP) { | 1611 | if (st->backend->state != BACKEND_STATE_UP) { |
49 | 1611 | st->backend->state = BACKEND_STATE_UP; | 1612 | st->backend->state = BACKEND_STATE_UP; |
51 | 1612 | g_get_current_time(&(st->backend->state_since)); | 1613 | (void) chassis_gtime_testset_now(&st->backend->state_since); |
52 | 1613 | } | 1614 | } |
53 | 1614 | 1615 | ||
54 | 1615 | con->state = CON_STATE_READ_HANDSHAKE; | 1616 | con->state = CON_STATE_READ_HANDSHAKE; |
55 | 1616 | 1617 | ||
56 | === modified file 'src/CMakeLists.txt' | |||
57 | --- src/CMakeLists.txt 2010-02-25 12:39:54 +0000 | |||
58 | +++ src/CMakeLists.txt 2010-02-26 08:20:32 +0000 | |||
59 | @@ -1,3 +1,20 @@ | |||
60 | 1 | # $%BEGINLICENSE%$ | ||
61 | 2 | # Copyright (C) 2009-2010 Sun Microsystems, Inc | ||
62 | 3 | # | ||
63 | 4 | # This program is free software; you can redistribute it and/or modify | ||
64 | 5 | # it under the terms of the GNU General Public License as published by | ||
65 | 6 | # the Free Software Foundation; version 2 of the License. | ||
66 | 7 | # | ||
67 | 8 | # This program is distributed in the hope that it will be useful, | ||
68 | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
69 | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
70 | 11 | # GNU General Public License for more details. | ||
71 | 12 | # | ||
72 | 13 | # You should have received a copy of the GNU General Public License | ||
73 | 14 | # along with this program; if not, write to the Free Software | ||
74 | 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
75 | 16 | # | ||
76 | 17 | # $%ENDLICENSE%$ | ||
77 | 1 | INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # for config.h | 18 | INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # for config.h |
78 | 2 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) | 19 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) |
79 | 3 | 20 | ||
80 | @@ -17,12 +34,10 @@ | |||
81 | 17 | ADD_DEFINITIONS(-DSHARED_LIBRARY_SUFFIX="${SHARED_LIBRARY_SUFFIX}") | 34 | ADD_DEFINITIONS(-DSHARED_LIBRARY_SUFFIX="${SHARED_LIBRARY_SUFFIX}") |
82 | 18 | 35 | ||
83 | 19 | SET(chassis_sources | 36 | SET(chassis_sources |
84 | 20 | glib-ext.c | ||
85 | 21 | glib-ext-ref.c | ||
86 | 22 | lua-load-factory.c | 37 | lua-load-factory.c |
87 | 23 | lua-scope.c | 38 | lua-scope.c |
88 | 24 | chassis-plugin.c | 39 | chassis-plugin.c |
90 | 25 | chassis-event-thread.c | 40 | chassis-event-thread.c |
91 | 26 | chassis-log.c | 41 | chassis-log.c |
92 | 27 | chassis-mainloop.c | 42 | chassis-mainloop.c |
93 | 28 | chassis-shutdown-hooks.c | 43 | chassis-shutdown-hooks.c |
94 | @@ -31,13 +46,25 @@ | |||
95 | 31 | chassis-filemode.c | 46 | chassis-filemode.c |
96 | 32 | chassis-limits.c | 47 | chassis-limits.c |
97 | 33 | chassis-stats.c | 48 | chassis-stats.c |
98 | 49 | <<<<<<< TREE | ||
99 | 34 | ) | 50 | ) |
100 | 35 | 51 | ||
101 | 36 | SET(chassis_timing_sources | 52 | SET(chassis_timing_sources |
102 | 53 | ======= | ||
103 | 54 | ) | ||
104 | 55 | |||
105 | 56 | SET(timing_sources | ||
106 | 57 | >>>>>>> MERGE-SOURCE | ||
107 | 37 | chassis-timings.c | 58 | chassis-timings.c |
108 | 59 | chassis-gtimeval.c | ||
109 | 38 | my_rdtsc.c | 60 | my_rdtsc.c |
110 | 39 | ) | 61 | ) |
111 | 40 | 62 | ||
112 | 63 | SET(glibext_sources | ||
113 | 64 | glib-ext.c | ||
114 | 65 | glib-ext-ref.c | ||
115 | 66 | ) | ||
116 | 67 | |||
117 | 41 | SET(proxy_sources | 68 | SET(proxy_sources |
118 | 42 | network-mysqld.c | 69 | network-mysqld.c |
119 | 43 | network-mysqld-lua.c | 70 | network-mysqld-lua.c |
120 | @@ -62,6 +89,8 @@ | |||
121 | 62 | ADD_LIBRARY(mysql-chassis SHARED ${chassis_sources}) | 89 | ADD_LIBRARY(mysql-chassis SHARED ${chassis_sources}) |
122 | 63 | ADD_LIBRARY(mysql-chassis-timing SHARED ${chassis_timing_sources}) | 90 | ADD_LIBRARY(mysql-chassis-timing SHARED ${chassis_timing_sources}) |
123 | 64 | ADD_LIBRARY(mysql-chassis-proxy SHARED ${proxy_sources}) | 91 | ADD_LIBRARY(mysql-chassis-proxy SHARED ${proxy_sources}) |
124 | 92 | ADD_LIBRARY(mysql-chassis-glibext SHARED ${glibext_sources}) | ||
125 | 93 | ADD_LIBRARY(mysql-chassis-timing SHARED ${timing_sources}) | ||
126 | 65 | ADD_EXECUTABLE(mysql-proxy chassis.c) | 94 | ADD_EXECUTABLE(mysql-proxy chassis.c) |
127 | 66 | 95 | ||
128 | 67 | ## for windows we need the winsock lib | 96 | ## for windows we need the winsock lib |
129 | @@ -84,11 +113,17 @@ | |||
130 | 84 | ${LUA_LIBRARIES} | 113 | ${LUA_LIBRARIES} |
131 | 85 | ${EVENT_LIBRARIES} | 114 | ${EVENT_LIBRARIES} |
132 | 86 | ${WINSOCK_LIBRARIES} | 115 | ${WINSOCK_LIBRARIES} |
133 | 116 | <<<<<<< TREE | ||
134 | 87 | mysql-chassis-timing | 117 | mysql-chassis-timing |
135 | 118 | ======= | ||
136 | 119 | mysql-chassis-glibext | ||
137 | 120 | >>>>>>> MERGE-SOURCE | ||
138 | 88 | ) | 121 | ) |
139 | 89 | 122 | ||
140 | 90 | TARGET_LINK_LIBRARIES(mysql-chassis-proxy | 123 | TARGET_LINK_LIBRARIES(mysql-chassis-proxy |
142 | 91 | mysql-chassis | 124 | mysql-chassis |
143 | 125 | mysql-chassis-glibext | ||
144 | 126 | mysql-chassis-timing | ||
145 | 92 | ) | 127 | ) |
146 | 93 | 128 | ||
147 | 94 | TARGET_LINK_LIBRARIES(mysql-proxy | 129 | TARGET_LINK_LIBRARIES(mysql-proxy |
148 | @@ -99,6 +134,8 @@ | |||
149 | 99 | ${EVENT_LIBRARIES} | 134 | ${EVENT_LIBRARIES} |
150 | 100 | mysql-chassis | 135 | mysql-chassis |
151 | 101 | mysql-chassis-proxy | 136 | mysql-chassis-proxy |
152 | 137 | mysql-chassis-glibext | ||
153 | 138 | mysql-chassis-timing | ||
154 | 102 | ) | 139 | ) |
155 | 103 | 140 | ||
156 | 104 | IF(WIN32) | 141 | IF(WIN32) |
157 | @@ -111,6 +148,8 @@ | |||
158 | 111 | ${EVENT_LIBRARIES} | 148 | ${EVENT_LIBRARIES} |
159 | 112 | mysql-chassis | 149 | mysql-chassis |
160 | 113 | mysql-chassis-proxy | 150 | mysql-chassis-proxy |
161 | 151 | mysql-chassis-glibext | ||
162 | 152 | mysql-chassis-timing | ||
163 | 114 | ) | 153 | ) |
164 | 115 | SET_TARGET_PROPERTIES(mysql-proxy-svc | 154 | SET_TARGET_PROPERTIES(mysql-proxy-svc |
165 | 116 | PROPERTIES | 155 | PROPERTIES |
166 | @@ -158,7 +197,12 @@ | |||
167 | 158 | 197 | ||
168 | 159 | CHASSIS_INSTALL_TARGET(mysql-chassis) | 198 | CHASSIS_INSTALL_TARGET(mysql-chassis) |
169 | 160 | CHASSIS_INSTALL_TARGET(mysql-chassis-proxy) | 199 | CHASSIS_INSTALL_TARGET(mysql-chassis-proxy) |
171 | 161 | CHASSIS_INSTALL_TARGET(mysql-chassis-timing) | 200 | <<<<<<< TREE |
172 | 201 | CHASSIS_INSTALL_TARGET(mysql-chassis-timing) | ||
173 | 202 | ======= | ||
174 | 203 | CHASSIS_INSTALL_TARGET(mysql-chassis-glibext) | ||
175 | 204 | CHASSIS_INSTALL_TARGET(mysql-chassis-timing) | ||
176 | 205 | >>>>>>> MERGE-SOURCE | ||
177 | 162 | 206 | ||
178 | 163 | INSTALL(FILES | 207 | INSTALL(FILES |
179 | 164 | network-mysqld.h | 208 | network-mysqld.h |
180 | @@ -200,6 +244,7 @@ | |||
181 | 200 | lua-registry-keys.h | 244 | lua-registry-keys.h |
182 | 201 | chassis-stats.h | 245 | chassis-stats.h |
183 | 202 | chassis-timings.h | 246 | chassis-timings.h |
184 | 247 | chassis-gtimeval.h | ||
185 | 203 | my_rdtsc.h | 248 | my_rdtsc.h |
186 | 204 | DESTINATION include/ | 249 | DESTINATION include/ |
187 | 205 | ) | 250 | ) |
188 | 206 | 251 | ||
189 | === modified file 'src/Makefile.am' | |||
190 | --- src/Makefile.am 2010-02-19 15:23:10 +0000 | |||
191 | +++ src/Makefile.am 2010-02-26 08:20:32 +0000 | |||
192 | @@ -1,3 +1,20 @@ | |||
193 | 1 | # $%BEGINLICENSE%$ | ||
194 | 2 | # Copyright (C) 2009-2010 Sun Microsystems, Inc | ||
195 | 3 | # | ||
196 | 4 | # This program is free software; you can redistribute it and/or modify | ||
197 | 5 | # it under the terms of the GNU General Public License as published by | ||
198 | 6 | # the Free Software Foundation; version 2 of the License. | ||
199 | 7 | # | ||
200 | 8 | # This program is distributed in the hope that it will be useful, | ||
201 | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
202 | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
203 | 11 | # GNU General Public License for more details. | ||
204 | 12 | # | ||
205 | 13 | # You should have received a copy of the GNU General Public License | ||
206 | 14 | # along with this program; if not, write to the Free Software | ||
207 | 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
208 | 16 | # | ||
209 | 17 | # $%ENDLICENSE%$ | ||
210 | 1 | luaextdir = ${pkglibdir}/lua | 18 | luaextdir = ${pkglibdir}/lua |
211 | 2 | plugindir = ${pkglibdir}/plugins | 19 | plugindir = ${pkglibdir}/plugins |
212 | 3 | 20 | ||
213 | @@ -32,13 +49,26 @@ | |||
214 | 32 | 49 | ||
215 | 33 | lib_LTLIBRARIES = | 50 | lib_LTLIBRARIES = |
216 | 34 | 51 | ||
217 | 52 | # functionality extending what's currently in glib | ||
218 | 53 | lib_LTLIBRARIES += libmysql-chassis-glibext.la | ||
219 | 54 | libmysql_chassis_glibext_la_SOURCES = \ | ||
220 | 55 | glib-ext.c \ | ||
221 | 56 | glib-ext-ref.c | ||
222 | 57 | |||
223 | 58 | libmysql_chassis_glibext_la_LDFLAGS = -export-dynamic -no-undefined -dynamic | ||
224 | 59 | libmysql_chassis_glibext_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(GMODULE_CFLAGS) | ||
225 | 60 | libmysql_chassis_glibext_la_LIBADD = $(GLIB_LIBS) | ||
226 | 61 | |||
227 | 62 | # library implementing timing functionality | ||
228 | 35 | lib_LTLIBRARIES += libmysql-chassis-timing.la | 63 | lib_LTLIBRARIES += libmysql-chassis-timing.la |
229 | 36 | libmysql_chassis_timing_la_SOURCES = \ | 64 | libmysql_chassis_timing_la_SOURCES = \ |
230 | 37 | chassis-timings.c \ | 65 | chassis-timings.c \ |
231 | 66 | chassis-gtimeval.c \ | ||
232 | 38 | my_rdtsc.c | 67 | my_rdtsc.c |
233 | 68 | |||
234 | 39 | libmysql_chassis_timing_la_LDFLAGS = -export-dynamic -no-undefined -dynamic | 69 | libmysql_chassis_timing_la_LDFLAGS = -export-dynamic -no-undefined -dynamic |
235 | 40 | libmysql_chassis_timing_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) | 70 | libmysql_chassis_timing_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) |
237 | 41 | libmysql_chassis_timing_la_LIBADD = $(GLIB_LIBS) | 71 | libmysql_chassis_timing_la_LIBADD = $(GLIB_LIBS) libmysql-chassis-glibext.la |
238 | 42 | if USE_SUNCC_ASSEMBLY | 72 | if USE_SUNCC_ASSEMBLY |
239 | 43 | libmysql_chassis_timing_la_CPPFLAGS += \ | 73 | libmysql_chassis_timing_la_CPPFLAGS += \ |
240 | 44 | $(top_srcdir)/src/my_timer_cycles.il | 74 | $(top_srcdir)/src/my_timer_cycles.il |
241 | @@ -48,8 +78,6 @@ | |||
242 | 48 | ## the core library | 78 | ## the core library |
243 | 49 | lib_LTLIBRARIES += libmysql-chassis.la | 79 | lib_LTLIBRARIES += libmysql-chassis.la |
244 | 50 | libmysql_chassis_la_SOURCES = \ | 80 | libmysql_chassis_la_SOURCES = \ |
245 | 51 | glib-ext.c \ | ||
246 | 52 | glib-ext-ref.c \ | ||
247 | 53 | lua-load-factory.c \ | 81 | lua-load-factory.c \ |
248 | 54 | lua-scope.c \ | 82 | lua-scope.c \ |
249 | 55 | chassis-plugin.c \ | 83 | chassis-plugin.c \ |
250 | @@ -66,7 +94,7 @@ | |||
251 | 66 | 94 | ||
252 | 67 | libmysql_chassis_la_LDFLAGS = -export-dynamic -no-undefined -dynamic | 95 | libmysql_chassis_la_LDFLAGS = -export-dynamic -no-undefined -dynamic |
253 | 68 | libmysql_chassis_la_CPPFLAGS = $(MYSQL_CFLAGS) $(EVENT_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) $(GTHREAD_CFLAGS) | 96 | libmysql_chassis_la_CPPFLAGS = $(MYSQL_CFLAGS) $(EVENT_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) $(GTHREAD_CFLAGS) |
255 | 69 | libmysql_chassis_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(LUA_LIBS) $(GMODULE_LIBS) $(GTHREAD_LIBS) libmysql-chassis-timing.la | 97 | libmysql_chassis_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(LUA_LIBS) $(GMODULE_LIBS) $(GTHREAD_LIBS) libmysql-chassis-timing.la libmysql-chassis-glibext.la |
256 | 70 | 98 | ||
257 | 71 | lib_LTLIBRARIES += libmysql-proxy.la | 99 | lib_LTLIBRARIES += libmysql-proxy.la |
258 | 72 | libmysql_proxy_la_SOURCES = \ | 100 | libmysql_proxy_la_SOURCES = \ |
259 | @@ -91,7 +119,7 @@ | |||
260 | 91 | 119 | ||
261 | 92 | libmysql_proxy_la_LDFLAGS = -export-dynamic -no-undefined -dynamic | 120 | libmysql_proxy_la_LDFLAGS = -export-dynamic -no-undefined -dynamic |
262 | 93 | libmysql_proxy_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) | 121 | libmysql_proxy_la_CPPFLAGS = $(MYSQL_CFLAGS) $(GLIB_CFLAGS) $(LUA_CFLAGS) $(GMODULE_CFLAGS) |
264 | 94 | libmysql_proxy_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) libmysql-chassis.la libmysql-chassis-timing.la | 122 | libmysql_proxy_la_LIBADD = $(EVENT_LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) libmysql-chassis.la libmysql-chassis-timing.la libmysql-chassis-glibext.la |
265 | 95 | 123 | ||
266 | 96 | 124 | ||
267 | 97 | include_HEADERS=\ | 125 | include_HEADERS=\ |
268 | 98 | 126 | ||
269 | === added file 'src/chassis-gtimeval.c' | |||
270 | --- src/chassis-gtimeval.c 1970-01-01 00:00:00 +0000 | |||
271 | +++ src/chassis-gtimeval.c 2010-02-26 08:20:32 +0000 | |||
272 | @@ -0,0 +1,43 @@ | |||
273 | 1 | /* $%BEGINLICENSE%$ | ||
274 | 2 | Copyright (C) 2010 Sun Microsystems, Inc | ||
275 | 3 | |||
276 | 4 | This program is free software; you can redistribute it and/or modify | ||
277 | 5 | it under the terms of the GNU General Public License as published by | ||
278 | 6 | the Free Software Foundation; version 2 of the License. | ||
279 | 7 | |||
280 | 8 | This program is distributed in the hope that it will be useful, | ||
281 | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
282 | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
283 | 11 | GNU General Public License for more details. | ||
284 | 12 | |||
285 | 13 | You should have received a copy of the GNU General Public License | ||
286 | 14 | along with this program; if not, write to the Free Software | ||
287 | 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
288 | 16 | |||
289 | 17 | $%ENDLICENSE%$ */ | ||
290 | 18 | |||
291 | 19 | #include <glib.h> | ||
292 | 20 | |||
293 | 21 | #include "chassis-gtimeval.h" | ||
294 | 22 | |||
295 | 23 | gint64 chassis_gtime_testset_now(GTimeVal *gt) | ||
296 | 24 | { | ||
297 | 25 | GTimeVal now; | ||
298 | 26 | gint64 tdiff; | ||
299 | 27 | |||
300 | 28 | if (gt == NULL) | ||
301 | 29 | return (0); | ||
302 | 30 | |||
303 | 31 | g_get_current_time(&now); | ||
304 | 32 | tdiff = ge_gtimeval_diff(gt, &now); | ||
305 | 33 | |||
306 | 34 | if (tdiff < 0) { | ||
307 | 35 | g_critical("%s: time went backwards (%"G_GINT64_FORMAT" usec)!", | ||
308 | 36 | G_STRLOC, tdiff); | ||
309 | 37 | gt->tv_usec = gt->tv_sec = 0; | ||
310 | 38 | return tdiff; | ||
311 | 39 | } | ||
312 | 40 | |||
313 | 41 | *gt = now; | ||
314 | 42 | return tdiff; | ||
315 | 43 | } | ||
316 | 0 | 44 | ||
317 | === added file 'src/chassis-gtimeval.h' | |||
318 | --- src/chassis-gtimeval.h 1970-01-01 00:00:00 +0000 | |||
319 | +++ src/chassis-gtimeval.h 2010-02-26 08:20:32 +0000 | |||
320 | @@ -0,0 +1,34 @@ | |||
321 | 1 | /* $%BEGINLICENSE%$ | ||
322 | 2 | Copyright (C) 2010 Sun Microsystems, Inc | ||
323 | 3 | |||
324 | 4 | This program is free software; you can redistribute it and/or modify | ||
325 | 5 | it under the terms of the GNU General Public License as published by | ||
326 | 6 | the Free Software Foundation; version 2 of the License. | ||
327 | 7 | |||
328 | 8 | This program is distributed in the hope that it will be useful, | ||
329 | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
330 | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
331 | 11 | GNU General Public License for more details. | ||
332 | 12 | |||
333 | 13 | You should have received a copy of the GNU General Public License | ||
334 | 14 | along with this program; if not, write to the Free Software | ||
335 | 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
336 | 16 | |||
337 | 17 | $%ENDLICENSE%$ */ | ||
338 | 18 | |||
339 | 19 | #ifndef __CHASSIS_GTIMEVAL_H__ | ||
340 | 20 | #define __CHASSIS_GTIMEVAL_H__ | ||
341 | 21 | |||
342 | 22 | #include <glib.h> | ||
343 | 23 | #include "glib-ext.h" | ||
344 | 24 | |||
345 | 25 | /** | ||
346 | 26 | * stores the current time in the location passed as argument | ||
347 | 27 | * if time is seen to move backwards, output an error message and | ||
348 | 28 | * set the time to "0". | ||
349 | 29 | * @param pointer to a GTimeVal struct | ||
350 | 30 | * @return difference in usec between provided timestamp and "now" | ||
351 | 31 | */ | ||
352 | 32 | |||
353 | 33 | CHASSIS_API gint64 chassis_gtime_testset_now(GTimeVal *gt); | ||
354 | 34 | #endif | ||
355 | 0 | 35 | ||
356 | === modified file 'src/chassis-timings.c' | |||
357 | --- src/chassis-timings.c 2010-01-20 08:59:12 +0000 | |||
358 | +++ src/chassis-timings.c 2010-02-26 08:20:32 +0000 | |||
359 | @@ -1,5 +1,5 @@ | |||
360 | 1 | /* $%BEGINLICENSE%$ | 1 | /* $%BEGINLICENSE%$ |
362 | 2 | Copyright (C) 2009 Sun Microsystems, Inc | 2 | Copyright (C) 2009-2010 Sun Microsystems, Inc |
363 | 3 | 3 | ||
364 | 4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
365 | 5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
366 | @@ -19,6 +19,7 @@ | |||
367 | 19 | #include <glib.h> | 19 | #include <glib.h> |
368 | 20 | 20 | ||
369 | 21 | #include "chassis-timings.h" | 21 | #include "chassis-timings.h" |
370 | 22 | #include "glib-ext.h" | ||
371 | 22 | 23 | ||
372 | 23 | #define MICROS_IN_SEC 1000000 | 24 | #define MICROS_IN_SEC 1000000 |
373 | 24 | 25 | ||
374 | 25 | 26 | ||
375 | === modified file 'src/glib-ext.c' | |||
376 | --- src/glib-ext.c 2009-11-11 16:58:44 +0000 | |||
377 | +++ src/glib-ext.c 2010-02-26 08:20:32 +0000 | |||
378 | @@ -1,5 +1,5 @@ | |||
379 | 1 | /* $%BEGINLICENSE%$ | 1 | /* $%BEGINLICENSE%$ |
381 | 2 | Copyright (C) 2007-2008 MySQL AB, 2008 Sun Microsystems, Inc | 2 | Copyright (C) 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc |
382 | 3 | 3 | ||
383 | 4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
384 | 5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
385 | @@ -142,6 +142,20 @@ | |||
386 | 142 | return g_string_get_time(s, >); | 142 | return g_string_get_time(s, >); |
387 | 143 | } | 143 | } |
388 | 144 | 144 | ||
389 | 145 | /** | ||
390 | 146 | * calculate the difference between two GTimeVal values, in usec | ||
391 | 147 | * positive return means *told is indeed "earlier" than *tnew, negative | ||
392 | 148 | * return means the reverse | ||
393 | 149 | * Caller is responsible for passing valid pointers | ||
394 | 150 | */ | ||
395 | 151 | gint64 ge_gtimeval_diff(GTimeVal *told, GTimeVal *tnew) { | ||
396 | 152 | gint64 diff; | ||
397 | 153 | |||
398 | 154 | diff = (gint64) tnew->tv_sec - told->tv_sec; | ||
399 | 155 | diff *= G_USEC_PER_SEC; | ||
400 | 156 | diff += (gint64) tnew->tv_usec - told->tv_usec; | ||
401 | 157 | return diff; | ||
402 | 158 | } | ||
403 | 145 | 159 | ||
404 | 146 | GString * g_string_assign_len(GString *s, const char *str, gsize str_len) { | 160 | GString * g_string_assign_len(GString *s, const char *str, gsize str_len) { |
405 | 147 | g_string_truncate(s, 0); | 161 | g_string_truncate(s, 0); |
406 | 148 | 162 | ||
407 | === modified file 'src/glib-ext.h' | |||
408 | --- src/glib-ext.h 2009-11-11 16:58:44 +0000 | |||
409 | +++ src/glib-ext.h 2010-02-26 08:20:32 +0000 | |||
410 | @@ -1,5 +1,5 @@ | |||
411 | 1 | /* $%BEGINLICENSE%$ | 1 | /* $%BEGINLICENSE%$ |
413 | 2 | Copyright (C) 2007-2008 MySQL AB, 2008 Sun Microsystems, Inc | 2 | Copyright (C) 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc |
414 | 3 | 3 | ||
415 | 4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
416 | 5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
417 | @@ -41,6 +41,7 @@ | |||
418 | 41 | 41 | ||
419 | 42 | CHASSIS_API int g_string_get_time(GString *s, GTimeVal *gt); | 42 | CHASSIS_API int g_string_get_time(GString *s, GTimeVal *gt); |
420 | 43 | CHASSIS_API int g_string_get_current_time(GString *s); | 43 | CHASSIS_API int g_string_get_current_time(GString *s); |
421 | 44 | CHASSIS_API gint64 ge_gtimeval_diff(GTimeVal *old, GTimeVal *new); | ||
422 | 44 | CHASSIS_API GString *g_string_assign_len(GString *s, const char *, gsize ); | 45 | CHASSIS_API GString *g_string_assign_len(GString *s, const char *, gsize ); |
423 | 45 | CHASSIS_API void g_debug_hexdump(const char *msg, const void *s, size_t len); | 46 | CHASSIS_API void g_debug_hexdump(const char *msg, const void *s, size_t len); |
424 | 46 | 47 | ||
425 | 47 | 48 | ||
426 | === modified file 'src/network-backend.c' | |||
427 | --- src/network-backend.c 2009-09-16 12:20:47 +0000 | |||
428 | +++ src/network-backend.c 2010-02-26 08:20:32 +0000 | |||
429 | @@ -1,5 +1,5 @@ | |||
430 | 1 | /* $%BEGINLICENSE%$ | 1 | /* $%BEGINLICENSE%$ |
432 | 2 | Copyright (C) 2008 MySQL AB, 2008 Sun Microsystems, Inc | 2 | Copyright (C) 2008 MySQL AB, 2008-2010 Sun Microsystems, Inc |
433 | 3 | 3 | ||
434 | 4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
435 | 5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
436 | @@ -143,14 +143,23 @@ | |||
437 | 143 | GTimeVal now; | 143 | GTimeVal now; |
438 | 144 | guint i; | 144 | guint i; |
439 | 145 | int backends_woken_up = 0; | 145 | int backends_woken_up = 0; |
440 | 146 | gint64 t_diff; | ||
441 | 146 | 147 | ||
442 | 147 | g_get_current_time(&now); | 148 | g_get_current_time(&now); |
443 | 149 | t_diff = ge_gtimeval_diff(&bs->backend_last_check, &now); | ||
444 | 148 | 150 | ||
445 | 149 | /* check max(once a second) */ | 151 | /* check max(once a second) */ |
450 | 150 | if (bs->backend_last_check.tv_sec > 0 && | 152 | /* this also covers the "time went backards" case */ |
451 | 151 | now.tv_sec - bs->backend_last_check.tv_sec < 1) return 0; | 153 | if (t_diff < G_USEC_PER_SEC) { |
452 | 152 | 154 | if (t_diff < 0) { | |
453 | 153 | 155 | g_critical("%s: time went backwards (%"G_GINT64_FORMAT" usec)!", | |
454 | 156 | G_STRLOC, t_diff); | ||
455 | 157 | bs->backend_last_check.tv_usec = 0; | ||
456 | 158 | bs->backend_last_check.tv_sec = 0; | ||
457 | 159 | } | ||
458 | 160 | return 0; | ||
459 | 161 | } | ||
460 | 162 | |||
461 | 154 | /* check once a second if we have to wakeup a connection */ | 163 | /* check once a second if we have to wakeup a connection */ |
462 | 155 | g_mutex_lock(bs->backends_mutex); | 164 | g_mutex_lock(bs->backends_mutex); |
463 | 156 | 165 | ||
464 | 157 | 166 | ||
465 | === modified file 'tests/unit/Makefile.am' | |||
466 | --- tests/unit/Makefile.am 2010-02-22 15:23:06 +0000 | |||
467 | +++ tests/unit/Makefile.am 2010-02-26 08:20:32 +0000 | |||
468 | @@ -1,3 +1,21 @@ | |||
469 | 1 | # $%BEGINLICENSE%$ | ||
470 | 2 | # Copyright (C) 2009-2010 Sun Microsystems, Inc | ||
471 | 3 | # | ||
472 | 4 | # This program is free software; you can redistribute it and/or modify | ||
473 | 5 | # it under the terms of the GNU General Public License as published by | ||
474 | 6 | # the Free Software Foundation; version 2 of the License. | ||
475 | 7 | # | ||
476 | 8 | # This program is distributed in the hope that it will be useful, | ||
477 | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
478 | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
479 | 11 | # GNU General Public License for more details. | ||
480 | 12 | # | ||
481 | 13 | # You should have received a copy of the GNU General Public License | ||
482 | 14 | # along with this program; if not, write to the Free Software | ||
483 | 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
484 | 16 | # | ||
485 | 17 | # $%ENDLICENSE%$ | ||
486 | 18 | |||
487 | 1 | SUBDIRS=lua | 19 | SUBDIRS=lua |
488 | 2 | 20 | ||
489 | 3 | TESTS=\ | 21 | TESTS=\ |
490 | @@ -76,6 +94,7 @@ | |||
491 | 76 | t_chassis_timings_SOURCES = \ | 94 | t_chassis_timings_SOURCES = \ |
492 | 77 | t_chassis_timings.c \ | 95 | t_chassis_timings.c \ |
493 | 78 | $(top_srcdir)/src/chassis-timings.c \ | 96 | $(top_srcdir)/src/chassis-timings.c \ |
494 | 97 | $(top_srcdir)/src/glib-ext.c \ | ||
495 | 79 | $(top_srcdir)/src/my_rdtsc.c | 98 | $(top_srcdir)/src/my_rdtsc.c |
496 | 80 | 99 | ||
497 | 81 | t_chassis_timings_CPPFLAGS = -I$(top_srcdir)/src/ $(GLIB_CFLAGS) | 100 | t_chassis_timings_CPPFLAGS = -I$(top_srcdir)/src/ $(GLIB_CFLAGS) |
498 | @@ -151,6 +170,7 @@ | |||
499 | 151 | 170 | ||
500 | 152 | t_network_backend_SOURCES = \ | 171 | t_network_backend_SOURCES = \ |
501 | 153 | t_network_backend.c \ | 172 | t_network_backend.c \ |
502 | 173 | $(top_srcdir)/src/chassis-timings.c \ | ||
503 | 154 | $(top_srcdir)/src/glib-ext.c \ | 174 | $(top_srcdir)/src/glib-ext.c \ |
504 | 155 | $(top_srcdir)/src/network-backend.c \ | 175 | $(top_srcdir)/src/network-backend.c \ |
505 | 156 | $(top_srcdir)/src/network-mysqld-proto.c \ | 176 | $(top_srcdir)/src/network-mysqld-proto.c \ |
506 | @@ -158,7 +178,8 @@ | |||
507 | 158 | $(top_srcdir)/src/network-conn-pool.c \ | 178 | $(top_srcdir)/src/network-conn-pool.c \ |
508 | 159 | $(top_srcdir)/src/network-address.c \ | 179 | $(top_srcdir)/src/network-address.c \ |
509 | 160 | $(top_srcdir)/src/network-queue.c \ | 180 | $(top_srcdir)/src/network-queue.c \ |
511 | 161 | $(top_srcdir)/src/network-socket.c | 181 | $(top_srcdir)/src/network-socket.c \ |
512 | 182 | $(top_srcdir)/src/my_rdtsc.c | ||
513 | 162 | 183 | ||
514 | 163 | t_network_backend_CPPFLAGS = -I$(top_srcdir)/src/ $(GLIB_CFLAGS) $(MYSQL_CFLAGS) $(GMODULE_CFLAGS) $(EVENT_CFLAGS) $(LUA_CFLAGS) | 184 | t_network_backend_CPPFLAGS = -I$(top_srcdir)/src/ $(GLIB_CFLAGS) $(MYSQL_CFLAGS) $(GMODULE_CFLAGS) $(EVENT_CFLAGS) $(LUA_CFLAGS) |
515 | 164 | t_network_backend_LDADD = $(GLIB_LIBS) $(GMODULE_LIBS) $(GTHREAD_LIBS) $(EVENT_LIBS) $(LUA_LIBS) | 185 | t_network_backend_LDADD = $(GLIB_LIBS) $(GMODULE_LIBS) $(GTHREAD_LIBS) $(EVENT_LIBS) $(LUA_LIBS) |
rebased, fixed the conflicts against the current trunk and pushed over