@@ -552,9 +552,16 @@ do_backup_instance(void)
552552 join_path_components (dst_backup_path , database_path , PG_XLOG_DIR );
553553 dir_create_dir (dst_backup_path , DIR_PERMISSION );
554554
555+ if (start_stream_mut == NULL ){
556+ pthread_mutex_init (& start_stream_mut ,NULL );
557+ }
558+
555559 pthread_mutex_lock (& start_stream_mut );
556560 pthread_create (& stream_thread , NULL , (void * (* )(void * )) StreamLog , dst_backup_path );
557561 pthread_mutex_lock (& start_stream_mut );
562+ #ifdef WIN32
563+ sleep (10 );
564+ #endif
558565 if (conn == NULL )
559566 elog (ERROR , "Cannot continue backup because stream connect has failed." );
560567
@@ -936,7 +943,7 @@ check_system_identifiers(void)
936943
937944 system_id_pgdata = get_system_identifier (pgdata );
938945 system_id_conn = get_remote_system_identifier (backup_conn );
939-
946+
940947 if (system_id_conn != system_identifier )
941948 elog (ERROR , "Backup data directory was initialized for system id %ld, but connected instance system id is %ld" ,
942949 system_identifier , system_id_conn );
@@ -959,14 +966,15 @@ confirm_block_size(const char *name, int blcksz)
959966 res = pgut_execute (backup_conn , "SELECT current_setting($1)" , 1 , & name , true);
960967 if (PQntuples (res ) != 1 || PQnfields (res ) != 1 )
961968 elog (ERROR , "cannot get %s: %s" , name , PQerrorMessage (backup_conn ));
962-
969+
963970 block_size = strtol (PQgetvalue (res , 0 , 0 ), & endp , 10 );
964- PQclear (res );
965-
966971 if ((endp && * endp ) || block_size != blcksz )
967972 elog (ERROR ,
968973 "%s(%d) is not compatible(%d expected)" ,
969974 name , block_size , blcksz );
975+
976+ PQclear (res );//bad pointer to endp
977+
970978}
971979
972980/*
@@ -2864,4 +2872,5 @@ pthread_join(pthread_t th, void **thread_return)
28642872 return 0 ;
28652873}
28662874
2875+
28672876#endif /* WIN32 */
0 commit comments