@@ -275,7 +275,7 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
275
275
my_bool wait_for_lock )
276
276
{
277
277
uchar buffer [CF_MAX_SIZE ];
278
- char name [FN_REFLEN ], errmsg_buff [256 ];
278
+ char name [FN_REFLEN ], errmsg_buff [512 ];
279
279
const char * errmsg , * lock_failed_errmsg = "Could not get an exclusive lock;"
280
280
" file is probably in use by another process" ;
281
281
uint new_cf_create_time_size , new_cf_changeable_size , new_block_size ;
@@ -399,10 +399,14 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
399
399
400
400
if (new_cf_create_time_size < CF_MIN_CREATE_TIME_TOTAL_SIZE ||
401
401
new_cf_changeable_size < CF_MIN_CHANGEABLE_TOTAL_SIZE ||
402
- new_cf_create_time_size + new_cf_changeable_size != file_size )
402
+ new_cf_create_time_size + new_cf_changeable_size > file_size )
403
403
{
404
404
error = CONTROL_FILE_INCONSISTENT_INFORMATION ;
405
- errmsg = "Sizes stored in control file are inconsistent" ;
405
+ sprintf (errmsg_buff ,
406
+ "Sizes stored in control file are inconsistent. "
407
+ "create_time_size: %u changeable_size: %u file_size: %llu" ,
408
+ new_cf_create_time_size , new_cf_changeable_size , (ulonglong ) file_size );
409
+ errmsg = errmsg_buff ;
406
410
goto err ;
407
411
}
408
412
@@ -613,13 +617,28 @@ my_bool ma_control_file_inited(void)
613
617
return (control_file_fd >= 0 );
614
618
}
615
619
620
+
621
+
622
+ static int check_zerofill (uchar * buffer , ulonglong offset , ulonglong length )
623
+ {
624
+ uchar * pos = buffer + offset , * end = buffer + length ;
625
+ while (pos < end )
626
+ {
627
+ if (* pos ++ )
628
+ return 1 ;
629
+ }
630
+ return 0 ;
631
+ }
632
+
633
+
616
634
/**
617
635
Print content of aria_log_control file
618
636
*/
619
637
620
638
my_bool print_aria_log_control ()
621
639
{
622
640
uchar buffer [CF_MAX_SIZE ];
641
+ char errmsg_buff [512 ];
623
642
char name [FN_REFLEN ], uuid_str [MY_UUID_STRING_LENGTH + 1 ];
624
643
const char * errmsg ;
625
644
uint new_cf_create_time_size , new_cf_changeable_size ;
@@ -696,10 +715,14 @@ my_bool print_aria_log_control()
696
715
697
716
if (new_cf_create_time_size < CF_MIN_CREATE_TIME_TOTAL_SIZE ||
698
717
new_cf_changeable_size < CF_MIN_CHANGEABLE_TOTAL_SIZE ||
699
- new_cf_create_time_size + new_cf_changeable_size != file_size )
718
+ new_cf_create_time_size + new_cf_changeable_size > file_size )
700
719
{
701
720
error = CONTROL_FILE_INCONSISTENT_INFORMATION ;
702
- errmsg = "Sizes stored in control file are inconsistent" ;
721
+ sprintf (errmsg_buff ,
722
+ "Sizes stored in control file are inconsistent. "
723
+ "create_time_size: %u changeable_size: %u file_size: %llu" ,
724
+ new_cf_create_time_size , new_cf_changeable_size , (ulonglong ) file_size );
725
+ errmsg = errmsg_buff ;
703
726
goto err ;
704
727
}
705
728
checkpoint_lsn = lsn_korr (buffer + new_cf_create_time_size +
@@ -723,6 +746,18 @@ my_bool print_aria_log_control()
723
746
(buffer + new_cf_create_time_size + CF_RECOV_FAIL_OFFSET )[0 ];
724
747
printf ("recovery_failures: %u\n" , recovery_fails );
725
748
}
749
+ if (check_zerofill (buffer , new_cf_create_time_size + new_cf_changeable_size , file_size ))
750
+ {
751
+ printf ("Warning: %s file_size is %llu (should be %llu) and contains unknown data.\n"
752
+ "It will still work but should be examined.\n" ,
753
+ name , (ulonglong ) file_size ,
754
+ (ulonglong ) (new_cf_create_time_size + new_cf_changeable_size ));
755
+ }
756
+ else if (new_cf_create_time_size + new_cf_changeable_size < file_size )
757
+ printf ("Note: file_size (%llu) is bigger than the expected file size %llu.\n"
758
+ "This is unexpected but will not cause any issues.\n" ,
759
+ (ulonglong ) file_size ,
760
+ (ulonglong ) (new_cf_create_time_size + new_cf_changeable_size ));
726
761
mysql_file_close (file , MYF (0 ));
727
762
DBUG_RETURN (0 );
728
763
0 commit comments