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
ab632586
Commit
ab632586
authored
Jul 11, 2001
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0
into mysql.sashanet.com:/home/sasha/src/bk/mysql-4.0
parents
02278726
77e2af48
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
21 deletions
+35
-21
client/mysqltest.c
client/mysqltest.c
+16
-10
sql/log.cc
sql/log.cc
+11
-10
sql/mysqld.cc
sql/mysqld.cc
+7
-0
sql/sql_class.h
sql/sql_class.h
+1
-1
No files found.
client/mysqltest.c
View file @
ab632586
...
@@ -207,7 +207,7 @@ static void die(const char* fmt, ...);
...
@@ -207,7 +207,7 @@ static void die(const char* fmt, ...);
static
void
init_var_hash
();
static
void
init_var_hash
();
static
byte
*
get_var_key
(
const
byte
*
rec
,
uint
*
len
,
static
byte
*
get_var_key
(
const
byte
*
rec
,
uint
*
len
,
my_bool
__attribute__
((
unused
))
t
);
my_bool
__attribute__
((
unused
))
t
);
static
VAR
*
var_init
(
const
char
*
name
,
int
name_len
,
const
char
*
val
,
static
VAR
*
var_init
(
VAR
*
v
,
const
char
*
name
,
int
name_len
,
const
char
*
val
,
int
val_len
);
int
val_len
);
static
void
var_free
(
void
*
v
);
static
void
var_free
(
void
*
v
);
...
@@ -529,7 +529,7 @@ static VAR* var_obtain(char* name, int len)
...
@@ -529,7 +529,7 @@ static VAR* var_obtain(char* name, int len)
VAR
*
v
;
VAR
*
v
;
if
((
v
=
(
VAR
*
)
hash_search
(
&
var_hash
,
name
,
len
)))
if
((
v
=
(
VAR
*
)
hash_search
(
&
var_hash
,
name
,
len
)))
return
v
;
return
v
;
v
=
var_init
(
name
,
len
,
""
,
0
);
v
=
var_init
(
0
,
name
,
len
,
""
,
0
);
hash_insert
(
&
var_hash
,
(
byte
*
)
v
);
hash_insert
(
&
var_hash
,
(
byte
*
)
v
);
return
v
;
return
v
;
}
}
...
@@ -678,6 +678,7 @@ int do_system(struct st_query* q)
...
@@ -678,6 +678,7 @@ int do_system(struct st_query* q)
{
{
char
*
p
=
q
->
first_argument
;
char
*
p
=
q
->
first_argument
;
VAR
v
;
VAR
v
;
var_init
(
&
v
,
0
,
0
,
0
,
0
);
eval_expr
(
&
v
,
p
,
0
);
/* NULL terminated */
eval_expr
(
&
v
,
p
,
0
);
/* NULL terminated */
if
(
v
.
str_val_len
)
if
(
v
.
str_val_len
)
{
{
...
@@ -697,6 +698,7 @@ int do_echo(struct st_query* q)
...
@@ -697,6 +698,7 @@ int do_echo(struct st_query* q)
{
{
char
*
p
=
q
->
first_argument
;
char
*
p
=
q
->
first_argument
;
VAR
v
;
VAR
v
;
var_init
(
&
v
,
0
,
0
,
0
,
0
);
eval_expr
(
&
v
,
p
,
0
);
/* NULL terminated */
eval_expr
(
&
v
,
p
,
0
);
/* NULL terminated */
if
(
v
.
str_val_len
)
if
(
v
.
str_val_len
)
{
{
...
@@ -1172,6 +1174,7 @@ int do_while(struct st_query* q)
...
@@ -1172,6 +1174,7 @@ int do_while(struct st_query* q)
char
*
p
=
q
->
first_argument
;
char
*
p
=
q
->
first_argument
;
const
char
*
expr_start
,
*
expr_end
;
const
char
*
expr_start
,
*
expr_end
;
VAR
v
;
VAR
v
;
var_init
(
&
v
,
0
,
0
,
0
,
0
);
if
(
cur_block
==
block_stack_end
)
if
(
cur_block
==
block_stack_end
)
die
(
"Nesting too deeply"
);
die
(
"Nesting too deeply"
);
if
(
!*
block_ok
)
if
(
!*
block_ok
)
...
@@ -1837,29 +1840,32 @@ static byte* get_var_key(const byte* var, uint* len,
...
@@ -1837,29 +1840,32 @@ static byte* get_var_key(const byte* var, uint* len,
return
(
byte
*
)
key
;
return
(
byte
*
)
key
;
}
}
static
VAR
*
var_init
(
const
char
*
name
,
int
name_len
,
const
char
*
val
,
static
VAR
*
var_init
(
VAR
*
v
,
const
char
*
name
,
int
name_len
,
const
char
*
val
,
int
val_len
)
int
val_len
)
{
{
int
val_alloc_len
;
int
val_alloc_len
;
VAR
*
tmp_var
;
VAR
*
tmp_var
;
if
(
!
name_len
)
if
(
!
name_len
&&
name
)
name_len
=
strlen
(
name
);
name_len
=
strlen
(
name
);
if
(
!
val_len
)
if
(
!
val_len
&&
val
)
val_len
=
strlen
(
val
)
;
val_len
=
strlen
(
val
)
;
val_alloc_len
=
val_len
+
16
;
/* room to grow */
val_alloc_len
=
val_len
+
16
;
/* room to grow */
if
(
!
(
tmp_var
=
(
VAR
*
)
my_malloc
(
sizeof
(
*
tmp_var
)
if
(
!
(
tmp_var
=
v
)
&&
!
(
tmp_var
=
(
VAR
*
)
my_malloc
(
sizeof
(
*
tmp_var
)
+
name_len
,
MYF
(
MY_WME
))))
+
name_len
,
MYF
(
MY_WME
))))
die
(
"Out of memory"
);
die
(
"Out of memory"
);
tmp_var
->
name
=
(
char
*
)
tmp_var
+
sizeof
(
*
tmp_var
);
tmp_var
->
name
=
(
name
)
?
(
char
*
)
tmp_var
+
sizeof
(
*
tmp_var
)
:
0
;
if
(
!
(
tmp_var
->
str_val
=
my_malloc
(
val_alloc_len
,
MYF
(
MY_WME
))))
if
(
!
(
tmp_var
->
str_val
=
my_malloc
(
val_alloc_len
,
MYF
(
MY_WME
))))
die
(
"Out of memory"
);
die
(
"Out of memory"
);
memcpy
(
tmp_var
->
name
,
name
,
name_len
);
memcpy
(
tmp_var
->
name
,
name
,
name_len
);
if
(
val
)
memcpy
(
tmp_var
->
str_val
,
val
,
val_len
+
1
);
memcpy
(
tmp_var
->
str_val
,
val
,
val_len
+
1
);
tmp_var
->
name_len
=
name_len
;
tmp_var
->
name_len
=
name_len
;
tmp_var
->
str_val_len
=
val_len
;
tmp_var
->
str_val_len
=
val_len
;
tmp_var
->
alloced_len
=
val_alloc_len
;
tmp_var
->
alloced_len
=
val_alloc_len
;
tmp_var
->
int_val
=
atoi
(
val
)
;
tmp_var
->
int_val
=
(
val
)
?
atoi
(
val
)
:
0
;
tmp_var
->
int_dirty
=
0
;
tmp_var
->
int_dirty
=
0
;
return
tmp_var
;
return
tmp_var
;
}
}
...
@@ -1878,7 +1884,7 @@ static void var_from_env(const char* name, const char* def_val)
...
@@ -1878,7 +1884,7 @@ static void var_from_env(const char* name, const char* def_val)
if
(
!
(
tmp
=
getenv
(
name
)))
if
(
!
(
tmp
=
getenv
(
name
)))
tmp
=
def_val
;
tmp
=
def_val
;
v
=
var_init
(
name
,
0
,
tmp
,
0
);
v
=
var_init
(
0
,
name
,
0
,
tmp
,
0
);
hash_insert
(
&
var_hash
,
(
byte
*
)
v
);
hash_insert
(
&
var_hash
,
(
byte
*
)
v
);
}
}
...
...
sql/log.cc
View file @
ab632586
...
@@ -514,16 +514,18 @@ bool MYSQL_LOG::is_active(const char* log_file_name)
...
@@ -514,16 +514,18 @@ bool MYSQL_LOG::is_active(const char* log_file_name)
return
inited
&&
!
strcmp
(
log_file_name
,
this
->
log_file_name
);
return
inited
&&
!
strcmp
(
log_file_name
,
this
->
log_file_name
);
}
}
void
MYSQL_LOG
::
new_file
()
void
MYSQL_LOG
::
new_file
(
bool
inside_mutex
)
{
{
// only rotate open logs that are marked non-rotatable
// only rotate open logs that are marked non-rotatable
// (binlog with constant name are non-rotatable)
// (binlog with constant name are non-rotatable)
if
(
is_open
()
&&
!
no_rotate
)
if
(
is_open
()
&&
!
no_rotate
)
{
{
char
new_name
[
FN_REFLEN
],
*
old_name
=
name
;
char
new_name
[
FN_REFLEN
],
*
old_name
=
name
;
if
(
!
inside_mutex
)
VOID
(
pthread_mutex_lock
(
&
LOCK_log
));
VOID
(
pthread_mutex_lock
(
&
LOCK_log
));
if
(
generate_new_name
(
new_name
,
name
))
if
(
generate_new_name
(
new_name
,
name
))
{
{
if
(
!
inside_mutex
)
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
return
;
// Something went wrong
return
;
// Something went wrong
}
}
...
@@ -551,6 +553,7 @@ void MYSQL_LOG::new_file()
...
@@ -551,6 +553,7 @@ void MYSQL_LOG::new_file()
my_free
(
old_name
,
MYF
(
0
));
my_free
(
old_name
,
MYF
(
0
));
last_time
=
query_start
=
0
;
last_time
=
query_start
=
0
;
write_error
=
0
;
write_error
=
0
;
if
(
!
inside_mutex
)
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
}
}
}
}
...
@@ -729,9 +732,9 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
...
@@ -729,9 +732,9 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
if
(
file
==
&
log_file
)
if
(
file
==
&
log_file
)
VOID
(
pthread_cond_broadcast
(
&
COND_binlog_update
));
VOID
(
pthread_cond_broadcast
(
&
COND_binlog_update
));
}
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
if
(
should_rotate
)
if
(
should_rotate
)
new_file
();
new_file
(
1
);
// inside mutex
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
return
error
;
return
error
;
}
}
...
@@ -817,12 +820,10 @@ bool MYSQL_LOG::write(Load_log_event* event_info)
...
@@ -817,12 +820,10 @@ bool MYSQL_LOG::write(Load_log_event* event_info)
VOID
(
pthread_cond_broadcast
(
&
COND_binlog_update
));
VOID
(
pthread_cond_broadcast
(
&
COND_binlog_update
));
}
}
}
}
if
(
should_rotate
)
new_file
(
1
);
// inside mutex
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_log
));
}
}
if
(
should_rotate
)
new_file
();
return
error
;
return
error
;
}
}
...
...
sql/mysqld.cc
View file @
ab632586
...
@@ -1498,6 +1498,13 @@ static void open_log(MYSQL_LOG *log, const char *hostname,
...
@@ -1498,6 +1498,13 @@ static void open_log(MYSQL_LOG *log, const char *hostname,
strmov
(
strcend
(
tmp
,
'.'
),
extension
);
strmov
(
strcend
(
tmp
,
'.'
),
extension
);
opt_name
=
tmp
;
opt_name
=
tmp
;
}
}
// get rid of extention if the log is binary to avoid problems
if
(
type
==
LOG_BIN
)
{
char
*
p
=
strrchr
(
opt_name
,
FN_EXTCHAR
);
if
(
p
)
*
p
=
0
;
}
log
->
open
(
opt_name
,
type
);
log
->
open
(
opt_name
,
type
);
}
}
...
...
sql/sql_class.h
View file @
ab632586
...
@@ -80,7 +80,7 @@ class MYSQL_LOG {
...
@@ -80,7 +80,7 @@ class MYSQL_LOG {
void
init
(
enum_log_type
log_type_arg
);
void
init
(
enum_log_type
log_type_arg
);
void
open
(
const
char
*
log_name
,
enum_log_type
log_type
,
void
open
(
const
char
*
log_name
,
enum_log_type
log_type
,
const
char
*
new_name
=
0
);
const
char
*
new_name
=
0
);
void
new_file
(
void
);
void
new_file
(
bool
inside_mutex
=
0
);
bool
open_index
(
int
options
);
bool
open_index
(
int
options
);
void
close_index
();
void
close_index
();
bool
write
(
THD
*
thd
,
enum
enum_server_command
command
,
const
char
*
format
,...);
bool
write
(
THD
*
thd
,
enum
enum_server_command
command
,
const
char
*
format
,...);
...
...
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