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
fa8fad74
Commit
fa8fad74
authored
Feb 11, 2008
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-maria
into mysqlwin32.:C:/mysql-maria
parents
2944f4b0
8633d633
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
35 deletions
+33
-35
storage/maria/ma_control_file.c
storage/maria/ma_control_file.c
+8
-9
storage/maria/ma_loghandler.c
storage/maria/ma_loghandler.c
+12
-18
storage/maria/unittest/ma_test_loghandler_pagecache-t.c
storage/maria/unittest/ma_test_loghandler_pagecache-t.c
+13
-8
No files found.
storage/maria/ma_control_file.c
View file @
fa8fad74
...
...
@@ -212,9 +212,9 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open()
uchar
buffer
[
CF_MAX_SIZE
];
char
name
[
FN_REFLEN
],
errmsg_buff
[
256
];
const
char
*
errmsg
;
MY_STAT
stat_buff
;
uint
new_cf_create_time_size
,
new_cf_changeable_size
,
new_block_size
;
uint
retry
;
my_off_t
file_size
;
int
open_flags
=
O_BINARY
|
/*O_DIRECT |*/
O_RDWR
;
int
error
=
CONTROL_FILE_UNKNOWN_ERROR
;
DBUG_ENTER
(
"ma_control_file_create_or_open"
);
...
...
@@ -252,13 +252,13 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open()
goto
err
;
}
if
(
my_stat
(
name
,
&
stat_buff
,
MYF
(
0
))
==
NULL
)
file_size
=
my_seek
(
control_file_fd
,
0
,
SEEK_END
,
MYF
(
MY_WME
));
if
(
file_size
==
MY_FILEPOS_ERROR
)
{
errmsg
=
"Can't read s
tatus
"
;
errmsg
=
"Can't read s
ize
"
;
goto
err
;
}
if
((
uint
)
stat_buff
.
st_size
<
CF_MIN_SIZE
)
if
(
file_size
<
CF_MIN_SIZE
)
{
/*
Given that normally we write only a sector and it's atomic, the only
...
...
@@ -277,14 +277,14 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open()
}
/* Check if control file is unexpectedly big */
if
(
(
uint
)
stat_buff
.
st
_size
>
CF_MAX_SIZE
)
if
(
file
_size
>
CF_MAX_SIZE
)
{
error
=
CONTROL_FILE_TOO_BIG
;
errmsg
=
"File size bigger than expected"
;
goto
err
;
}
if
(
my_
read
(
control_file_fd
,
buffer
,
stat_buff
.
st_size
,
MYF
(
MY_FNABP
)))
if
(
my_
pread
(
control_file_fd
,
buffer
,
(
size_t
)
file_size
,
0
,
MYF
(
MY_FNABP
)))
{
errmsg
=
"Can't read file"
;
goto
err
;
...
...
@@ -312,8 +312,7 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open()
if
(
new_cf_create_time_size
<
CF_MIN_CREATE_TIME_TOTAL_SIZE
||
new_cf_changeable_size
<
CF_MIN_CHANGEABLE_TOTAL_SIZE
||
new_cf_create_time_size
+
new_cf_changeable_size
!=
stat_buff
.
st_size
)
new_cf_create_time_size
+
new_cf_changeable_size
!=
file_size
)
{
error
=
CONTROL_FILE_INCONSISTENT_INFORMATION
;
errmsg
=
"Sizes stored in control file are inconsistent"
;
...
...
storage/maria/ma_loghandler.c
View file @
fa8fad74
...
...
@@ -1135,10 +1135,11 @@ static my_bool translog_set_lsn_for_files(uint32 from_file, uint32 to_file,
{
LOGHANDLER_FILE_INFO
info
;
File
fd
=
open_logfile_by_number_no_cache
(
file
);
if
(
fd
<
0
||
translog_read_file_header
(
&
info
,
fd
)
||
(
cmp_translog_addr
(
lsn
,
info
.
max_lsn
)
>
0
&&
translog_max_lsn_to_header
(
fd
,
lsn
)))
if
((
fd
<
0
)
||
((
translog_read_file_header
(
&
info
,
fd
)
||
(
cmp_translog_addr
(
lsn
,
info
.
max_lsn
)
>
0
&&
translog_max_lsn_to_header
(
fd
,
lsn
)))
|
my_close
(
fd
,
MYF
(
MY_WME
))))
{
translog_stop_writing
();
DBUG_RETURN
(
1
);
...
...
@@ -1316,16 +1317,9 @@ LSN translog_get_file_max_lsn_stored(uint32 file)
{
LOGHANDLER_FILE_INFO
info
;
my_bool
error
;
File
fd
=
open_logfile_by_number_no_cache
(
file
);
if
(
fd
>=
0
)
{
error
=
translog_read_file_header
(
&
info
,
fd
);
my_close
(
fd
,
MYF
(
MY_WME
));
}
else
error
=
TRUE
;
if
(
error
)
if
((
fd
<
0
)
||
(
translog_read_file_header
(
&
info
,
fd
)
|
my_close
(
fd
,
MYF
(
MY_WME
))))
{
DBUG_PRINT
(
"error"
,
(
"Can't read file header"
));
DBUG_RETURN
(
LSN_ERROR
);
...
...
@@ -3129,11 +3123,11 @@ static my_bool translog_truncate_log(TRANSLOG_ADDRESS addr)
page_rest
=
next_page_offset
-
LSN_OFFSET
(
addr
);
memset
(
page_buff
,
TRANSLOG_FILLER
,
page_rest
);
if
((
fd
=
open_logfile_by_number_no_cache
(
LSN_FILE_NO
(
addr
)))
<
0
||
my_chsize
(
fd
,
next_page_offset
,
TRANSLOG_FILLER
,
MYF
(
MY_WME
))
||
(
page_rest
&&
my_pwrite
(
fd
,
page_buff
,
page_rest
,
LSN_OFFSET
(
addr
),
log_write_flags
))
||
my_sync
(
fd
,
MYF
(
MY_WME
))
|
|
my_close
(
fd
,
MYF
(
MY_WME
))
||
((
my_chsize
(
fd
,
next_page_offset
,
TRANSLOG_FILLER
,
MYF
(
MY_WME
))
||
(
page_rest
&&
my_pwrite
(
fd
,
page_buff
,
page_rest
,
LSN_OFFSET
(
addr
),
log_write_flags
))
||
my_sync
(
fd
,
MYF
(
MY_WME
)))
|
my_close
(
fd
,
MYF
(
MY_WME
)
))
||
(
sync_log_dir
>=
TRANSLOG_SYNC_DIR_ALWAYS
&&
sync_dir
(
log_descriptor
.
directory_fd
,
MYF
(
MY_WME
|
MY_IGNORE_BADFD
))))
DBUG_RETURN
(
1
);
...
...
storage/maria/unittest/ma_test_loghandler_pagecache-t.c
View file @
fa8fad74
...
...
@@ -51,7 +51,7 @@ int main(int argc __attribute__((unused)), char *argv[])
uchar
long_tr_id
[
6
];
PAGECACHE
pagecache
;
LSN
lsn
;
MY_STAT
st
,
*
stat
;
my_off_t
file_size
;
LEX_STRING
parts
[
TRANSLOG_INTERNAL_PARTS
+
1
];
MY_INIT
(
argv
[
0
]);
...
...
@@ -101,18 +101,20 @@ int main(int argc __attribute__((unused)), char *argv[])
/* Suppressing of automatic record writing */
dummy_transaction_object
.
first_undo_lsn
|=
TRANSACTION_LOGGED_LONG_ID
;
if
((
stat
=
my_stat
(
first_translog_file
,
&
st
,
MYF
(
0
)))
==
0
)
if
((
file1
.
file
=
my_open
(
first_translog_file
,
O_RDONLY
,
MYF
(
MY_WME
)))
<
0
)
{
fprintf
(
stderr
,
"There is no %s (%d)
\n
"
,
first_translog_file
,
errno
);
exit
(
1
);
}
if
(
st
.
st_size
!=
TRANSLOG_PAGE_SIZE
)
file_size
=
my_seek
(
file1
.
file
,
0
,
SEEK_END
,
MYF
(
MY_WME
));
if
(
file_size
!=
TRANSLOG_PAGE_SIZE
)
{
fprintf
(
stderr
,
"incorrect initial size of %s: %ld instead of %ld
\n
"
,
first_translog_file
,
(
long
)
st
.
st
_size
,
(
long
)
TRANSLOG_PAGE_SIZE
);
first_translog_file
,
(
long
)
file
_size
,
(
long
)
TRANSLOG_PAGE_SIZE
);
exit
(
1
);
}
my_close
(
file1
.
file
,
MYF
(
MY_WME
));
int4store
(
long_tr_id
,
0
);
parts
[
TRANSLOG_INTERNAL_PARTS
+
0
].
str
=
(
char
*
)
long_tr_id
;
parts
[
TRANSLOG_INTERNAL_PARTS
+
0
].
length
=
6
;
...
...
@@ -153,20 +155,23 @@ int main(int argc __attribute__((unused)), char *argv[])
0
,
LSN_IMPOSSIBLE
);
flush_pagecache_blocks
(
&
pagecache
,
&
file1
,
FLUSH_FORCE_WRITE
);
}
if
((
stat
=
my_stat
(
first_translog_file
,
&
st
,
MYF
(
0
)))
==
0
)
my_close
(
file1
.
file
,
MYF
(
MY_WME
));
if
((
file1
.
file
=
my_open
(
first_translog_file
,
O_RDONLY
,
MYF
(
MY_WME
)))
<
0
)
{
fprintf
(
stderr
,
"can't
stat
%s (%d)
\n
"
,
first_translog_file
,
errno
);
fprintf
(
stderr
,
"can't
open
%s (%d)
\n
"
,
first_translog_file
,
errno
);
exit
(
1
);
}
if
(
st
.
st_size
!=
TRANSLOG_PAGE_SIZE
*
2
)
file_size
=
my_seek
(
file1
.
file
,
0
,
SEEK_END
,
MYF
(
MY_WME
));
if
(
file_size
!=
TRANSLOG_PAGE_SIZE
*
2
)
{
fprintf
(
stderr
,
"incorrect initial size of %s: %ld instead of %ld
\n
"
,
first_translog_file
,
(
long
)
st
.
st
_size
,
(
long
)(
TRANSLOG_PAGE_SIZE
*
2
));
(
long
)
file
_size
,
(
long
)(
TRANSLOG_PAGE_SIZE
*
2
));
ok
(
0
,
"log triggered"
);
exit
(
1
);
}
my_close
(
file1
.
file
,
MYF
(
MY_WME
));
ok
(
1
,
"log triggered"
);
translog_destroy
();
...
...
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