mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-10-30 23:37:29 +03:00 
			
		
		
		
	Don't advance replication cursor when the message wasn't confirmed
Fixes https://github.com/psycopg/psycopg2/issues/940
This commit is contained in:
		
							parent
							
								
									4d10f1235f
								
							
						
					
					
						commit
						9097a5b989
					
				|  | @ -1576,7 +1576,9 @@ retry: | |||
| 
 | ||||
|         /* We can safely forward flush_lsn to the wal_end from the server keepalive message
 | ||||
|          * if we know that the client already processed (confirmed) the last XLogData message */ | ||||
|         if (repl->flush_lsn >= repl->last_msg_data_start && wal_end > repl->flush_lsn) { | ||||
|         if (repl->explicitly_flushed_lsn >= repl->last_msg_data_start | ||||
|                 && wal_end > repl->explicitly_flushed_lsn | ||||
|                 && wal_end > repl->flush_lsn) { | ||||
|             repl->flush_lsn = wal_end; | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -52,6 +52,7 @@ typedef struct replicationCursorObject { | |||
| 
 | ||||
|     XLogRecPtr  last_msg_data_start; /* WAL pointer to the last non-keepalive message from the server */ | ||||
|     struct timeval last_feedback; /* timestamp of the last feedback message to the server */ | ||||
|     XLogRecPtr  explicitly_flushed_lsn; /* the flush LSN explicitly set by the send_feedback call */  | ||||
| } replicationCursorObject; | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -211,6 +211,9 @@ send_feedback(replicationCursorObject *self, | |||
|     if (write_lsn > self->write_lsn) | ||||
|         self->write_lsn = write_lsn; | ||||
| 
 | ||||
|     if (flush_lsn > self->explicitly_flushed_lsn) | ||||
|         self->explicitly_flushed_lsn = flush_lsn; | ||||
| 
 | ||||
|     if (flush_lsn > self->flush_lsn) | ||||
|         self->flush_lsn = flush_lsn; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user