@@ -2862,8 +2862,8 @@ MtmStateLoad(void)
2862
2862
fsync_fname ("pg_mtm" , true);
2863
2863
2864
2864
2865
- readBytes = read (fd , & ondisk , MtmStateOnDiskConstantSize );
2866
- if (readBytes != MtmStateOnDiskConstantSize )
2865
+ readBytes = read (fd , & ondisk , sizeof ( MtmStateOnDisk ) );
2866
+ if (readBytes != sizeof ( MtmStateOnDisk ) )
2867
2867
{
2868
2868
int save_errno = errno ;
2869
2869
@@ -2896,30 +2896,6 @@ MtmStateLoad(void)
2896
2896
errmsg ("mtm state file \"%s\" has unsupported version: %u instead of %u" ,
2897
2897
path , ondisk .version , MTMSTATE_VERSION )));
2898
2898
2899
- readBytes = read (fd , & ondisk .current_gen ,
2900
- sizeof (MtmStateOnDisk ) - MtmStateOnDiskConstantSize );
2901
-
2902
- if (readBytes != (sizeof (MtmStateOnDisk ) - MtmStateOnDiskConstantSize ))
2903
- {
2904
- int save_errno = errno ;
2905
-
2906
- CloseTransientFile (fd );
2907
-
2908
- if (readBytes < 0 )
2909
- {
2910
- errno = save_errno ;
2911
- ereport (ERROR ,
2912
- (errcode_for_file_access (),
2913
- errmsg ("could not read file \"%s\": %m" , path )));
2914
- }
2915
- else
2916
- ereport (ERROR ,
2917
- (errcode (ERRCODE_DATA_CORRUPTED ),
2918
- errmsg ("could not read file \"%s\": read %d of %zu" ,
2919
- path , readBytes ,
2920
- sizeof (MtmStateOnDisk ) - MtmStateOnDiskConstantSize )));
2921
- }
2922
-
2923
2899
INIT_CRC32C (checksum );
2924
2900
COMP_CRC32C (checksum ,
2925
2901
((char * ) & ondisk ) + MtmStateOnDiskNotChecksummedSize ,
0 commit comments