File tree Expand file tree Collapse file tree 1 file changed +9
-16
lines changed Expand file tree Collapse file tree 1 file changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -1280,19 +1280,16 @@ int
1280
1280
mdsyncfiletag (const FileTag * ftag , char * path )
1281
1281
{
1282
1282
SMgrRelation reln = smgropen (ftag -> rnode , InvalidBackendId );
1283
- int fd ,
1284
- result ,
1285
- save_errno ;
1283
+ File file ;
1286
1284
bool need_to_close ;
1285
+ int result ,
1286
+ save_errno ;
1287
1287
1288
1288
/* See if we already have the file open, or need to open it. */
1289
1289
if (ftag -> segno < reln -> md_num_open_segs [ftag -> forknum ])
1290
1290
{
1291
- File file ;
1292
-
1293
1291
file = reln -> md_seg_fds [ftag -> forknum ][ftag -> segno ].mdfd_vfd ;
1294
1292
strlcpy (path , FilePathName (file ), MAXPGPATH );
1295
- fd = FileGetRawDesc (file );
1296
1293
need_to_close = false;
1297
1294
}
1298
1295
else
@@ -1303,24 +1300,20 @@ mdsyncfiletag(const FileTag *ftag, char *path)
1303
1300
strlcpy (path , p , MAXPGPATH );
1304
1301
pfree (p );
1305
1302
1306
- fd = OpenTransientFile (path , O_RDWR );
1307
- if (fd < 0 )
1303
+ file = PathNameOpenFile (path , O_RDWR | PG_BINARY );
1304
+ if (file < 0 )
1308
1305
return -1 ;
1309
1306
need_to_close = true;
1310
1307
}
1311
1308
1312
1309
/* Sync the file. */
1313
- pgstat_report_wait_start (WAIT_EVENT_DATA_FILE_SYNC );
1314
- result = pg_fsync (fd );
1310
+ result = FileSync (file , WAIT_EVENT_DATA_FILE_SYNC );
1315
1311
save_errno = errno ;
1316
- pgstat_report_wait_end ();
1317
1312
1318
- if (need_to_close && CloseTransientFile (fd ) != 0 )
1319
- ereport (WARNING ,
1320
- (errcode_for_file_access (),
1321
- errmsg ("could not close file \"%s\": %m" , path )));
1322
- errno = save_errno ;
1313
+ if (need_to_close )
1314
+ FileClose (file );
1323
1315
1316
+ errno = save_errno ;
1324
1317
return result ;
1325
1318
}
1326
1319
You can’t perform that action at this time.
0 commit comments