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
4157d12d
Commit
4157d12d
authored
Nov 07, 2001
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added missing mysqlbinlog to binary distributions.
Applied patch to mysqlhotcopy
parent
65d4c846
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
14 deletions
+108
-14
myisam/mi_open.c
myisam/mi_open.c
+4
-2
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+1
-0
scripts/make_binary_distribution.sh
scripts/make_binary_distribution.sh
+1
-1
scripts/mysqlhotcopy.sh
scripts/mysqlhotcopy.sh
+101
-10
sql/item_timefunc.cc
sql/item_timefunc.cc
+1
-1
No files found.
myisam/mi_open.c
View file @
4157d12d
...
@@ -292,15 +292,16 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
...
@@ -292,15 +292,16 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
}
}
}
}
}
if
(
share
->
keyinfo
[
i
].
flag
&
HA_FULLTEXT
)
/* SerG */
if
(
share
->
keyinfo
[
i
].
flag
&
HA_FULLTEXT
)
{
{
share
->
keyinfo
[
i
].
seg
=
pos
-
FT_SEGS
;
/* SerG */
share
->
keyinfo
[
i
].
seg
=
pos
-
FT_SEGS
;
share
->
fulltext_index
=
1
;
share
->
fulltext_index
=
1
;
}
}
share
->
keyinfo
[
i
].
end
=
pos
;
share
->
keyinfo
[
i
].
end
=
pos
;
pos
->
type
=
HA_KEYTYPE_END
;
/* End */
pos
->
type
=
HA_KEYTYPE_END
;
/* End */
pos
->
length
=
share
->
base
.
rec_reflength
;
pos
->
length
=
share
->
base
.
rec_reflength
;
pos
->
null_bit
=
0
;
pos
->
null_bit
=
0
;
pos
->
flag
=
0
;
/* For purify */
pos
++
;
pos
++
;
}
}
for
(
i
=
0
;
i
<
uniques
;
i
++
)
for
(
i
=
0
;
i
<
uniques
;
i
++
)
...
@@ -324,6 +325,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
...
@@ -324,6 +325,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share
->
uniqueinfo
[
i
].
end
=
pos
;
share
->
uniqueinfo
[
i
].
end
=
pos
;
pos
->
type
=
HA_KEYTYPE_END
;
/* End */
pos
->
type
=
HA_KEYTYPE_END
;
/* End */
pos
->
null_bit
=
0
;
pos
->
null_bit
=
0
;
pos
->
flag
=
0
;
pos
++
;
pos
++
;
}
}
}
}
...
...
mysql-test/mysql-test-run.sh
View file @
4157d12d
...
@@ -510,6 +510,7 @@ start_master()
...
@@ -510,6 +510,7 @@ start_master()
--basedir=
$MY_BASEDIR
\
--basedir=
$MY_BASEDIR
\
--port=
$MASTER_MYPORT
\
--port=
$MASTER_MYPORT
\
--exit-info=256
\
--exit-info=256
\
--core
--datadir=
$MASTER_MYDDIR
\
--datadir=
$MASTER_MYDDIR
\
--pid-file=
$MASTER_MYPID
\
--pid-file=
$MASTER_MYPID
\
--socket=
$MASTER_MYSOCK
\
--socket=
$MASTER_MYSOCK
\
...
...
scripts/make_binary_distribution.sh
View file @
4157d12d
...
@@ -63,7 +63,7 @@ done
...
@@ -63,7 +63,7 @@ done
for
i
in
extra/comp_err extra/replace extra/perror extra/resolveip
\
for
i
in
extra/comp_err extra/replace extra/perror extra/resolveip
\
extra/my_print_defaults extra/resolve_stack_dump
\
extra/my_print_defaults extra/resolve_stack_dump
\
isam/isamchk isam/pack_isam myisam/myisamchk
\
isam/isamchk isam/pack_isam myisam/myisamchk
\
myisam/myisampack sql/mysqld
sql
/mysqlbinlog
\
myisam/myisampack sql/mysqld
client
/mysqlbinlog
\
client/mysql sql/mysqld client/mysqlshow client/mysqlcheck
\
client/mysql sql/mysqld client/mysqlshow client/mysqlcheck
\
client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest
\
client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest
\
client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin
\
client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin
\
...
...
scripts/mysqlhotcopy.sh
View file @
4157d12d
...
@@ -6,6 +6,7 @@ use Data::Dumper;
...
@@ -6,6 +6,7 @@ use Data::Dumper;
use File::Basename
;
use File::Basename
;
use File::Path
;
use File::Path
;
use DBI
;
use DBI
;
use Sys::Hostname
;
=
head1 NAME
=
head1 NAME
...
@@ -36,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
...
@@ -36,7 +37,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome.
# Documentation continued at end of file
# Documentation continued at end of file
my
$VERSION
=
"1.1
2
"
;
my
$VERSION
=
"1.1
3
"
;
my
$opt_tmpdir
=
$ENV
{
TMPDIR
}
||
"/tmp"
;
my
$opt_tmpdir
=
$ENV
{
TMPDIR
}
||
"/tmp"
;
...
@@ -68,6 +69,7 @@ Usage: $0 db_name[./table_regex/] [new_db_name | directory]
...
@@ -68,6 +69,7 @@ Usage: $0 db_name[./table_regex/] [new_db_name | directory]
--resetmaster reset the binlog once all tables are locked
--resetmaster reset the binlog once all tables are locked
--resetslave reset the master.info once all tables are locked
--resetslave reset the master.info once all tables are locked
--tmpdir=# temporary directory (instead of
$opt_tmpdir
)
--tmpdir=# temporary directory (instead of
$opt_tmpdir
)
--record_log_pos=# record slave and master status in specified db.table
Try
\'
perldoc
$0
for more complete documentation
\'
Try
\'
perldoc
$0
for more complete documentation
\'
_OPTIONS
_OPTIONS
...
@@ -101,6 +103,7 @@ GetOptions( \%opt,
...
@@ -101,6 +103,7 @@ GetOptions( \%opt,
"regexp=s"
,
"regexp=s"
,
"suffix=s"
,
"suffix=s"
,
"checkpoint=s"
,
"checkpoint=s"
,
"record_log_pos=s"
,
"flushlog"
,
"flushlog"
,
"resetmaster"
,
"resetmaster"
,
"resetslave"
,
"resetslave"
,
...
@@ -117,6 +120,7 @@ GetOptions( \%opt,
...
@@ -117,6 +120,7 @@ GetOptions( \%opt,
# 'target' - destination directory of the copy
# 'target' - destination directory of the copy
# 'tables' - array-ref to list of tables in the db
# 'tables' - array-ref to list of tables in the db
# 'files' - array-ref to list of files to be copied
# 'files' - array-ref to list of files to be copied
# 'index' - array-ref to list of indexes to be copied
#
#
my @db_desc
=
()
;
my @db_desc
=
()
;
...
@@ -172,6 +176,16 @@ if ( $opt{checkpoint} ) {
...
@@ -172,6 +176,16 @@ if ( $opt{checkpoint} ) {
if
(
$@
)
;
if
(
$@
)
;
}
}
# --- check that log_pos table exists if specified ---
if
(
$opt
{
record_log_pos
}
)
{
eval
{
$dbh
->do
(
qq
{
select
host, time_stamp, log_file, log_pos, master_host, master_log_file, master_log_pos
from
$opt
{
record_log_pos
}
where 1
!=
1
}
)
;
}
;
die
"Error accessing log_pos table (
$opt
{record_log_pos}):
$@
"
if
(
$@
)
;
}
# --- get variables from database ---
# --- get variables from database ---
my
$sth_vars
=
$dbh
->prepare
(
"show variables like 'datadir'"
)
;
my
$sth_vars
=
$dbh
->prepare
(
"show variables like 'datadir'"
)
;
$sth_vars
->execute
;
$sth_vars
->execute
;
...
@@ -294,8 +308,6 @@ foreach my $rdb ( @db_desc ) {
...
@@ -294,8 +308,6 @@ foreach my $rdb ( @db_desc ) {
# --- resolve targets for copies ---
# --- resolve targets for copies ---
my @targets
=
()
;
if
(
defined
(
$tgt_name
)
&&
length
$tgt_name
)
{
if
(
defined
(
$tgt_name
)
&&
length
$tgt_name
)
{
# explicit destination directory specified
# explicit destination directory specified
...
@@ -382,11 +394,12 @@ foreach my $rdb ( @db_desc ) {
...
@@ -382,11 +394,12 @@ foreach my $rdb ( @db_desc ) {
# read lock all the tables we'll be copying
# read lock all the tables we'll be copying
# in order to get a consistent snapshot of the database
# in order to get a consistent snapshot of the database
if
(
$opt
{
checkpoint
}
)
{
if
(
$opt
{
checkpoint
}
||
$opt
{
record_log_pos
}
)
{
# convert existing READ lock on checkpoint table into WRITE lock
# convert existing READ lock on checkpoint and/or log_pos table into WRITE lock
unless
(
$hc_locks
=
~ s/
$opt
{
checkpoint
}
\s
+READ/
$opt
{
checkpoint
}
WRITE/
)
{
foreach my
$table
(
grep
{
defined
}
(
$opt
{
checkpoint
}
,
$opt
{
record_log_pos
}
)
)
{
$hc_locks
.
=
",
$opt
{checkpoint} WRITE"
;
$hc_locks
.
=
",
$table
WRITE"
}
unless
(
$hc_locks
=
~ s/
$table
\s
+READ/
$table
WRITE/
)
;
}
}
}
my
$hc_started
=
time
;
# count from time lock is granted
my
$hc_started
=
time
;
# count from time lock is granted
...
@@ -411,6 +424,11 @@ else {
...
@@ -411,6 +424,11 @@ else {
$dbh
->do
(
"FLUSH LOGS"
)
if
(
$opt
{
flushlog
}
)
;
$dbh
->do
(
"FLUSH LOGS"
)
if
(
$opt
{
flushlog
}
)
;
$dbh
->do
(
"RESET MASTER"
)
if
(
$opt
{
resetmaster
}
)
;
$dbh
->do
(
"RESET MASTER"
)
if
(
$opt
{
resetmaster
}
)
;
$dbh
->do
(
"RESET SLAVE"
)
if
(
$opt
{
resetslave
}
)
;
$dbh
->do
(
"RESET SLAVE"
)
if
(
$opt
{
resetslave
}
)
;
if
(
$opt
{
record_log_pos
}
)
{
record_log_pos
(
$dbh
,
$opt
{
record_log_pos
}
)
;
$dbh
->do
(
"FLUSH TABLES /*!32323
$hc_tables
*/"
)
;
}
}
}
my @failed
=
()
;
my @failed
=
()
;
...
@@ -473,6 +491,12 @@ if ( @failed ) {
...
@@ -473,6 +491,12 @@ if ( @failed ) {
# delete any @targets
# delete any @targets
# rename _old copy back to original
# rename _old copy back to original
my @targets
=
()
;
foreach my
$rdb
(
@db_desc
)
{
push @targets,
$rdb
->
{
target
}
if
(
-d
$rdb
->
{
target
}
)
;
}
print
"Deleting @targets
\n
"
if
$opt
{
debug
}
;
print
"Deleting @targets
\n
"
if
$opt
{
debug
}
;
print
"Deleting @targets
\n
"
if
$opt
{
debug
}
;
rmtree
([
@targets]
)
;
rmtree
([
@targets]
)
;
if
(
@existing
)
{
if
(
@existing
)
{
...
@@ -603,7 +627,6 @@ sub safe_system
...
@@ -603,7 +627,6 @@ sub safe_system
}
}
}
}
sub retire_directory
{
sub retire_directory
{
my
(
@dir
)
=
@_
;
my
(
@dir
)
=
@_
;
...
@@ -625,6 +648,40 @@ sub retire_directory {
...
@@ -625,6 +648,40 @@ sub retire_directory {
}
}
}
}
sub record_log_pos
{
my
(
$dbh
,
$table_name
)
=
@_
;
eval
{
my
(
$file
,
$position
)
=
get_row
(
$dbh
,
"show master status"
)
;
die
"master status is undefined"
if
!
defined
$file
||
!
defined
$position
;
my
(
$master_host
, undef, undef, undef,
$log_file
,
$log_pos
)
=
get_row
(
$dbh
,
"show slave status"
)
;
my
$hostname
=
hostname
()
;
$dbh
->do
(
qq
{
replace into
$table_name
set
host
=
?,
log_file
=
?,
log_pos
=
?,
master_host
=
?,
master_log_file
=
?,
master_log_pos
=
?
}
,
undef,
$hostname
,
$file
,
$position
,
$master_host
,
$log_file
,
$log_pos
)
;
}
;
if
(
$@
)
{
warn
"Failed to store master position:
$@
\n
"
;
}
}
sub get_row
{
my
(
$dbh
,
$sql
)
=
@_
;
my
$sth
=
$dbh
->prepare
(
$sql
)
;
$sth
->execute
;
return
$sth
->fetchrow_array
()
;
}
__END__
__END__
=
head1 DESCRIPTION
=
head1 DESCRIPTION
...
@@ -659,6 +716,38 @@ The checkpoint-table must contain at least the following fields:
...
@@ -659,6 +716,38 @@ The checkpoint-table must contain at least the following fields:
=
back
=
back
=
item
--record_log_pos
log-pos-table
Just before the database files are copied, update the record
in
the
log-pos-table from the values returned from
"show master status"
and
"show slave status"
.
The master status values are stored
in
the
log_file and log_pos columns, and establish the position
in
the binary
logs that any slaves of this host should adopt
if
initialised from
this dump. The slave status values are stored
in
master_host,
master_log_file, and master_log_pos, and these are useful
if
the host
performing the dump is a slave and other sibling slaves are to be
initialised from this dump.
The name of the log-pos table should be supplied
in
database.table format.
A sample log-pos table definition:
=
over 4
CREATE TABLE log_pos
(
host varchar
(
60
)
NOT null,
time_stamp timestamp
(
14
)
NOT NULL,
log_file varchar
(
32
)
default NULL,
log_pos int
(
11
)
default NULL,
master_host varchar
(
60
)
NULL,
master_log_file varchar
(
32
)
NULL,
master_log_pos int NULL,
PRIMARY KEY
(
host
)
)
;
=
back
=
item
--suffix
suffix
=
item
--suffix
suffix
Each database is copied back into the originating datadir under
Each database is copied back into the originating datadir under
...
@@ -784,7 +873,7 @@ Study the code inside this script and only rely on it if I<you> believe
...
@@ -784,7 +873,7 @@ Study the code inside this script and only rely on it if I<you> believe
that it does the right thing
for
you.
that it does the right thing
for
you.
Patches adding bug fixes, documentation and new features are welcome.
Patches adding bug fixes, documentation and new features are welcome.
Please send these to internals@mysql.com.
Please send these to internals@
lists.
mysql.com.
=
head1 TO DO
=
head1 TO DO
...
@@ -814,6 +903,8 @@ Add support for forthcoming MySQL ``RAID'' table subdirectory layouts.
...
@@ -814,6 +903,8 @@ Add support for forthcoming MySQL ``RAID'' table subdirectory layouts.
Tim Bunce
Tim Bunce
Martin Waite - added checkpoint, flushlog, regexp and dryrun options
Martin Waite - added checkpoint, flushlog, regexp and dryrun options
Fixed cleanup of targets when hotcopy fails.
Added
--record_log_pos
.
Ralph Corderoy - added synonyms
for
commands
Ralph Corderoy - added synonyms
for
commands
...
...
sql/item_timefunc.cc
View file @
4157d12d
...
@@ -525,7 +525,7 @@ String *Item_func_sec_to_time::val_str(String *str)
...
@@ -525,7 +525,7 @@ String *Item_func_sec_to_time::val_str(String *str)
seconds
=
-
seconds
;
seconds
=
-
seconds
;
sign
=
"-"
;
sign
=
"-"
;
}
}
uint
sec
=
(
uint
)
(
seconds
%
3600
);
uint
sec
=
(
uint
)
(
(
ulonglong
)
seconds
%
3600
);
sprintf
(
buff
,
"%s%02lu:%02u:%02u"
,
sign
,(
long
)
(
seconds
/
3600
),
sprintf
(
buff
,
"%s%02lu:%02u:%02u"
,
sign
,(
long
)
(
seconds
/
3600
),
sec
/
60
,
sec
%
60
);
sec
/
60
,
sec
%
60
);
str
->
copy
(
buff
,(
uint
)
strlen
(
buff
));
str
->
copy
(
buff
,(
uint
)
strlen
(
buff
));
...
...
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