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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
dd0e3427
Commit
dd0e3427
authored
Oct 23, 2002
by
serg@serg.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0
into serg.mysql.com:/usr/home/serg/Abk/mysql-4.0
parents
17f975b8
b01798b2
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
148 additions
and
17 deletions
+148
-17
Build-tools/Do-compile
Build-tools/Do-compile
+9
-2
sql/item_func.cc
sql/item_func.cc
+16
-2
sql/log.cc
sql/log.cc
+7
-0
sql/log_event.cc
sql/log_event.cc
+61
-0
sql/log_event.h
sql/log_event.h
+35
-1
sql/mysqld.cc
sql/mysqld.cc
+2
-10
sql/sql_class.cc
sql/sql_class.cc
+15
-1
sql/sql_class.h
sql/sql_class.h
+2
-1
sql/sql_parse.cc
sql/sql_parse.cc
+1
-0
No files found.
Build-tools/Do-compile
View file @
dd0e3427
...
@@ -215,7 +215,14 @@ if ($opt_stage <= 1)
...
@@ -215,7 +215,14 @@ if ($opt_stage <= 1)
# Only enable InnoDB when requested (required to be able to
# Only enable InnoDB when requested (required to be able to
# build the "Classic" packages that do not include InnoDB)
# build the "Classic" packages that do not include InnoDB)
$opt_config_options
.=
"
--without-innodb
"
if
(
!
$opt_innodb
);
if
(
$opt_innodb
)
{
$opt_config_options
.=
"
--with-innodb
";
}
else
{
$opt_config_options
.=
"
--without-innodb
";
}
if
(
$opt_with_other_libc
)
if
(
$opt_with_other_libc
)
{
{
...
@@ -314,7 +321,7 @@ if (!$opt_no_test)
...
@@ -314,7 +321,7 @@ if (!$opt_no_test)
}
}
if
(
$opt_innodb
)
if
(
$opt_innodb
)
{
{
$extra
.=
"
--innodb_data_file_path=ibdata1:100M
";
$extra
.=
"
--innodb_data_file_path=ibdata1:100M
:autoextend
";
}
}
safe_system
("
./bin/mysqld --no-defaults --basedir . --datadir ./data --skip-locking
$extra
>>
$log
2>&1 &
");
safe_system
("
./bin/mysqld --no-defaults --basedir . --datadir ./data --skip-locking
$extra
>>
$log
2>&1 &
");
sleep
(
2
);
sleep
(
2
);
...
...
sql/item_func.cc
View file @
dd0e3427
...
@@ -698,17 +698,31 @@ double Item_func_round::val()
...
@@ -698,17 +698,31 @@ double Item_func_round::val()
double
Item_func_rand
::
val
()
double
Item_func_rand
::
val
()
{
{
THD
*
thd
=
current_thd
;
if
(
arg_count
)
if
(
arg_count
)
{
// Only use argument once in query
{
// Only use argument once in query
uint32
tmp
=
(
uint32
)
(
args
[
0
]
->
val_int
());
uint32
tmp
=
(
uint32
)
(
args
[
0
]
->
val_int
());
randominit
(
&
current_
thd
->
rand
,(
uint32
)
(
tmp
*
0x10001L
+
55555555L
),
randominit
(
&
thd
->
rand
,(
uint32
)
(
tmp
*
0x10001L
+
55555555L
),
(
uint32
)
(
tmp
*
0x10000001L
));
(
uint32
)
(
tmp
*
0x10000001L
));
#ifdef DELETE_ITEMS
#ifdef DELETE_ITEMS
delete
args
[
0
];
delete
args
[
0
];
#endif
#endif
arg_count
=
0
;
arg_count
=
0
;
}
}
return
rnd
(
&
current_thd
->
rand
);
else
if
(
0
)
//!thd->rand_used)
{
// no need to send a Rand log event if seed was given eg: RAND(seed),
// as it will be replicated in the query as such.
// save the seed only the first time RAND() is used in the query
// once events are forwarded rather than recreated,
// the following can be skipped if inside the slave thread
thd
->
rand_used
=
1
;
thd
->
rand_saved_seed1
=
thd
->
rand
.
seed1
;
thd
->
rand_saved_seed2
=
thd
->
rand
.
seed2
;
}
return
rnd
(
&
thd
->
rand
);
}
}
longlong
Item_func_sign
::
val_int
()
longlong
Item_func_sign
::
val_int
()
...
...
sql/log.cc
View file @
dd0e3427
...
@@ -1066,6 +1066,13 @@ bool MYSQL_LOG::write(Log_event* event_info)
...
@@ -1066,6 +1066,13 @@ bool MYSQL_LOG::write(Log_event* event_info)
if
(
e
.
write
(
file
))
if
(
e
.
write
(
file
))
goto
err
;
goto
err
;
}
}
if
(
thd
&&
thd
->
rand_used
)
{
Rand_log_event
e
(
thd
,
thd
->
rand_saved_seed1
,
thd
->
rand_saved_seed2
);
e
.
set_log_pos
(
this
);
if
(
e
.
write
(
file
))
goto
err
;
}
if
(
thd
&&
thd
->
variables
.
convert_set
)
if
(
thd
&&
thd
->
variables
.
convert_set
)
{
{
char
buf
[
1024
]
=
"SET CHARACTER SET "
;
char
buf
[
1024
]
=
"SET CHARACTER SET "
;
...
...
sql/log_event.cc
View file @
dd0e3427
...
@@ -348,6 +348,18 @@ void Intvar_log_event::pack_info(String* packet)
...
@@ -348,6 +348,18 @@ void Intvar_log_event::pack_info(String* packet)
net_store_data
(
packet
,
tmp
.
ptr
(),
tmp
.
length
());
net_store_data
(
packet
,
tmp
.
ptr
(),
tmp
.
length
());
}
}
void
Rand_log_event
::
pack_info
(
String
*
packet
)
{
char
buf1
[
256
],
buf
[
22
];
String
tmp
(
buf1
,
sizeof
(
buf1
));
tmp
.
length
(
0
);
tmp
.
append
(
"randseed1="
);
tmp
.
append
(
llstr
(
seed1
,
buf
));
tmp
.
append
(
",randseed2="
);
tmp
.
append
(
llstr
(
seed2
,
buf
));
net_store_data
(
packet
,
tmp
.
ptr
(),
tmp
.
length
());
}
void
Slave_log_event
::
pack_info
(
String
*
packet
)
void
Slave_log_event
::
pack_info
(
String
*
packet
)
{
{
char
buf1
[
256
],
buf
[
22
],
*
end
;
char
buf1
[
256
],
buf
[
22
],
*
end
;
...
@@ -376,6 +388,9 @@ void Log_event::init_show_field_list(List<Item>* field_list)
...
@@ -376,6 +388,9 @@ void Log_event::init_show_field_list(List<Item>* field_list)
field_list
->
push_back
(
new
Item_empty_string
(
"Info"
,
20
));
field_list
->
push_back
(
new
Item_empty_string
(
"Info"
,
20
));
}
}
/*
* only called by SHOW BINLOG EVENTS
*/
int
Log_event
::
net_send
(
THD
*
thd
,
const
char
*
log_name
,
my_off_t
pos
)
int
Log_event
::
net_send
(
THD
*
thd
,
const
char
*
log_name
,
my_off_t
pos
)
{
{
String
*
packet
=
&
thd
->
packet
;
String
*
packet
=
&
thd
->
packet
;
...
@@ -610,6 +625,9 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len,
...
@@ -610,6 +625,9 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len,
case
INTVAR_EVENT
:
case
INTVAR_EVENT
:
ev
=
new
Intvar_log_event
(
buf
,
old_format
);
ev
=
new
Intvar_log_event
(
buf
,
old_format
);
break
;
break
;
case
RAND_EVENT
:
ev
=
new
Rand_log_event
(
buf
,
old_format
);
break
;
default:
default:
break
;
break
;
}
}
...
@@ -915,6 +933,41 @@ void Intvar_log_event::print(FILE* file, bool short_form, char* last_db)
...
@@ -915,6 +933,41 @@ void Intvar_log_event::print(FILE* file, bool short_form, char* last_db)
}
}
#endif
#endif
/*****************************************************************************
*
* Rand log event
*
****************************************************************************/
Rand_log_event
::
Rand_log_event
(
const
char
*
buf
,
bool
old_format
)
:
Log_event
(
buf
,
old_format
)
{
buf
+=
(
old_format
)
?
OLD_HEADER_LEN
:
LOG_EVENT_HEADER_LEN
;
seed1
=
uint8korr
(
buf
+
RAND_SEED1_OFFSET
);
seed2
=
uint8korr
(
buf
+
RAND_SEED2_OFFSET
);
}
int
Rand_log_event
::
write_data
(
IO_CACHE
*
file
)
{
char
buf
[
16
];
int8store
(
buf
+
RAND_SEED1_OFFSET
,
seed1
);
int8store
(
buf
+
RAND_SEED2_OFFSET
,
seed2
);
return
my_b_safe_write
(
file
,
(
byte
*
)
buf
,
sizeof
(
buf
));
}
#ifdef MYSQL_CLIENT
void
Rand_log_event
::
print
(
FILE
*
file
,
bool
short_form
,
char
*
last_db
)
{
char
llbuff
[
22
];
if
(
!
short_form
)
{
print_header
(
file
);
fprintf
(
file
,
"
\t
Rand
\n
"
);
}
fprintf
(
file
,
"SET RAND SEED1=%s;
\n
"
,
llstr
(
seed1
,
llbuff
));
fprintf
(
file
,
"SET RAND SEED2=%s;
\n
"
,
llstr
(
seed2
,
llbuff
));
fflush
(
file
);
}
#endif
int
Load_log_event
::
write_data_header
(
IO_CACHE
*
file
)
int
Load_log_event
::
write_data_header
(
IO_CACHE
*
file
)
{
{
...
@@ -1910,6 +1963,14 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
...
@@ -1910,6 +1963,14 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
return
0
;
return
0
;
}
}
int
Rand_log_event
::
exec_event
(
struct
st_relay_log_info
*
rli
)
{
thd
->
rand
.
seed1
=
seed1
;
thd
->
rand
.
seed2
=
seed2
;
rli
->
inc_pending
(
get_event_len
());
return
0
;
}
int
Slave_log_event
::
exec_event
(
struct
st_relay_log_info
*
rli
)
int
Slave_log_event
::
exec_event
(
struct
st_relay_log_info
*
rli
)
{
{
if
(
mysql_bin_log
.
is_open
())
if
(
mysql_bin_log
.
is_open
())
...
...
sql/log_event.h
View file @
dd0e3427
...
@@ -152,6 +152,11 @@ struct sql_ex_info
...
@@ -152,6 +152,11 @@ struct sql_ex_info
#define I_TYPE_OFFSET 0
#define I_TYPE_OFFSET 0
#define I_VAL_OFFSET 1
#define I_VAL_OFFSET 1
/* Rand event post-header */
#define RAND_SEED1_OFFSET 0
#define RAND_SEED2_OFFSET 8
/* Load event post-header */
/* Load event post-header */
#define L_THREAD_ID_OFFSET 0
#define L_THREAD_ID_OFFSET 0
...
@@ -199,7 +204,7 @@ enum Log_event_type
...
@@ -199,7 +204,7 @@ enum Log_event_type
START_EVENT
=
1
,
QUERY_EVENT
=
2
,
STOP_EVENT
=
3
,
ROTATE_EVENT
=
4
,
START_EVENT
=
1
,
QUERY_EVENT
=
2
,
STOP_EVENT
=
3
,
ROTATE_EVENT
=
4
,
INTVAR_EVENT
=
5
,
LOAD_EVENT
=
6
,
SLAVE_EVENT
=
7
,
CREATE_FILE_EVENT
=
8
,
INTVAR_EVENT
=
5
,
LOAD_EVENT
=
6
,
SLAVE_EVENT
=
7
,
CREATE_FILE_EVENT
=
8
,
APPEND_BLOCK_EVENT
=
9
,
EXEC_LOAD_EVENT
=
10
,
DELETE_FILE_EVENT
=
11
,
APPEND_BLOCK_EVENT
=
9
,
EXEC_LOAD_EVENT
=
10
,
DELETE_FILE_EVENT
=
11
,
NEW_LOAD_EVENT
=
12
NEW_LOAD_EVENT
=
12
,
RAND_EVENT
=
13
};
};
enum
Int_event_type
enum
Int_event_type
...
@@ -497,6 +502,35 @@ public:
...
@@ -497,6 +502,35 @@ public:
bool
is_valid
()
{
return
1
;
}
bool
is_valid
()
{
return
1
;
}
};
};
/*****************************************************************************
*
* Rand log event class
*
****************************************************************************/
class
Rand_log_event
:
public
Log_event
{
public:
ulonglong
seed1
;
ulonglong
seed2
;
#ifndef MYSQL_CLIENT
Rand_log_event
(
THD
*
thd_arg
,
ulonglong
seed1_arg
,
ulonglong
seed2_arg
)
:
Log_event
(
thd_arg
),
seed1
(
seed1_arg
),
seed2
(
seed2_arg
)
{}
void
pack_info
(
String
*
packet
);
int
exec_event
(
struct
st_relay_log_info
*
rli
);
#else
void
print
(
FILE
*
file
,
bool
short_form
=
0
,
char
*
last_db
=
0
);
#endif
Rand_log_event
(
const
char
*
buf
,
bool
old_format
);
~
Rand_log_event
()
{}
Log_event_type
get_type_code
()
{
return
RAND_EVENT
;}
int
get_data_size
()
{
return
sizeof
(
ulonglong
)
*
2
;
}
int
write_data
(
IO_CACHE
*
file
);
bool
is_valid
()
{
return
1
;
}
};
class
Stop_log_event
:
public
Log_event
class
Stop_log_event
:
public
Log_event
{
{
...
...
sql/mysqld.cc
View file @
dd0e3427
...
@@ -288,7 +288,7 @@ int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice
...
@@ -288,7 +288,7 @@ int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice
*/
*/
static
bool
kill_in_progress
=
FALSE
;
static
bool
kill_in_progress
=
FALSE
;
st
atic
struct
rand_struct
sql_rand
;
st
ruct
rand_struct
sql_rand
;
// used by sql_class.cc:THD::THD()
static
int
cleanup_done
;
static
int
cleanup_done
;
static
char
**
defaults_argv
;
static
char
**
defaults_argv
;
char
glob_hostname
[
FN_REFLEN
];
char
glob_hostname
[
FN_REFLEN
];
...
@@ -2423,15 +2423,7 @@ static void create_new_thread(THD *thd)
...
@@ -2423,15 +2423,7 @@ static void create_new_thread(THD *thd)
for
(
uint
i
=
0
;
i
<
8
;
i
++
)
// Generate password teststring
for
(
uint
i
=
0
;
i
<
8
;
i
++
)
// Generate password teststring
thd
->
scramble
[
i
]
=
(
char
)
(
rnd
(
&
sql_rand
)
*
94
+
33
);
thd
->
scramble
[
i
]
=
(
char
)
(
rnd
(
&
sql_rand
)
*
94
+
33
);
thd
->
scramble
[
8
]
=
0
;
thd
->
scramble
[
8
]
=
0
;
/*
We need good random number initialization for new thread
Just coping global one will not work
*/
{
ulong
tmp
=
(
ulong
)
(
rnd
(
&
sql_rand
)
*
3000000
);
randominit
(
&
(
thd
->
rand
),
tmp
+
(
ulong
)
start_time
,
tmp
+
(
ulong
)
thread_id
);
}
thd
->
real_id
=
pthread_self
();
// Keep purify happy
thd
->
real_id
=
pthread_self
();
// Keep purify happy
/* Start a new thread to handle connection */
/* Start a new thread to handle connection */
...
...
sql/sql_class.cc
View file @
dd0e3427
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
#include <mysys_err.h>
#include <mysys_err.h>
#include <assert.h>
#include <assert.h>
extern
struct
rand_struct
sql_rand
;
/*****************************************************************************
/*****************************************************************************
** Instansiate templates
** Instansiate templates
*****************************************************************************/
*****************************************************************************/
...
@@ -78,7 +80,7 @@ static void free_var(user_var_entry *entry)
...
@@ -78,7 +80,7 @@ static void free_var(user_var_entry *entry)
****************************************************************************/
****************************************************************************/
THD
::
THD
()
:
user_time
(
0
),
fatal_error
(
0
),
last_insert_id_used
(
0
),
THD
::
THD
()
:
user_time
(
0
),
fatal_error
(
0
),
last_insert_id_used
(
0
),
insert_id_used
(
0
),
in_lock_tables
(
0
),
insert_id_used
(
0
),
rand_used
(
0
),
in_lock_tables
(
0
),
global_read_lock
(
0
),
bootstrap
(
0
)
global_read_lock
(
0
),
bootstrap
(
0
)
{
{
host
=
user
=
priv_user
=
db
=
query
=
ip
=
0
;
host
=
user
=
priv_user
=
db
=
query
=
ip
=
0
;
...
@@ -158,6 +160,18 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
...
@@ -158,6 +160,18 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
transaction
.
trans_log
.
end_of_file
=
max_binlog_cache_size
;
transaction
.
trans_log
.
end_of_file
=
max_binlog_cache_size
;
}
}
#endif
#endif
/*
We need good random number initialization for new thread
Just coping global one will not work
*/
{
pthread_mutex_lock
(
&
LOCK_thread_count
);
ulong
tmp
=
(
ulong
)
(
rnd
(
&
sql_rand
)
*
3000000
);
randominit
(
&
rand
,
tmp
+
(
ulong
)
start_time
,
tmp
+
(
ulong
)
thread_id
);
pthread_mutex_unlock
(
&
LOCK_thread_count
);
}
}
}
/* Do operations that may take a long time */
/* Do operations that may take a long time */
...
...
sql/sql_class.h
View file @
dd0e3427
...
@@ -432,7 +432,8 @@ public:
...
@@ -432,7 +432,8 @@ public:
bool
slave_thread
;
bool
slave_thread
;
bool
set_query_id
,
locked
,
count_cuted_fields
,
some_tables_deleted
;
bool
set_query_id
,
locked
,
count_cuted_fields
,
some_tables_deleted
;
bool
no_errors
,
allow_sum_func
,
password
,
fatal_error
;
bool
no_errors
,
allow_sum_func
,
password
,
fatal_error
;
bool
query_start_used
,
last_insert_id_used
,
insert_id_used
;
bool
query_start_used
,
last_insert_id_used
,
insert_id_used
,
rand_used
;
ulonglong
rand_saved_seed1
,
rand_saved_seed2
;
bool
system_thread
,
in_lock_tables
,
global_read_lock
;
bool
system_thread
,
in_lock_tables
,
global_read_lock
;
bool
query_error
,
bootstrap
,
cleanup_done
;
bool
query_error
,
bootstrap
,
cleanup_done
;
bool
safe_to_cache_query
;
bool
safe_to_cache_query
;
...
...
sql/sql_parse.cc
View file @
dd0e3427
...
@@ -2724,6 +2724,7 @@ mysql_init_query(THD *thd)
...
@@ -2724,6 +2724,7 @@ mysql_init_query(THD *thd)
thd
->
fatal_error
=
0
;
// Safety
thd
->
fatal_error
=
0
;
// Safety
thd
->
last_insert_id_used
=
thd
->
query_start_used
=
thd
->
insert_id_used
=
0
;
thd
->
last_insert_id_used
=
thd
->
query_start_used
=
thd
->
insert_id_used
=
0
;
thd
->
sent_row_count
=
thd
->
examined_row_count
=
0
;
thd
->
sent_row_count
=
thd
->
examined_row_count
=
0
;
thd
->
rand_used
=
0
;
thd
->
safe_to_cache_query
=
1
;
thd
->
safe_to_cache_query
=
1
;
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
...
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