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
60d93c69
Commit
60d93c69
authored
Dec 24, 2009
by
Luis Soares
Browse files
Options
Browse Files
Download
Plain Diff
BUG#48738: merge local branch into mysql-5.0-bugteam latest.
parents
c3114506
fe40b172
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
226 additions
and
4 deletions
+226
-4
mysql-test/r/binlog_delete_and_flush_index.result
mysql-test/r/binlog_delete_and_flush_index.result
+44
-0
mysql-test/t/binlog_delete_and_flush_index.test
mysql-test/t/binlog_delete_and_flush_index.test
+176
-0
sql/log.cc
sql/log.cc
+6
-4
No files found.
mysql-test/r/binlog_delete_and_flush_index.result
0 → 100644
View file @
60d93c69
RESET MASTER;
CREATE TABLE t1 (a int);
### assertion: index file contains regular entries
SET @index=LOAD_FILE('MYSQLD_DATADIR/master-bin.index');
master-bin.000001
### assertion: show original binlogs
show binary logs;
Log_name File_size
master-bin.000001 #
### assertion: binlog contents from regular entries
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
FLUSH LOGS;
### assertion: index file contains renamed binlog and the new one
SET @index=LOAD_FILE('MYSQLD_DATADIR/master-bin.index');
master-bin-b34582.000001
master-bin.000002
### assertion: original binlog content still exists, despite we
### renamed and changed the index file
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin-b34582.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
### assertion: user changed binlog index shows correct entries
show binary logs;
Log_name File_size
master-bin-b34582.000001 #
master-bin.000002 #
DROP TABLE t1;
### assertion: purging binlogs up to binlog created after instrumenting index file should work
PURGE BINARY LOGS TO 'master-bin.000002';
### assertion: show binary logs should only contain latest binlog
show binary logs;
Log_name File_size
master-bin.000002 #
### assertion: assert that binlog files were indeed purged (using file_exists calls)
### assertion: assert that not purged binlog file exists
### assertion: show index file contents and these should match show binary logs issued above
SET @index=LOAD_FILE('MYSQLD_DATADIR/master-bin.index');
master-bin.000002
RESET MASTER;
mysql-test/t/binlog_delete_and_flush_index.test
0 → 100644
View file @
60d93c69
# BUG#34582: FLUSH LOGS does not close and reopen the binlog index
# file
#
# WHAT
# ====
#
# We want to test that FLUSH LOGS closes and reopens binlog index
# file.
#
# HOW
# ===
#
# PREPARE:
# 1. create some binlog events
# 2. show index content, binlog events and binlog contents
# for mysql-bin.000001
# 3. copy the mysql-bin.000001 to mysql-bin-b34582.000001
# 4. change the index file so that mysql-bin.000001 is replaced
# with mysql-bin-b34582.000001
# 5. FLUSH the logs so that new index is closed and reopened
#
# ASSERTIONS:
# 1. index file contents shows mysql-bin-b34582.000001 and
# mysql-bin.000002
# 1. show binary logs shows current index entries
# 2. binlog contents for mysql-bin-b34582.000001 are displayed
# 3. Purge binlogs up to the latest one succeeds
# 4. SHOW BINARY LOGS presents the latest one only after purging
# 5. Purged binlogs files don't exist in the filesystem
# 6. Not purged binlog file exists in the filesystem
#
# CLEAN UP:
# 1. RESET MASTER
#
--
source
include
/
have_log_bin
.
inc
RESET
MASTER
;
--
let
$datadir
=
$MYSQLTEST_VARDIR
/
log
--
let
$index
=
$datadir
/
master
-
bin
.
index
--
chmod
0666
$index
# action: issue one command so that binlog gets some event
CREATE
TABLE
t1
(
a
int
);
--
echo
### assertion: index file contains regular entries
--
replace_regex
/
[
\\\
/
]
.*
master
/
MYSQLD_DATADIR
\
/
master
/
--
eval
SET
@
index
=
LOAD_FILE
(
'$index'
)
if
(
`SELECT convert(@@version_compile_os using latin1)
IN ('Win32','Win64','Windows')`
)
{
--
disable_query_log
--
disable_result_log
--
let
$a
=
`SELECT REPLACE (@index, '$datadir\', '')`
--
enable_result_log
--
enable_query_log
--
echo
$a
}
if
(
!
`SELECT convert(@@version_compile_os using latin1)
IN ('Win32','Win64','Windows')`
)
{
--
disable_query_log
--
disable_result_log
--
let
$a
=
`SELECT REPLACE (@index, '$datadir/', '')`
--
enable_result_log
--
enable_query_log
--
echo
$a
}
--
echo
### assertion: show original binlogs
--
source
include
/
show_binary_logs
.
inc
--
echo
### assertion: binlog contents from regular entries
--
source
include
/
show_binlog_events
.
inc
# action: copy binlogs to other names and change entries in index file
--
copy_file
$datadir
/
master
-
bin
.
000001
$datadir
/
master
-
bin
-
b34582
.
000001
--
let
newbinfile
=
$datadir
/
master
-
bin
-
b34582
.
000001
let
INDEX_FILE
=
$index
;
perl
;
$newbinfile
=
$ENV
{
'newbinfile'
};
$file
=
$ENV
{
'INDEX_FILE'
};
open
(
FILE
,
">
$file
"
)
||
die
"Unable to open
$file
."
;
truncate
(
FILE
,
0
);
print
FILE
$newbinfile
.
"
\n
"
;
close
(
$file
);
EOF
# action: should cause rotation, and creation of new binlogs
FLUSH
LOGS
;
# file is not used anymore - remove it (mysql closed on flush logs).
--
remove_file
$datadir
/
master
-
bin
.
000001
--
echo
### assertion: index file contains renamed binlog and the new one
--
replace_regex
/
[
\\\
/
]
.*
master
/
MYSQLD_DATADIR
\
/
master
/
--
eval
SET
@
index
=
LOAD_FILE
(
'$index'
)
if
(
`SELECT convert(@@version_compile_os using latin1)
IN ('Win32','Win64','Windows')`
)
{
--
disable_query_log
--
disable_result_log
--
let
$a
=
`SELECT REPLACE (@index, '$datadir\', '')`
--
enable_result_log
--
enable_query_log
--
echo
$a
}
if
(
!
`SELECT convert(@@version_compile_os using latin1)
IN ('Win32','Win64','Windows')`
)
{
--
disable_query_log
--
disable_result_log
--
let
$a
=
`SELECT REPLACE (@index, '$datadir/', '')`
--
enable_result_log
--
enable_query_log
--
echo
$a
}
--
echo
### assertion: original binlog content still exists, despite we
--
echo
### renamed and changed the index file
--
source
include
/
show_binlog_events
.
inc
--
echo
### assertion: user changed binlog index shows correct entries
--
source
include
/
show_binary_logs
.
inc
DROP
TABLE
t1
;
--
echo
### assertion: purging binlogs up to binlog created after instrumenting index file should work
--
let
$current_binlog
=
query_get_value
(
SHOW
MASTER
STATUS
,
File
,
1
)
--
eval
PURGE
BINARY
LOGS
TO
'$current_binlog'
--
echo
### assertion: show binary logs should only contain latest binlog
--
source
include
/
show_binary_logs
.
inc
--
echo
### assertion: assert that binlog files were indeed purged (using file_exists calls)
--
error
1
--
file_exists
$datadir
/
master
-
bin
-
b34852
.
000001
--
echo
### assertion: assert that not purged binlog file exists
--
file_exists
$datadir
/
$current_binlog
--
echo
### assertion: show index file contents and these should match show binary logs issued above
--
replace_regex
/
[
\\\
/
]
.*
master
/
MYSQLD_DATADIR
\
/
master
/
--
eval
SET
@
index
=
LOAD_FILE
(
'$index'
)
if
(
`SELECT convert(@@version_compile_os using latin1)
IN ('Win32','Win64','Windows')`
)
{
--
disable_query_log
--
disable_result_log
--
let
$a
=
`SELECT REPLACE (@index, '$datadir\', '')`
--
enable_result_log
--
enable_query_log
--
echo
$a
}
if
(
!
`SELECT convert(@@version_compile_os using latin1)
IN ('Win32','Win64','Windows')`
)
{
--
disable_query_log
--
disable_result_log
--
let
$a
=
`SELECT REPLACE (@index, '$datadir/', '')`
--
enable_result_log
--
enable_query_log
--
echo
$a
}
RESET
MASTER
;
sql/log.cc
View file @
60d93c69
...
...
@@ -1635,7 +1635,7 @@ void MYSQL_LOG::new_file(bool need_lock)
old_name
=
name
;
save_log_type
=
log_type
;
name
=
0
;
// Don't free name
close
(
LOG_CLOSE_TO_BE_OPENED
);
close
(
LOG_CLOSE_TO_BE_OPENED
|
LOG_CLOSE_INDEX
);
/*
Note that at this point, log_type != LOG_CLOSED (important for is_open()).
...
...
@@ -1650,6 +1650,8 @@ void MYSQL_LOG::new_file(bool need_lock)
trigger temp tables deletion on slaves.
*/
/* reopen index binlog file, BUG#34582 */
if
(
!
open_index_file
(
index_file_name
,
0
))
open
(
old_name
,
save_log_type
,
new_name_ptr
,
io_cache_type
,
no_auto_events
,
max_size
,
1
);
my_free
(
old_name
,
MYF
(
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