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
9a5dafba
Commit
9a5dafba
authored
May 26, 2004
by
marko@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InnoDB cleanup: Remove unused code for online backup
parent
92c15122
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
351 deletions
+8
-351
innobase/include/log0log.h
innobase/include/log0log.h
+0
-35
innobase/include/log0log.ic
innobase/include/log0log.ic
+1
-35
innobase/include/mtr0mtr.h
innobase/include/mtr0mtr.h
+1
-11
innobase/log/log0log.c
innobase/log/log0log.c
+0
-64
innobase/log/log0recv.c
innobase/log/log0recv.c
+1
-12
innobase/mtr/mtr0mtr.c
innobase/mtr/mtr0mtr.c
+5
-194
No files found.
innobase/include/log0log.h
View file @
9a5dafba
...
...
@@ -114,20 +114,6 @@ dulint
log_get_lsn
(
void
);
/*=============*/
/* out: current lsn */
/****************************************************************************
Gets the online backup lsn. */
UNIV_INLINE
dulint
log_get_online_backup_lsn_low
(
void
);
/*===============================*/
/****************************************************************************
Gets the online backup state. */
UNIV_INLINE
ibool
log_get_online_backup_state_low
(
void
);
/*=================================*/
/* out: online backup state, the caller must
own the log_sys mutex */
/**********************************************************
Initializes the log. */
...
...
@@ -326,20 +312,6 @@ log_archived_file_name_gen(
char
*
buf
,
/* in: buffer where to write */
ulint
id
,
/* in: group id */
ulint
file_no
);
/* in: file number */
/**********************************************************
Switches the database to the online backup state. */
ulint
log_switch_backup_state_on
(
void
);
/*============================*/
/* out: DB_SUCCESS or DB_ERROR */
/**********************************************************
Switches the online backup state off. */
ulint
log_switch_backup_state_off
(
void
);
/*=============================*/
/* out: DB_SUCCESS or DB_ERROR */
/************************************************************************
Checks that there is enough free space in the log to start a new query step.
Flushes the log buffer or makes a new checkpoint if necessary. NOTE: this
...
...
@@ -871,13 +843,6 @@ struct log_struct{
os_event_t
archiving_on
;
/* if archiving has been stopped,
a thread can wait for this event to
become signaled */
/* Fields involved in online backups */
ibool
online_backup_state
;
/* TRUE if the database is in the
online backup state */
dulint
online_backup_lsn
;
/* lsn when the state was changed to
the online backup state */
};
#define LOG_ARCH_ON 71
...
...
innobase/include/log0log.ic
View file @
9a5dafba
...
...
@@ -318,8 +318,7 @@ log_reserve_and_write_fast(
data_len = len + log->buf_free % OS_FILE_LOG_BLOCK_SIZE;
if (log->online_backup_state
|| (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE)) {
if (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE) {
/* The string does not fit within the current log block
or the log block would become full */
...
...
@@ -403,36 +402,3 @@ log_free_check(void)
log_check_margins();
}
}
/****************************************************************************
Gets the online backup lsn. */
UNIV_INLINE
dulint
log_get_online_backup_lsn_low(void)
/*===============================*/
/* out: online_backup_lsn, the caller must
own the log_sys mutex */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(log_sys->online_backup_state);
return(log_sys->online_backup_lsn);
}
/****************************************************************************
Gets the online backup state. */
UNIV_INLINE
ibool
log_get_online_backup_state_low(void)
/*=================================*/
/* out: online backup state, the caller must
own the log_sys mutex */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
return(log_sys->online_backup_state);
}
innobase/include/mtr0mtr.h
View file @
9a5dafba
...
...
@@ -82,7 +82,7 @@ flag value must give the length also! */
predefined minimum record */
#define MLOG_IBUF_BITMAP_INIT ((byte)27)
/* initialize an ibuf bitmap
page */
#define MLOG_FULL_PAGE ((byte)28)
/*
full contents of a page */
/*#define MLOG_FULL_PAGE ((byte)28)
full contents of a page */
#define MLOG_INIT_FILE_PAGE ((byte)29)
/* this means that a file page
is taken into use and the prior
contents of the page should be
...
...
@@ -230,16 +230,6 @@ mtr_memo_release(
mtr_t
*
mtr
,
/* in: mtr */
void
*
object
,
/* in: object */
ulint
type
);
/* in: object type: MTR_MEMO_S_LOCK, ... */
/****************************************************************
Parses a log record which contains the full contents of a page. */
byte
*
mtr_log_parse_full_page
(
/*====================*/
/* out: end of log record or NULL */
byte
*
ptr
,
/* in: buffer */
byte
*
end_ptr
,
/* in: buffer end */
page_t
*
page
);
/* in: page or NULL */
/**************************************************************
Checks if memo contains the given item. */
UNIV_INLINE
...
...
innobase/log/log0log.c
View file @
9a5dafba
...
...
@@ -793,11 +793,7 @@ log_init(void)
log_sys
->
archiving_on
=
os_event_create
(
NULL
);
/*----------------------------*/
log_sys
->
online_backup_state
=
FALSE
;
/*----------------------------*/
log_block_init
(
log_sys
->
buf
,
log_sys
->
lsn
);
log_block_set_first_rec_group
(
log_sys
->
buf
,
LOG_BLOCK_HDR_SIZE
);
...
...
@@ -2973,66 +2969,6 @@ loop:
mutex_exit
(
&
(
log_sys
->
mutex
));
}
/**********************************************************
Switches the database to the online backup state. */
ulint
log_switch_backup_state_on
(
void
)
/*============================*/
/* out: DB_SUCCESS or DB_ERROR */
{
dulint
backup_lsn
;
mutex_enter
(
&
(
log_sys
->
mutex
));
if
(
log_sys
->
online_backup_state
)
{
/* The database is already in that state */
mutex_exit
(
&
(
log_sys
->
mutex
));
return
(
DB_ERROR
);
}
log_sys
->
online_backup_state
=
TRUE
;
backup_lsn
=
log_sys
->
lsn
;
log_sys
->
online_backup_lsn
=
backup_lsn
;
mutex_exit
(
&
(
log_sys
->
mutex
));
/* log_checkpoint_and_mark_file_spaces(); */
return
(
DB_SUCCESS
);
}
/**********************************************************
Switches the online backup state off. */
ulint
log_switch_backup_state_off
(
void
)
/*=============================*/
/* out: DB_SUCCESS or DB_ERROR */
{
mutex_enter
(
&
(
log_sys
->
mutex
));
if
(
!
log_sys
->
online_backup_state
)
{
/* The database is already in that state */
mutex_exit
(
&
(
log_sys
->
mutex
));
return
(
DB_ERROR
);
}
log_sys
->
online_backup_state
=
FALSE
;
mutex_exit
(
&
(
log_sys
->
mutex
));
return
(
DB_SUCCESS
);
}
/********************************************************************
Makes a checkpoint at the latest lsn and writes it to first page of each
data file in the database, so that we know that the file spaces contain
...
...
innobase/log/log0recv.c
View file @
9a5dafba
...
...
@@ -790,9 +790,6 @@ recv_parse_or_apply_log_rec_body(
}
else
if
(
type
==
MLOG_IBUF_BITMAP_INIT
)
{
new_ptr
=
ibuf_parse_bitmap_init
(
ptr
,
end_ptr
,
page
,
mtr
);
}
else
if
(
type
==
MLOG_FULL_PAGE
)
{
new_ptr
=
mtr_log_parse_full_page
(
ptr
,
end_ptr
,
page
);
}
else
if
(
type
==
MLOG_INIT_FILE_PAGE
)
{
new_ptr
=
fsp_parse_init_file_page
(
ptr
,
end_ptr
,
page
);
...
...
@@ -1093,15 +1090,7 @@ recv_recover_page(
buf
=
((
byte
*
)(
recv
->
data
))
+
sizeof
(
recv_data_t
);
}
if
(
recv
->
type
==
MLOG_INIT_FILE_PAGE
||
recv
->
type
==
MLOG_FULL_PAGE
)
{
/* A new file page may have been taken into use,
or we have stored the full contents of the page:
in this case it may be that the original log record
type was MLOG_INIT_FILE_PAGE, and we replaced it
with MLOG_FULL_PAGE, thus we have to apply
any record of type MLOG_FULL_PAGE */
if
(
recv
->
type
==
MLOG_INIT_FILE_PAGE
)
{
page_lsn
=
page_newest_lsn
;
mach_write_to_8
(
page
+
UNIV_PAGE_SIZE
...
...
innobase/mtr/mtr0mtr.c
View file @
9a5dafba
...
...
@@ -105,179 +105,6 @@ mtr_memo_pop_all(
}
}
/****************************************************************
Writes to the log the contents of a full page. This is called when the
database is in the online backup state. */
static
void
mtr_log_write_full_page
(
/*====================*/
page_t
*
page
,
/* in: page to write */
ulint
i
,
/* in: i'th page for mtr */
ulint
n_pages
,
/* in: total number of pages for mtr */
mtr_t
*
mtr
)
/* in: mtr */
{
byte
*
buf
;
byte
*
ptr
;
ulint
len
;
buf
=
mem_alloc
(
UNIV_PAGE_SIZE
+
50
);
ptr
=
mlog_write_initial_log_record_fast
(
page
,
MLOG_FULL_PAGE
,
buf
,
mtr
);
ut_memcpy
(
ptr
,
page
,
UNIV_PAGE_SIZE
);
len
=
(
ptr
-
buf
)
+
UNIV_PAGE_SIZE
;
if
(
i
==
n_pages
-
1
)
{
if
(
n_pages
>
1
)
{
*
(
buf
+
len
)
=
MLOG_MULTI_REC_END
;
len
++
;
}
else
{
*
buf
=
(
byte
)((
ulint
)
*
buf
|
MLOG_SINGLE_REC_FLAG
);
}
}
ut_ad
(
len
<
UNIV_PAGE_SIZE
+
50
);
log_write_low
(
buf
,
len
);
mem_free
(
buf
);
}
/****************************************************************
Parses a log record which contains the full contents of a page. */
byte
*
mtr_log_parse_full_page
(
/*====================*/
/* out: end of log record or NULL */
byte
*
ptr
,
/* in: buffer */
byte
*
end_ptr
,
/* in: buffer end */
page_t
*
page
)
/* in: page or NULL */
{
if
(
end_ptr
<
ptr
+
UNIV_PAGE_SIZE
)
{
return
(
NULL
);
}
if
(
page
)
{
ut_memcpy
(
page
,
ptr
,
UNIV_PAGE_SIZE
);
}
return
(
ptr
+
UNIV_PAGE_SIZE
);
}
/****************************************************************
Writes to the database log the full contents of the pages that this mtr has
modified. */
static
void
mtr_log_write_backup_full_pages
(
/*============================*/
mtr_t
*
mtr
,
/* in: mini-transaction */
ulint
n_pages
)
/* in: number of pages modified by mtr */
{
mtr_memo_slot_t
*
slot
;
dyn_array_t
*
memo
;
buf_block_t
*
block
;
ulint
offset
;
ulint
type
;
ulint
i
;
ut_ad
(
mtr
);
ut_ad
(
mtr
->
magic_n
==
MTR_MAGIC_N
);
ut_ad
(
mtr
->
state
==
MTR_COMMITTING
);
/* Open the database log for log_write_low */
mtr
->
start_lsn
=
log_reserve_and_open
(
n_pages
*
(
UNIV_PAGE_SIZE
+
50
));
memo
=
&
(
mtr
->
memo
);
offset
=
dyn_array_get_data_size
(
memo
);
i
=
0
;
while
(
offset
>
0
)
{
offset
-=
sizeof
(
mtr_memo_slot_t
);
slot
=
dyn_array_get_element
(
memo
,
offset
);
block
=
slot
->
object
;
type
=
slot
->
type
;
if
((
block
!=
NULL
)
&&
(
type
==
MTR_MEMO_PAGE_X_FIX
))
{
mtr_log_write_full_page
(
block
->
frame
,
i
,
n_pages
,
mtr
);
i
++
;
}
}
ut_ad
(
i
==
n_pages
);
}
/****************************************************************
Checks if mtr is the first to modify any page after online_backup_lsn. */
static
ibool
mtr_first_to_modify_page_after_backup
(
/*==================================*/
/* out: TRUE if first for a page */
mtr_t
*
mtr
,
/* in: mini-transaction */
ulint
*
n_pages
)
/* out: number of modified pages (all modified
pages, backup_lsn does not matter here) */
{
mtr_memo_slot_t
*
slot
;
dyn_array_t
*
memo
;
ulint
offset
;
buf_block_t
*
block
;
ulint
type
;
dulint
backup_lsn
;
ibool
ret
=
FALSE
;
ut_ad
(
mtr
);
ut_ad
(
mtr
->
magic_n
==
MTR_MAGIC_N
);
ut_ad
(
mtr
->
state
==
MTR_COMMITTING
);
backup_lsn
=
log_get_online_backup_lsn_low
();
memo
=
&
(
mtr
->
memo
);
offset
=
dyn_array_get_data_size
(
memo
);
*
n_pages
=
0
;
while
(
offset
>
0
)
{
offset
-=
sizeof
(
mtr_memo_slot_t
);
slot
=
dyn_array_get_element
(
memo
,
offset
);
block
=
slot
->
object
;
type
=
slot
->
type
;
if
((
block
!=
NULL
)
&&
(
type
==
MTR_MEMO_PAGE_X_FIX
))
{
*
n_pages
=
*
n_pages
+
1
;
if
(
ut_dulint_cmp
(
buf_frame_get_newest_modification
(
block
->
frame
),
backup_lsn
)
<=
0
)
{
fprintf
(
stderr
,
"Page %lu newest %lu backup %lu
\n
"
,
block
->
offset
,
ut_dulint_get_low
(
buf_frame_get_newest_modification
(
block
->
frame
)),
ut_dulint_get_low
(
backup_lsn
));
ret
=
TRUE
;
}
}
}
return
(
ret
);
}
/****************************************************************
Writes the contents of a mini-transaction log, if any, to the database log. */
static
...
...
@@ -291,7 +118,6 @@ mtr_log_reserve_and_write(
ulint
data_size
;
ibool
success
;
byte
*
first_data
;
ulint
n_modified_pages
;
ut_ad
(
mtr
);
...
...
@@ -322,27 +148,12 @@ mtr_log_reserve_and_write(
if
(
mtr
->
log_mode
==
MTR_LOG_ALL
)
{
if
(
log_get_online_backup_state_low
()
&&
mtr_first_to_modify_page_after_backup
(
mtr
,
&
n_modified_pages
))
{
/* The database is in the online backup state: write
to the log the full contents of all the pages if this
mtr is the first to modify any page in the buffer pool
after online_backup_lsn */
log_close
();
log_release
();
mtr_log_write_backup_full_pages
(
mtr
,
n_modified_pages
);
}
else
{
block
=
mlog
;
block
=
mlog
;
while
(
block
!=
NULL
)
{
log_write_low
(
dyn_block_get_data
(
block
),
dyn_block_get_used
(
block
));
block
=
dyn_array_get_next_block
(
mlog
,
block
);
}
while
(
block
!=
NULL
)
{
log_write_low
(
dyn_block_get_data
(
block
),
dyn_block_get_used
(
block
));
block
=
dyn_array_get_next_block
(
mlog
,
block
);
}
}
else
{
ut_ad
(
mtr
->
log_mode
==
MTR_LOG_NONE
);
...
...
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