@@ -1387,15 +1387,16 @@ get_wal_file(const char *filename, const char *from_fullpath,
13871387 */
13881388 if (fio_is_remote (FIO_BACKUP_HOST ))
13891389 {
1390+ char * errmsg = NULL ;
13901391 /* get file via ssh */
13911392#ifdef HAVE_LIBZ
13921393 /* If requested file is regular WAL segment, then try to open it with '.gz' suffix... */
13931394 if (IsXLogFileName (filename ))
1394- rc = fio_send_file_gz (from_fullpath_gz , to_fullpath , out , thread_num );
1395+ rc = fio_send_file_gz (from_fullpath_gz , to_fullpath , out , NULL , & errmsg );
13951396 if (rc == FILE_MISSING )
13961397#endif
13971398 /* ... failing that, use uncompressed */
1398- rc = fio_send_file (from_fullpath , to_fullpath , out , thread_num );
1399+ rc = fio_send_file (from_fullpath , to_fullpath , out , NULL , & errmsg );
13991400
14001401 /* When not in prefetch mode, try to use partial file */
14011402 if (rc == FILE_MISSING && !prefetch_mode && IsXLogFileName (filename ))
@@ -1405,18 +1406,27 @@ get_wal_file(const char *filename, const char *from_fullpath,
14051406#ifdef HAVE_LIBZ
14061407 /* '.gz.partial' goes first ... */
14071408 snprintf (from_partial , sizeof (from_partial ), "%s.gz.partial" , from_fullpath );
1408- rc = fio_send_file_gz (from_partial , to_fullpath , out , thread_num );
1409+ rc = fio_send_file_gz (from_partial , to_fullpath , out , NULL , & errmsg );
14091410 if (rc == FILE_MISSING )
14101411#endif
14111412 {
14121413 /* ... failing that, use '.partial' */
14131414 snprintf (from_partial , sizeof (from_partial ), "%s.partial" , from_fullpath );
1414- rc = fio_send_file (from_partial , to_fullpath , out , thread_num );
1415+ rc = fio_send_file (from_partial , to_fullpath , out , NULL , & errmsg );
14151416 }
14161417
14171418 if (rc == SEND_OK )
14181419 src_partial = true;
14191420 }
1421+
1422+ if (rc == WRITE_FAILED )
1423+ elog (WARNING , "Thread [%d]: Cannot write to file '%s': %s" ,
1424+ thread_num , to_fullpath , strerror (errno ));
1425+
1426+ if (errmsg )
1427+ elog (WARNING , "Thread [%d]: %s" , thread_num , errmsg );
1428+
1429+ pg_free (errmsg );
14201430 }
14211431 else
14221432 {
0 commit comments