mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Report time spent in posix_fallocate() as a wait event.
When allocating DSM segments with posix_fallocate() on Linux (see commit
899bd785), report this activity as a wait event exactly as we would if
we were using file-backed DSM rather than shm_open()-backed DSM.
Author: Thomas Munro
Discussion: https://postgr.es/m/CA%2BhUKGKCSh4GARZrJrQZwqs5SYp0xDMRr9Bvb%2BHQzJKvRgL6ZA%40mail.gmail.com
			
			
This commit is contained in:
		@@ -371,10 +371,12 @@ dsm_impl_posix_resize(int fd, off_t size)
 | 
				
			|||||||
		 * interrupt pending.  This avoids the possibility of looping forever
 | 
							 * interrupt pending.  This avoids the possibility of looping forever
 | 
				
			||||||
		 * if another backend is repeatedly trying to interrupt us.
 | 
							 * if another backend is repeatedly trying to interrupt us.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
 | 
							pgstat_report_wait_start(WAIT_EVENT_DSM_FILL_ZERO_WRITE);
 | 
				
			||||||
		do
 | 
							do
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			rc = posix_fallocate(fd, 0, size);
 | 
								rc = posix_fallocate(fd, 0, size);
 | 
				
			||||||
		} while (rc == EINTR && !(ProcDiePending || QueryCancelPending));
 | 
							} while (rc == EINTR && !(ProcDiePending || QueryCancelPending));
 | 
				
			||||||
 | 
							pgstat_report_wait_end();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * The caller expects errno to be set, but posix_fallocate() doesn't
 | 
							 * The caller expects errno to be set, but posix_fallocate() doesn't
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user