Removed useless vars and code cleanup
Removed useless vars and code cleanup
This commit is contained in:
@ -90,7 +90,7 @@ struct dirent *dp;
|
|||||||
|
|
||||||
if (router->binlogdir == NULL)
|
if (router->binlogdir == NULL)
|
||||||
{
|
{
|
||||||
strcpy(path, get_datadir());
|
strncpy(path, get_datadir(), PATH_MAX);
|
||||||
strncat(path,"/",PATH_MAX);
|
strncat(path,"/",PATH_MAX);
|
||||||
strncat(path, router->service->name,PATH_MAX);
|
strncat(path, router->service->name,PATH_MAX);
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ unsigned char magic[] = BINLOG_MAGIC;
|
|||||||
static int
|
static int
|
||||||
blr_file_create(ROUTER_INSTANCE *router, char *file)
|
blr_file_create(ROUTER_INSTANCE *router, char *file)
|
||||||
{
|
{
|
||||||
char path[1024];
|
char path[PATH_MAX + 1];
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
strcpy(path, router->binlogdir);
|
strcpy(path, router->binlogdir);
|
||||||
@ -573,7 +573,9 @@ struct stat statb;
|
|||||||
}
|
}
|
||||||
blr_log_header(LOGFILE_ERROR, "Possible malformed event header", hdbuf);
|
blr_log_header(LOGFILE_ERROR, "Possible malformed event header", hdbuf);
|
||||||
}
|
}
|
||||||
gwbuf_consume(result, hdr->event_size);
|
|
||||||
|
gwbuf_free(result);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -611,9 +613,10 @@ blr_close_binlog(ROUTER_INSTANCE *router, BLFILE *file)
|
|||||||
close(file->fd);
|
close(file->fd);
|
||||||
file->fd = -1;
|
file->fd = -1;
|
||||||
}
|
}
|
||||||
spinlock_release(&file->lock);
|
|
||||||
if (file->refcnt == 0)
|
if (file->refcnt == 0)
|
||||||
free(file);
|
free(file);
|
||||||
|
|
||||||
|
spinlock_release(&file->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -671,7 +674,7 @@ char path[PATH_MAX+1], *ptr;
|
|||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
strncpy(path, router->binlogdir, PATH_MAX);
|
strncpy(path, router->binlogdir, PATH_MAX);
|
||||||
strncat(path, "/cache", 4096);
|
strncat(path, "/cache", PATH_MAX);
|
||||||
|
|
||||||
if (access(path, R_OK) == -1) {
|
if (access(path, R_OK) == -1) {
|
||||||
int mkdir_ret;
|
int mkdir_ret;
|
||||||
@ -740,7 +743,7 @@ GWBUF *buf;
|
|||||||
int
|
int
|
||||||
blr_file_next_exists(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave)
|
blr_file_next_exists(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave)
|
||||||
{
|
{
|
||||||
char *sptr, buf[80], bigbuf[4096];
|
char *sptr, buf[80], bigbuf[PATH_MAX + 1];
|
||||||
int filenum;
|
int filenum;
|
||||||
|
|
||||||
if ((sptr = strrchr(slave->binlogfile, '.')) == NULL)
|
if ((sptr = strrchr(slave->binlogfile, '.')) == NULL)
|
||||||
@ -837,11 +840,6 @@ blr_file_use_binlog(ROUTER_INSTANCE *router, char *file)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
blr_file_write_master_config(ROUTER_INSTANCE *router, char *error) {
|
blr_file_write_master_config(ROUTER_INSTANCE *router, char *error) {
|
||||||
char *master_host;
|
|
||||||
int master_port;
|
|
||||||
char *filestem;
|
|
||||||
char *master_user;
|
|
||||||
char *master_password;
|
|
||||||
char *section = "binlog_configuration";
|
char *section = "binlog_configuration";
|
||||||
FILE *config_file;
|
FILE *config_file;
|
||||||
int rc;
|
int rc;
|
||||||
@ -857,13 +855,6 @@ char tmp_file[PATH_MAX + 1] = "";
|
|||||||
|
|
||||||
strcat(tmp_file, ".tmp");
|
strcat(tmp_file, ".tmp");
|
||||||
|
|
||||||
/* get data from current configuration */
|
|
||||||
master_host = router->service->dbref->server->name;
|
|
||||||
master_port = router->service->dbref->server->port;
|
|
||||||
master_user = router->user;
|
|
||||||
master_password= router->password;
|
|
||||||
filestem = router->fileroot;
|
|
||||||
|
|
||||||
/* open file for writing */
|
/* open file for writing */
|
||||||
config_file = fopen(tmp_file,"wb");
|
config_file = fopen(tmp_file,"wb");
|
||||||
if (config_file == NULL) {
|
if (config_file == NULL) {
|
||||||
@ -880,11 +871,11 @@ char tmp_file[PATH_MAX + 1] = "";
|
|||||||
fprintf(config_file,"[%s]\n", section);
|
fprintf(config_file,"[%s]\n", section);
|
||||||
|
|
||||||
/* write ini file key=value */
|
/* write ini file key=value */
|
||||||
fprintf(config_file,"master_host=%s\n", master_host);
|
fprintf(config_file,"master_host=%s\n", router->service->dbref->server->name);
|
||||||
fprintf(config_file,"master_port=%d\n", master_port);
|
fprintf(config_file,"master_port=%d\n", router->service->dbref->server->port);
|
||||||
fprintf(config_file,"master_user=%s\n", master_user);
|
fprintf(config_file,"master_user=%s\n", router->user);
|
||||||
fprintf(config_file,"master_password=%s\n", master_password);
|
fprintf(config_file,"master_password=%s\n", router->password);
|
||||||
fprintf(config_file,"filestem=%s\n", filestem);
|
fprintf(config_file,"filestem=%s\n", router->fileroot);
|
||||||
|
|
||||||
fclose(config_file);
|
fclose(config_file);
|
||||||
|
|
||||||
|
|||||||
@ -447,7 +447,7 @@ extern char *strcasestr();
|
|||||||
if ((word = strtok_r(NULL, sep, &brkb)) == NULL)
|
if ((word = strtok_r(NULL, sep, &brkb)) == NULL)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
|
||||||
"%s: Expected SHOW MASTER STATUS command",
|
"%s: Expected SHOW SLAVE STATUS command",
|
||||||
router->service->name)));
|
router->service->name)));
|
||||||
}
|
}
|
||||||
else if (strcasecmp(word, "STATUS") == 0)
|
else if (strcasecmp(word, "STATUS") == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user