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
5b94ea71
Commit
5b94ea71
authored
Dec 18, 2015
by
Sergei Golubchik
Committed by
Nirbhay Choubey
Dec 18, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-9044 Binlog corruption in Galera
unit test for the IO_CACHE bug
parent
58b54b7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
5 deletions
+47
-5
unittest/sql/mf_iocache-t.cc
unittest/sql/mf_iocache-t.cc
+47
-5
No files found.
unittest/sql/mf_iocache-t.cc
View file @
5b94ea71
...
...
@@ -112,6 +112,8 @@ void temp_io_cache()
uchar
buf
[
CACHE_SIZE
+
200
];
memset
(
buf
,
FILL
,
sizeof
(
buf
));
diag
(
"temp io_cache with%s encryption"
,
encrypt_tmp_files
?
""
:
"out"
);
init_io_cache_encryption
();
res
=
open_cached_file
(
&
info
,
0
,
0
,
CACHE_SIZE
,
0
);
...
...
@@ -137,7 +139,7 @@ void temp_io_cache()
res
=
my_pread
(
info
.
file
,
buf
,
50
,
50
,
MYF
(
MY_NABP
));
ok
(
res
==
0
&&
data_bad
(
buf
,
50
)
==
encrypt_tmp_files
,
"
check encryption,
file must be %sreadable"
,
encrypt_tmp_files
?
"un"
:
""
);
"file must be %sreadable"
,
encrypt_tmp_files
?
"un"
:
""
);
res
=
my_b_read
(
&
info
,
buf
,
50
)
||
data_bad
(
buf
,
50
);
ok
(
res
==
0
&&
info
.
pos_in_file
==
0
,
"small read"
INFO_TAIL
);
...
...
@@ -148,18 +150,58 @@ void temp_io_cache()
close_cached_file
(
&
info
);
}
void
mdev9044
()
{
int
res
;
uchar
buf
[
CACHE_SIZE
+
200
];
diag
(
"MDEV-9044 Binlog corruption in Galera"
);
res
=
open_cached_file
(
&
info
,
0
,
0
,
CACHE_SIZE
,
0
);
ok
(
res
==
0
,
"open_cached_file"
INFO_TAIL
);
res
=
my_b_write
(
&
info
,
USTRING_WITH_LEN
(
"first write
\0
"
));
ok
(
res
==
0
,
"first write"
INFO_TAIL
);
res
=
my_b_flush_io_cache
(
&
info
,
1
);
ok
(
res
==
0
,
"flush"
INFO_TAIL
);
res
=
reinit_io_cache
(
&
info
,
WRITE_CACHE
,
0
,
0
,
0
);
ok
(
res
==
0
,
"reinit WRITE_CACHE"
INFO_TAIL
);
res
=
my_b_write
(
&
info
,
USTRING_WITH_LEN
(
"second write
\0
"
));
ok
(
res
==
0
,
"second write"
INFO_TAIL
);
res
=
reinit_io_cache
(
&
info
,
READ_CACHE
,
0
,
0
,
0
);
ok
(
res
==
0
,
"reinit READ_CACHE"
INFO_TAIL
);
res
=
my_b_fill
(
&
info
);
ok
(
res
==
0
,
"fill"
INFO_TAIL
);
res
=
reinit_io_cache
(
&
info
,
READ_CACHE
,
0
,
0
,
0
);
ok
(
res
==
0
,
"reinit READ_CACHE"
INFO_TAIL
);
res
=
my_b_read
(
&
info
,
buf
,
sizeof
(
buf
));
ok
(
res
==
1
&&
strcmp
((
char
*
)
buf
,
"second write"
)
==
0
,
"read '%s'"
,
buf
);
close_cached_file
(
&
info
);
}
int
main
(
int
argc
__attribute__
((
unused
)),
char
*
argv
[])
{
MY_INIT
(
argv
[
0
]);
plan
(
2
0
);
plan
(
2
9
);
/* temp files */
encrypt_tmp_files
=
0
;
/* temp files
with and without encryption
*/
encrypt_tmp_files
=
1
;
temp_io_cache
();
encrypt_tmp_files
=
1
;
encrypt_tmp_files
=
0
;
temp_io_cache
();
/* regression tests */
mdev9044
();
my_end
(
0
);
return
exit_status
();
}
...
...
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