This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

add -E option to demo program

  • Loading branch information...
Roguelazer committed Sep 28, 2011
1 parent 7cbe3f0 commit 307a81761d73c63044e7efbb4178b0c209e05f64
Showing with 19 additions and 5 deletions.
  1. +6 −4 test_data/gen_test_data.sh
  2. +10 −1 ybinlogp.c
  3. +3 −0 ybinlogp.h
View
@@ -4,7 +4,7 @@ tdir=`mktemp -d mysqldXXXXXXXXXX -t`
pidfile="$tdir/mysqld.pid"
errfile="$tdir/mysqld.err"
datadir="$tdir/data/"
-logdir="$tdir/logs/"
+logdir="`pwd`"
tmpdir="$tdir/tmp/"
socket="$tdir/mysqld.sock"
@@ -54,8 +54,10 @@ fi
mysql -S "$socket" < gen_test_data.sql
-cp -r $logdir/* .
-rm mysql-bin.index
-ls mysql-bin*
+#cp -r $logdir/* .
+#rm mysql-bin.index
+#ls mysql-bin*
+
+zsh
stop_mysql
View
@@ -26,6 +26,7 @@ void usage(void) {
fprintf(stderr, "\n");
fprintf(stderr, "Options\n");
fprintf(stderr, "\t-h show this help\n");
+ fprintf(stderr, "\t-E do not enforce server-id checking\n");
fprintf(stderr, "\t-o OFFSET find the first event after the given offset\n");
fprintf(stderr, "\t-t TIME find the first event after the given time\n");
fprintf(stderr, "\t-a COUNT When used with one of the above, print COUNT items after the first one, default 2\n");
@@ -46,15 +47,19 @@ int main(int argc, char** argv) {
int num_to_show = 2;
int show_all = false;
bool q_mode = false;
+ bool esi = true;
char* database_limit = NULL;
- while ((opt = getopt(argc, argv, "ho:t:a:D:q")) != -1) {
+ while ((opt = getopt(argc, argv, "ho:t:a:D:qE")) != -1) {
switch (opt) {
case 'h':
usage();
return 0;
case 'o': /* Offset mode */
starting_offset = atoll(optarg);
break;
+ case 'E':
+ esi = false;
+ break;
case 't': /* Time mode */
starting_time = atoll(optarg);
break;
@@ -93,6 +98,7 @@ int main(int argc, char** argv) {
perror("init_binlog_parser");
return 1;
}
+ bp->enforce_server_id = esi;
if ((evbuf = malloc(sizeof(struct ybp_event))) == NULL) {
perror("malloc event");
return 1;
@@ -143,10 +149,13 @@ int main(int argc, char** argv) {
}
} else {
ybp_print_event(evbuf, bp, stdout, q_mode, false, database_limit);
+ fprintf(stdout, "\n");
}
ybp_reset_event(evbuf);
i+=1;
}
ybp_dispose_event(evbuf);
ybp_dispose_binlog_parser(bp);
}
+
+/* vim: set sts=0 sw=4 ts=4 noexpandtab: */
View
@@ -283,4 +283,7 @@ void ybp_dispose_safe_xe(struct ybp_xid_event*);
off64_t ybp_nearest_offset(struct ybp_binlog_parser* restrict, off64_t);
off64_t ybp_nearest_time(struct ybp_binlog_parser* restrict, time_t target);
+
+/* vim: set sts=0 sw=4 ts=4 noexpandtab: */
+
#endif /* _YBINLOGP_H_ */

0 comments on commit 307a817

Please sign in to comment.