@@ -1102,7 +1102,6 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress,
11021102#ifdef HAVE_LIBZ
11031103char gz_to_path [MAXPGPATH ];
11041104gzFile gz_out = NULL ;
1105- int gz_tmp = -1 ;
11061105
11071106if (is_compress )
11081107{
@@ -1135,14 +1134,10 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress,
11351134{
11361135snprintf (to_path_temp ,sizeof (to_path_temp ),"%s.partial" ,gz_to_path );
11371136
1138- gz_out = fio_gzopen (to_path_temp ,PG_BINARY_W ,& gz_tmp ,FIO_BACKUP_HOST );
1137+ gz_out = fio_gzopen (to_path_temp ,PG_BINARY_W ,instance_config . compress_level ,FIO_BACKUP_HOST );
11391138if (gz_out == NULL )
11401139elog (ERROR ,"Cannot open destination temporary WAL file \"%s\": %s" ,
11411140to_path_temp ,strerror (errno ));
1142- if (gzsetparams (gz_out ,instance_config .compress_level ,Z_DEFAULT_STRATEGY )!= Z_OK )
1143- elog (ERROR ,"Cannot set compression level %d to file \"%s\": %s" ,
1144- instance_config .compress_level ,to_path_temp ,
1145- get_gz_error (gz_out ,errno ));
11461141}
11471142else
11481143#endif
@@ -1176,7 +1171,7 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress,
11761171#ifdef HAVE_LIBZ
11771172if (is_compress )
11781173{
1179- if (gzwrite (gz_out ,buf ,read_len )!= read_len )
1174+ if (fio_gzwrite (gz_out ,buf ,read_len )!= read_len )
11801175{
11811176errno_temp = errno ;
11821177fio_unlink (to_path_temp ,FIO_BACKUP_HOST );
@@ -1204,7 +1199,7 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress,
12041199#ifdef HAVE_LIBZ
12051200if (is_compress )
12061201{
1207- if (fio_gzclose (gz_out , to_path_temp , gz_tmp )!= 0 )
1202+ if (fio_gzclose (gz_out )!= 0 )
12081203{
12091204errno_temp = errno ;
12101205fio_unlink (to_path_temp ,FIO_BACKUP_HOST );
@@ -1696,10 +1691,9 @@ fileEqualCRC(const char *path1, const char *path2, bool path2_is_compressed)
16961691{
16971692char buf [1024 ];
16981693gzFile gz_in = NULL ;
1699- int gz_tmp = -1 ;
17001694
17011695INIT_FILE_CRC32 (true,crc2 );
1702- gz_in = fio_gzopen (path2 ,PG_BINARY_R ,& gz_tmp ,FIO_BACKUP_HOST );
1696+ gz_in = fio_gzopen (path2 ,PG_BINARY_R ,Z_DEFAULT_COMPRESSION ,FIO_BACKUP_HOST );
17031697if (gz_in == NULL )
17041698/* File cannot be read */
17051699elog (ERROR ,
@@ -1709,20 +1703,20 @@ fileEqualCRC(const char *path1, const char *path2, bool path2_is_compressed)
17091703for (;;)
17101704{
17111705size_t read_len = 0 ;
1712- read_len = gzread (gz_in ,buf ,sizeof (buf ));
1713- if (read_len != sizeof (buf )&& !gzeof (gz_in ))
1706+ read_len = fio_gzread (gz_in ,buf ,sizeof (buf ));
1707+ if (read_len != sizeof (buf )&& !fio_gzeof (gz_in ))
17141708/* An error occurred while reading the file */
17151709elog (ERROR ,
17161710"Cannot compare WAL file \"%s\" with compressed \"%s\"" ,
17171711path1 ,path2 );
17181712
17191713COMP_FILE_CRC32 (true,crc2 ,buf ,read_len );
1720- if (gzeof (gz_in )|| read_len == 0 )
1714+ if (fio_gzeof (gz_in )|| read_len == 0 )
17211715break ;
17221716}
17231717FIN_FILE_CRC32 (true,crc2 );
17241718
1725- if (fio_gzclose (gz_in , path2 , gz_tmp )!= 0 )
1719+ if (fio_gzclose (gz_in )!= 0 )
17261720elog (ERROR ,"Cannot close compressed WAL file \"%s\": %s" ,
17271721path2 ,get_gz_error (gz_in ,errno ));
17281722}