Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
3cf81022
Commit
3cf81022
authored
Dec 09, 2000
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed up leaks found by --exit-info=256
better error diagnostic in SLAVE START
parent
b36c387f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
16 deletions
+67
-16
sql/mini_client.cc
sql/mini_client.cc
+4
-1
sql/mysqld.cc
sql/mysqld.cc
+1
-0
sql/slave.cc
sql/slave.cc
+44
-1
sql/slave.h
sql/slave.h
+2
-1
sql/sql_class.cc
sql/sql_class.cc
+1
-1
sql/sql_repl.cc
sql/sql_repl.cc
+15
-12
No files found.
sql/mini_client.cc
View file @
3cf81022
...
...
@@ -386,7 +386,10 @@ my_bool STDCALL mc_mysql_reconnect(MYSQL *mysql)
if
(
!
mc_mysql_connect
(
&
tmp_mysql
,
mysql
->
host
,
mysql
->
user
,
mysql
->
passwd
,
mysql
->
db
,
mysql
->
port
,
mysql
->
unix_socket
,
mysql
->
client_flag
))
DBUG_RETURN
(
1
);
{
mc_mysql_close
(
&
tmp_mysql
);
DBUG_RETURN
(
1
);
}
tmp_mysql
.
free_me
=
mysql
->
free_me
;
mysql
->
free_me
=
0
;
bzero
((
char
*
)
&
mysql
->
options
,
sizeof
(
&
mysql
->
options
));
...
...
sql/mysqld.cc
View file @
3cf81022
...
...
@@ -614,6 +614,7 @@ void clean_up(void)
#ifndef __WIN__
(
void
)
my_delete
(
pidfile_name
,
MYF
(
0
));
// This may not always exist
#endif
end_slave
();
my_thread_end
();
/* Tell main we are ready */
...
...
sql/slave.cc
View file @
3cf81022
...
...
@@ -167,6 +167,30 @@ int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec)
return
0
;
}
static
void
free_string_array
(
DYNAMIC_ARRAY
*
a
)
{
uint
i
;
for
(
i
=
0
;
i
<
a
->
elements
;
i
++
)
{
char
*
p
;
get_dynamic
(
a
,
(
gptr
)
&
p
,
i
);
my_free
(
p
,
MYF
(
MY_WME
));
}
delete_dynamic
(
a
);
}
void
end_slave
()
{
end_master_info
(
&
glob_mi
);
if
(
do_table_inited
)
hash_free
(
&
replicate_do_table
);
if
(
ignore_table_inited
)
hash_free
(
&
replicate_ignore_table
);
if
(
wild_do_table_inited
)
free_string_array
(
&
replicate_wild_do_table
);
if
(
wild_ignore_table_inited
)
free_string_array
(
&
replicate_wild_ignore_table
);
}
static
inline
bool
slave_killed
(
THD
*
thd
)
{
...
...
@@ -398,8 +422,21 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi)
return
error
;
}
void
end_master_info
(
MASTER_INFO
*
mi
)
{
if
(
mi
->
fd
>=
0
)
{
end_io_cache
(
&
mi
->
file
);
(
void
)
my_close
(
mi
->
fd
,
MYF
(
MY_WME
));
mi
->
fd
=
-
1
;
}
mi
->
inited
=
0
;
}
int
init_master_info
(
MASTER_INFO
*
mi
)
{
if
(
mi
->
inited
)
return
0
;
int
fd
;
MY_STAT
stat_area
;
char
fname
[
FN_REFLEN
+
128
];
...
...
@@ -440,7 +477,7 @@ int init_master_info(MASTER_INFO* mi)
mi
->
connect_retry
=
master_connect_retry
;
}
else
else
// file exists
{
if
(
fd
>=
0
)
reinit_io_cache
(
&
mi
->
file
,
READ_CACHE
,
0L
,
0
,
0
);
...
...
@@ -897,8 +934,11 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
sql_print_error
(
"Slave: error '%s' running load data infile "
,
ER
(
sql_error
));
delete
ev
;
free_root
(
&
thd
->
mem_root
,
0
);
return
1
;
}
free_root
(
&
thd
->
mem_root
,
0
);
delete
ev
;
if
(
thd
->
fatal_error
)
...
...
@@ -932,6 +972,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
mi
->
log_file_name
[
ident_len
]
=
0
;
mi
->
pos
=
4
;
// skip magic number
flush_master_info
(
mi
);
delete
ev
;
break
;
}
...
...
@@ -950,6 +991,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
}
mi
->
inc_pending
(
event_len
);
delete
ev
;
break
;
}
}
...
...
@@ -1157,6 +1199,7 @@ position %ld",
thd
->
temporary_tables
=
0
;
// remove tempation from destructor to close them
pthread_cond_broadcast
(
&
COND_slave_stopped
);
// tell the world we are done
pthread_mutex_unlock
(
&
LOCK_slave
);
net_end
(
&
thd
->
net
);
// destructor will not free it, because we are weird
delete
thd
;
my_thread_end
();
pthread_exit
(
0
);
...
...
sql/slave.h
View file @
3cf81022
...
...
@@ -26,7 +26,6 @@ typedef struct st_master_info
{
pthread_mutex_destroy
(
&
lock
);
}
inline
void
inc_pending
(
ulonglong
val
)
{
pending
+=
val
;
...
...
@@ -81,7 +80,9 @@ int add_wild_table_rule(DYNAMIC_ARRAY* a, const char* table_spec);
void
init_table_rule_hash
(
HASH
*
h
,
bool
*
h_inited
);
void
init_table_rule_array
(
DYNAMIC_ARRAY
*
a
,
bool
*
a_inited
);
void
end_slave
();
// clean up
int
init_master_info
(
MASTER_INFO
*
mi
);
void
end_master_info
(
MASTER_INFO
*
mi
);
extern
bool
opt_log_slave_updates
;
pthread_handler_decl
(
handle_slave
,
arg
);
extern
bool
volatile
abort_loop
,
abort_slave
;
...
...
sql/sql_class.cc
View file @
3cf81022
...
...
@@ -139,7 +139,7 @@ THD::~THD()
if
(
net
.
vio
)
{
vio_delete
(
net
.
vio
);
net_end
(
&
net
);
net_end
(
&
net
);
}
ha_rollback
(
this
);
if
(
locked_tables
)
...
...
sql/sql_repl.cc
View file @
3cf81022
...
...
@@ -503,17 +503,20 @@ int start_slave(THD* thd , bool net_report)
return
1
;
pthread_mutex_lock
(
&
LOCK_slave
);
if
(
!
slave_running
)
if
(
glob_mi
.
inited
&&
glob_mi
.
host
&&
server_id_supplied
)
{
pthread_t
hThread
;
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_slave
,
0
))
{
err
=
"cannot create slave thread"
;
}
}
else
err
=
"Master host not set, master info not initialized, or server id \
not configured"
;
{
if
(
init_master_info
(
&
glob_mi
))
err
=
"Could not initialize master info"
;
else
if
(
server_id_supplied
&&
*
glob_mi
.
host
)
{
pthread_t
hThread
;
if
(
pthread_create
(
&
hThread
,
&
connection_attrib
,
handle_slave
,
0
))
{
err
=
"cannot create slave thread"
;
}
}
else
err
=
"Master host not set, or server id not configured"
;
}
else
err
=
"Slave already running"
;
...
...
@@ -578,7 +581,7 @@ void reset_slave()
if
(
my_stat
(
fname
,
&
stat_area
,
MYF
(
0
)))
if
(
my_delete
(
fname
,
MYF
(
MY_WME
)))
return
;
end_master_info
(
&
glob_mi
);
if
(
slave_was_running
)
start_slave
(
0
,
0
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment