@@ -145,27 +145,25 @@ ptrackMapReadFromFile(const char *ptrack_path)
145
145
146
146
if (last_readed > 0 )
147
147
{
148
- readed += last_readed ;
148
+ readed += last_readed ;
149
149
}
150
150
else if (last_readed == 0 )
151
151
{
152
152
/*
153
153
* We don't try to read more that PtrackActualSize and
154
- * file size was alreay checked in ptrackMapInit()
154
+ * file size was already checked in ptrackMapInit()
155
155
*/
156
156
elog (ERROR , "ptrack read map: unexpected end of file while reading map file \"%s\", expected to read %zu, but read only %zu bytes" ,
157
157
ptrack_path , PtrackActualSize , readed );
158
158
}
159
- else if (last_readed < 0 )
159
+ else if (last_readed < 0 && errno != EINTR )
160
160
{
161
161
ereport (WARNING ,
162
162
(errcode_for_file_access (),
163
163
errmsg ("ptrack read map: could not read map file \"%s\": %m" , ptrack_path )));
164
164
close (ptrack_fd );
165
165
return false;
166
166
}
167
-
168
- readed += last_readed ;
169
167
} while (readed < PtrackActualSize );
170
168
171
169
close (ptrack_fd );
@@ -179,12 +177,12 @@ ptrackMapReadFromFile(const char *ptrack_path)
179
177
}
180
178
181
179
/* Check ptrack version inside old ptrack map */
182
- if (ptrack_map -> version_num < PTRACK_COMPATIBLE_VERSION_NUM )
180
+ if (ptrack_map -> version_num != PTRACK_MAP_FILE_VERSION_NUM )
183
181
{
184
182
ereport (WARNING ,
185
183
(errcode (ERRCODE_DATA_CORRUPTED ),
186
- errmsg ("ptrack read map: map format version %d in the file \"%s\" is incompatible with loaded version %d" ,
187
- ptrack_map -> version_num , ptrack_path , PTRACK_VERSION_NUM ),
184
+ errmsg ("ptrack read map: map format version %d in the file \"%s\" is incompatible with file format of extension %d" ,
185
+ ptrack_map -> version_num , ptrack_path , PTRACK_MAP_FILE_VERSION_NUM ),
188
186
errdetail ("Deleting file \"%s\" and reinitializing ptrack map." , ptrack_path )));
189
187
return false;
190
188
}
@@ -265,21 +263,13 @@ ptrackMapInit(void)
265
263
}
266
264
}
267
265
268
- /*
269
- * Unconditionally update version
270
- * This is usefull if we have read early compatible version of map
271
- */
272
- ptrack_map -> version_num = PTRACK_VERSION_NUM ;
273
-
274
266
/*
275
267
* Initialyze memory for new map
276
268
*/
277
269
if (is_new_map )
278
270
{
279
271
memcpy (ptrack_map -> magic , PTRACK_MAGIC , PTRACK_MAGIC_SIZE );
280
- /*
281
- * Weird PtrackMapHdr.init_lsn type?
282
- */
272
+ ptrack_map -> version_num = PTRACK_MAP_FILE_VERSION_NUM ;
283
273
ptrack_map -> init_lsn .value = InvalidXLogRecPtr ;
284
274
/*
285
275
* Fill entries with InvalidXLogRecPtr
0 commit comments