Revert "Merge branch 'develop' of https://github.com/mariadb-corporation/MaxScale into develop"
This reverts commit 58e85098f931f6337841b25126fad23b579a9b49, reversing changes made to c89c7047053f0d6f89069d1b6da2f9caa856066b.
This commit is contained in:
@ -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.
|
* 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];
|
char path[1024];
|
||||||
int fd;
|
int fd;
|
||||||
|
unsigned char magic[] = BINLOG_MAGIC;
|
||||||
|
|
||||||
strcpy(path, router->binlogdir);
|
strcpy(path, router->binlogdir);
|
||||||
strcat(path, "/");
|
strcat(path, "/");
|
||||||
@ -201,7 +184,7 @@ int fd;
|
|||||||
|
|
||||||
if ((fd = open(path, O_RDWR|O_CREAT, 0666)) != -1)
|
if ((fd = open(path, O_RDWR|O_CREAT, 0666)) != -1)
|
||||||
{
|
{
|
||||||
blr_file_add_magic(router,fd);
|
write(fd, magic, 4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -214,7 +197,7 @@ int fd;
|
|||||||
close(router->binlog_fd);
|
close(router->binlog_fd);
|
||||||
spinlock_acquire(&router->binlog_lock);
|
spinlock_acquire(&router->binlog_lock);
|
||||||
strncpy(router->binlog_name, file,BINLOG_FNAMELEN);
|
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);
|
spinlock_release(&router->binlog_lock);
|
||||||
router->binlog_fd = fd;
|
router->binlog_fd = fd;
|
||||||
return 1;
|
return 1;
|
||||||
@ -249,18 +232,6 @@ int fd;
|
|||||||
spinlock_acquire(&router->binlog_lock);
|
spinlock_acquire(&router->binlog_lock);
|
||||||
strncpy(router->binlog_name, file,BINLOG_FNAMELEN);
|
strncpy(router->binlog_name, file,BINLOG_FNAMELEN);
|
||||||
router->binlog_position = lseek(fd, 0L, SEEK_END);
|
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);
|
spinlock_release(&router->binlog_lock);
|
||||||
router->binlog_fd = fd;
|
router->binlog_fd = fd;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user