From bbdfc3a5a7de0008a01e0a50f4ffa96b567735e6 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Fri, 24 Apr 2015 17:57:29 +0300 Subject: [PATCH] Revert "Merge branch 'develop' of https://github.com/mariadb-corporation/MaxScale into develop" This reverts commit 58e85098f931f6337841b25126fad23b579a9b49, reversing changes made to c89c7047053f0d6f89069d1b6da2f9caa856066b. --- server/modules/routing/binlog/blr_file.c | 35 ++---------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/server/modules/routing/binlog/blr_file.c b/server/modules/routing/binlog/blr_file.c index b8e201227..482449fc1 100644 --- a/server/modules/routing/binlog/blr_file.c +++ b/server/modules/routing/binlog/blr_file.c @@ -164,24 +164,6 @@ blr_file_rotate(ROUTER_INSTANCE *router, char *file, uint64_t pos) } -/** - * binlog files need an initial 4 magic bytes at the start. blr_file_add_magic() - * adds them. - * - * @param router The router instance - * @param fd file descriptor to the open binlog file - * @return Nothing - */ -static void -blr_file_add_magic(ROUTER_INSTANCE *router, int fd) -{ -unsigned char magic[] = BINLOG_MAGIC; - - write(fd, magic, 4); - router->binlog_position = 4; /* Initial position after the magic number */ -} - - /** * Create a new binlog file for the router to use. * @@ -194,6 +176,7 @@ blr_file_create(ROUTER_INSTANCE *router, char *file) { char path[1024]; int fd; +unsigned char magic[] = BINLOG_MAGIC; strcpy(path, router->binlogdir); strcat(path, "/"); @@ -201,7 +184,7 @@ int fd; if ((fd = open(path, O_RDWR|O_CREAT, 0666)) != -1) { - blr_file_add_magic(router,fd); + write(fd, magic, 4); } else { @@ -214,7 +197,7 @@ int fd; close(router->binlog_fd); spinlock_acquire(&router->binlog_lock); strncpy(router->binlog_name, file,BINLOG_FNAMELEN); - blr_file_add_magic(router, fd); + router->binlog_position = 4; /* Initial position after the magic number */ spinlock_release(&router->binlog_lock); router->binlog_fd = fd; return 1; @@ -249,18 +232,6 @@ int fd; spinlock_acquire(&router->binlog_lock); strncpy(router->binlog_name, file,BINLOG_FNAMELEN); router->binlog_position = lseek(fd, 0L, SEEK_END); - if (router->binlog_position < 4) { - if (router->binlog_position == 0) { - blr_file_add_magic(router, fd); - } else { - /* If for any reason the file's length is between 1 and 3 bytes - * then report an error. */ - LOGIF(LE, (skygw_log_write(LOGFILE_ERROR, - "%s: binlog file %s has an invalid length %d.", - router->service->name, path, router->binlog_position))); - return; - } - } spinlock_release(&router->binlog_lock); router->binlog_fd = fd; }