Index: trunk/tools/trainwreck/trainwreck.c |
— | — | @@ -178,6 +178,8 @@ |
179 | 179 | static pthread_cond_t wi_cond = PTHREAD_COND_INITIALIZER; |
180 | 180 | static logpos_t lowest_log_pos; |
181 | 181 | |
| 182 | +static int unsynced; |
| 183 | + |
182 | 184 | #define CTL_STOP 1 |
183 | 185 | #define CTL_START 2 |
184 | 186 | #define CTL_SHUTDOWN 3 |
— | — | @@ -195,7 +197,7 @@ |
196 | 198 | |
197 | 199 | setup_status_door(); |
198 | 200 | |
199 | | - while ((c = getopt(argc, argv, "f:F:p:Da")) != -1) { |
| 201 | + while ((c = getopt(argc, argv, "f:F:p:Dau")) != -1) { |
200 | 202 | switch (c) { |
201 | 203 | case 'a': |
202 | 204 | autostart = 1; |
— | — | @@ -217,6 +219,10 @@ |
218 | 220 | debug = 1; |
219 | 221 | break; |
220 | 222 | |
| 223 | + case 'u': |
| 224 | + unsynced = 1; |
| 225 | + break; |
| 226 | + |
221 | 227 | default: |
222 | 228 | usage(); |
223 | 229 | exit(1); |
— | — | @@ -281,7 +287,7 @@ |
282 | 288 | usage() |
283 | 289 | { |
284 | 290 | (void) fprintf(stderr, |
285 | | - "usage: trainwreck [-d] [-f <cfg>] [-F binlog] [-p binlogpos]\n"); |
| 291 | + "usage: trainwreck [-adu] [-f <cfg>] [-F binlog] [-p binlogpos]\n"); |
286 | 292 | } |
287 | 293 | |
288 | 294 | static void |
— | — | @@ -547,6 +553,9 @@ |
548 | 554 | exit(1); |
549 | 555 | } |
550 | 556 | |
| 557 | + if (debug) |
| 558 | + logmsg("got binlog event"); |
| 559 | + |
551 | 560 | ent->le_file = strdup(curfile); |
552 | 561 | curpos = ent->le_pos; |
553 | 562 | |
— | — | @@ -1023,7 +1032,8 @@ |
1024 | 1033 | int4store(buf, pos); |
1025 | 1034 | (void) strlcpy(buf + 4, log, sizeof(buf) - 4); |
1026 | 1035 | (void) write(writer->wr_rstat, buf, 4 + strlen(log)); |
1027 | | - (void) fdatasync(writer->wr_rstat); |
| 1036 | + if (!unsynced) |
| 1037 | + (void) fdatasync(writer->wr_rstat); |
1028 | 1038 | } |
1029 | 1039 | |
1030 | 1040 | static int |