@@ -750,7 +750,7 @@ copy_meta(const char *from_path, const char *to_path)
750750 * Copy WAL segment from pgdata to archive catalog with possible compression.
751751 */
752752void
753- push_wal_file (const char * from_path , const char * to_path , bool is_compress )
753+ push_wal_file (const char * from_path , const char * to_path )
754754{
755755 FILE * in = NULL ;
756756 FILE * out ;
@@ -770,7 +770,10 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress)
770770
771771 /* open backup file for write */
772772#ifdef HAVE_LIBZ
773- if (is_compress )
773+ if (compress_alg == PGLZ_COMPRESS )
774+ elog (ERROR , "pglz compression is not supported" );
775+
776+ if (compress_alg == ZLIB_COMPRESS )
774777 {
775778 snprintf (gz_to_path , sizeof (gz_to_path ), "%s.gz" , to_path );
776779 gz_out = gzopen (gz_to_path , "wb" );
@@ -803,7 +806,7 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress)
803806 if (read_len > 0 )
804807 {
805808#ifdef HAVE_LIBZ
806- if (is_compress )
809+ if (compress_alg == ZLIB_COMPRESS )
807810 {
808811 if (gzwrite (gz_out , buf , read_len ) != read_len )
809812 elog (ERROR , "Cannot write to compressed WAL segment \"%s\": %s" ,
@@ -823,10 +826,10 @@ push_wal_file(const char *from_path, const char *to_path, bool is_compress)
823826 }
824827
825828#ifdef HAVE_LIBZ
826- if (is_compress && gzclose (gz_out ) != 0 )
829+ if (compress_alg == ZLIB_COMPRESS && gzclose (gz_out ) != 0 )
827830 elog (ERROR , "Cannot close compressed WAL segment \"%s\": %s" ,
828831 gz_to_path , get_gz_error (gz_out ));
829- else if (! is_compress )
832+ else if (compress_alg != ZLIB_COMPRESS )
830833#endif
831834 {
832835 if (fflush (out ) != 0 ||
0 commit comments