Commit 5e7b1bad authored by Monty's avatar Monty Committed by Sergei Golubchik

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
parent 58f26ab9
......@@ -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];
......
......@@ -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);
}
......
......@@ -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) &&
......
......@@ -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 */
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment