diff options
author | Monty <monty@mariadb.org> | 2021-05-12 18:36:43 +0300 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-05-19 22:54:12 +0200 |
commit | 5e7b1bad2f8a8e69c6cf9aa82737453603b56c46 (patch) | |
tree | ca1cd388f2b4995ab13268ba0dc9a5cc48647f99 | |
parent | 58f26ab9d577f71206a3c3cbf2f1c0f0ebd154e0 (diff) | |
download | mariadb-git-5e7b1bad2f8a8e69c6cf9aa82737453603b56c46.tar.gz |
Do not display not moved tables as moved in aria_chk
This happened because in ma_open() we did not take into account that
tran_man (Aria transaction manager) would not be initialized.
Fixed by using the same check for minimum transaction id as we use
during repair.
Other things:
- ariad_read_log now displays a readable timestamp
- Removed printing of datapage for header. This removes
some wrong warnings from the aria_read_log output
-rw-r--r-- | storage/maria/ma_check.c | 20 | ||||
-rw-r--r-- | storage/maria/ma_loghandler.c | 11 | ||||
-rw-r--r-- | storage/maria/ma_open.c | 2 | ||||
-rw-r--r-- | storage/maria/ma_trnman.h | 17 | ||||
-rw-r--r-- | storage/maria/trnman.c | 1 |
5 files changed, 30 insertions, 21 deletions
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index e1c85cd2d44..d996cd6a757 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -44,6 +44,7 @@ #include "ma_rt_index.h" #include "ma_blockrec.h" #include "trnman.h" +#include "ma_trnman.h" #include "ma_key_recover.h" #include <my_check_opt.h> #include <my_stack_alloc.h> @@ -94,7 +95,6 @@ static void report_keypage_fault(HA_CHECK *param, MARIA_HA *info, static my_bool create_new_data_handle(MARIA_SORT_PARAM *param, File new_file); static my_bool _ma_flush_table_files_before_swap(HA_CHECK *param, MARIA_HA *info); -static TrID max_trid_in_system(void); static void _ma_check_print_not_visible_error(HA_CHECK *param, TrID used_trid); void retry_if_quick(MARIA_SORT_PARAM *param, int error); static void print_bitmap_description(MARIA_SHARE *share, @@ -6987,24 +6987,6 @@ static void report_keypage_fault(HA_CHECK *param, MARIA_HA *info, } -/** - When we want to check a table, we verify that the transaction ids of rows - and keys are not bigger than the biggest id generated by Maria so far, which - is returned by the function below. - - @note If control file is not open, 0 may be returned; to not confuse - this with a valid max trid of 0, the caller should notice that it failed to - open the control file (ma_control_file_inited() can serve for that). -*/ - -static TrID max_trid_in_system(void) -{ - TrID id= trnman_get_max_trid(); /* 0 if transac manager not initialized */ - /* 'id' may be far bigger, if last shutdown is old */ - return MY_MAX(id, max_trid_in_control_file); -} - - static void _ma_check_print_not_visible_error(HA_CHECK *param, TrID used_trid) { char buff[22], buff2[22]; diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 5d3402ef866..e2956d7ca3c 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -9062,13 +9062,21 @@ static void dump_header_page(uchar *buff) { LOGHANDLER_FILE_INFO desc; char strbuff[21]; + struct tm tmp_tm; + time_t header_time; + translog_interpret_file_header(&desc, buff); + header_time= desc.timestamp/1000000ULL; + localtime_r(&header_time, &tmp_tm); + printf(" This can be header page:\n" - " Timestamp: %s\n" + " Timestamp: %04d.%02d.%02d %02d.%02d.%02d (%s)\n" " Aria log version: %lu\n" " Server version: %lu\n" " Server id %lu\n" " Page size %lu\n", + tmp_tm.tm_year+1900, tmp_tm.tm_mon+1, tmp_tm.tm_mday, + tmp_tm.tm_hour, tmp_tm.tm_min, tmp_tm.tm_sec, llstr(desc.timestamp, strbuff), desc.maria_version, desc.mysql_version, @@ -9325,6 +9333,7 @@ void dump_page(uchar *buffer, File handler) sizeof(maria_trans_file_magic)) == 0) { dump_header_page(buffer); + return; } dump_datapage(buffer, handler); } diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index b82e02bb5dc..49fd0dcc7af 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -562,7 +562,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags, case the uuid will be set in _ma_mark_file_changed(). */ if (born_transactional && - ((share->state.create_trid > trnman_get_max_trid() && + ((share->state.create_trid > max_trid_in_system() && !maria_in_recovery) || ((share->state.changed & STATE_NOT_MOVABLE) && ((!(open_flags & HA_OPEN_IGNORE_MOVED_STATE) && diff --git a/storage/maria/ma_trnman.h b/storage/maria/ma_trnman.h index 87e34e9da0b..c863eac5bdc 100644 --- a/storage/maria/ma_trnman.h +++ b/storage/maria/ma_trnman.h @@ -96,4 +96,21 @@ static inline void relink_trn_used_instances(MARIA_HA **used_tables, TRN *trn) } } +/** + When we want to check a table, we verify that the transaction ids of rows + and keys are not bigger than the biggest id generated by Maria so far, which + is returned by the function below. + + @note If control file is not open, 0 may be returned; to not confuse + this with a valid max trid of 0, the caller should notice that it failed to + open the control file (ma_control_file_inited() can serve for that). +*/ + +static inline TrID max_trid_in_system(void) +{ + TrID id= trnman_get_max_trid(); /* 0 if transac manager not initialized */ + /* 'id' may be far bigger, if last shutdown is old */ + return MY_MAX(id, max_trid_in_control_file); +} + #endif /* _ma_trnman_h */ diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c index 0c7f6c54f5e..7cac6a2d0c6 100644 --- a/storage/maria/trnman.c +++ b/storage/maria/trnman.c @@ -902,6 +902,7 @@ TrID trnman_get_min_safe_trid() TrID trnman_get_max_trid() { TrID id; + /* Check if trnman has been initalized */ if (short_trid_to_active_trn == NULL) return 0; mysql_mutex_lock(&LOCK_trn_list); |